diff --git a/OOXML/DocxFormat/Logic/RunProperty.cpp b/OOXML/DocxFormat/Logic/RunProperty.cpp index b2a49ae7c0..94f4615a3f 100644 --- a/OOXML/DocxFormat/Logic/RunProperty.cpp +++ b/OOXML/DocxFormat/Logic/RunProperty.cpp @@ -51,6 +51,14 @@ namespace OOX { namespace Logic { + //-------------------------------------------------------------------------------- + // StylisticSets + //-------------------------------------------------------------------------------- + + CStylisticSets::CStylisticSets(OOX::Document *pMain) : WritingElementWithChilds(pMain) + { + } + CStylisticSets::~CStylisticSets() {} void CStylisticSets::fromXML(XmlUtils::CXmlLiteReader& oReader) { if (oReader.IsEmptyNode()) @@ -67,6 +75,9 @@ namespace OOX } } } + void CStylisticSets::fromXML(XmlUtils::CXmlNode& node) + { + } std::wstring CStylisticSets::toXML() const { std::wstring sResult = L""; @@ -82,6 +93,11 @@ namespace OOX sResult += L""; return sResult; } + EElementType CStylisticSets::getType() const + { + return et_w_stylisticSets; + } + //-------------------------------------------------------------------------------- // RPrChange //-------------------------------------------------------------------------------- @@ -192,6 +208,41 @@ namespace OOX WritingElement_ReadAttributes_End( oReader ) } + //-------------------------------------------------------------------------------- + // RunProperty + //-------------------------------------------------------------------------------- + + CRunProperty::CRunProperty() + { + m_pText = NULL; + m_bRPRChange = false; + } + CRunProperty::~CRunProperty() + { + RELEASEOBJECT(m_pText); + } + CRunProperty::CRunProperty(const XmlUtils::CXmlNode &oNode) + { + m_pText = NULL; + m_bRPRChange = false; + fromXML( (XmlUtils::CXmlNode &)oNode ); + } + CRunProperty::CRunProperty(const XmlUtils::CXmlLiteReader& oReader) + { + m_pText = NULL; + m_bRPRChange = false; + fromXML( (XmlUtils::CXmlLiteReader&)oReader ); + } + const CRunProperty& CRunProperty::operator=(const XmlUtils::CXmlNode &oNode) + { + fromXML( (XmlUtils::CXmlNode &)oNode ); + return *this; + } + const CRunProperty& CRunProperty::operator=(const XmlUtils::CXmlLiteReader& oReader) + { + fromXML( (XmlUtils::CXmlLiteReader&)oReader ); + return *this; + } void CRunProperty::fromXML(XmlUtils::CXmlLiteReader& oReader) { fromXML(oReader, NULL); @@ -346,7 +397,6 @@ namespace OOX m_oRFonts->m_sAscii = *m_oFontName->m_sVal; } } - void CRunProperty::fromXML(XmlUtils::CXmlNode& oNode) { if ( L"w:rPr" != oNode.GetName() ) @@ -503,7 +553,6 @@ namespace OOX if (!pWriter) return; pWriter->WriteString(toXML()); } - std::wstring CRunProperty::toXML() const { std::wstring sResult = L""; @@ -730,7 +779,10 @@ namespace OOX return oProperties; } - + EElementType CRunProperty::getType() const + { + return et_w_rPr; + } } // Logic diff --git a/OOXML/DocxFormat/Logic/RunProperty.h b/OOXML/DocxFormat/Logic/RunProperty.h index 23b05b7ac0..2e9925e16a 100644 --- a/OOXML/DocxFormat/Logic/RunProperty.h +++ b/OOXML/DocxFormat/Logic/RunProperty.h @@ -54,21 +54,14 @@ namespace OOX { public: WritingElement_AdditionConstructors(CStylisticSets) - CStylisticSets(OOX::Document *pMain = NULL) : WritingElementWithChilds(pMain) - { - } - virtual ~CStylisticSets() {} + CStylisticSets(OOX::Document *pMain = NULL); + virtual ~CStylisticSets(); virtual std::wstring toXML() const; - virtual void fromXML(XmlUtils::CXmlNode& node) - { - } + virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - virtual EElementType getType() const - { - return et_w_stylisticSets; - } + virtual EElementType getType() const; }; //-------------------------------------------------------------------------------- @@ -98,41 +91,17 @@ namespace OOX nullable m_pRunPr; }; - class CRunProperty : public WritingElement { public: - CRunProperty() - { - m_pText = NULL; - m_bRPRChange = false; - } - virtual ~CRunProperty() - { - RELEASEOBJECT(m_pText); - } - CRunProperty(const XmlUtils::CXmlNode &oNode) - { - m_pText = NULL; - m_bRPRChange = false; - fromXML( (XmlUtils::CXmlNode &)oNode ); - } - CRunProperty(const XmlUtils::CXmlLiteReader& oReader) - { - m_pText = NULL; - m_bRPRChange = false; - fromXML( (XmlUtils::CXmlLiteReader&)oReader ); - } - const CRunProperty& operator=(const XmlUtils::CXmlNode &oNode) - { - fromXML( (XmlUtils::CXmlNode &)oNode ); - return *this; - } - const CRunProperty& operator=(const XmlUtils::CXmlLiteReader& oReader) - { - fromXML( (XmlUtils::CXmlLiteReader&)oReader ); - return *this; - } + CRunProperty(); + virtual ~CRunProperty(); + CRunProperty(const XmlUtils::CXmlNode &oNode); + CRunProperty(const XmlUtils::CXmlLiteReader& oReader); + + const CRunProperty& operator=(const XmlUtils::CXmlNode &oNode); + const CRunProperty& operator=(const XmlUtils::CXmlLiteReader& oReader); + bool IsNoEmpty(); void Clear(); @@ -141,10 +110,8 @@ namespace OOX void fromXML(XmlUtils::CXmlLiteReader& oReader, CRun* pRun); virtual std::wstring toXML() const; virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const; - virtual EElementType getType() const - { - return et_w_rPr; - } + virtual EElementType getType() const; + template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { diff --git a/OOXML/DocxFormat/Logic/Sdt.cpp b/OOXML/DocxFormat/Logic/Sdt.cpp index f59b1949b9..b151e8b3d8 100644 --- a/OOXML/DocxFormat/Logic/Sdt.cpp +++ b/OOXML/DocxFormat/Logic/Sdt.cpp @@ -55,6 +55,12 @@ namespace ComplexTypes { namespace Word { + CComb::CComb() + { + } + CComb::~CComb() + { + } void CComb::FromXML(XmlUtils::CXmlNode& oNode) { XmlMacroReadAttributeBase( oNode, L"w:width", m_oWidth ); @@ -100,6 +106,12 @@ namespace ComplexTypes WritingElement_ReadAttributes_End( oReader ) } //---------------------------------------------------------------------------------------------------- + CTextFormFormat::CTextFormFormat() + { + } + CTextFormFormat::~CTextFormFormat() + { + } void CTextFormFormat::FromXML(XmlUtils::CXmlNode& oNode) { XmlMacroReadAttributeBase(oNode, L"w:type", m_oType); @@ -138,6 +150,267 @@ namespace ComplexTypes WritingElement_ReadAttributes_Read_else_if(oReader, L"w:symbols", m_oSymbols) WritingElement_ReadAttributes_End(oReader) } +//---------------------------------------------------------------------------------------------------- + CSdtAppearance::CSdtAppearance() + { + } + CSdtAppearance::~CSdtAppearance() + { + } + void CSdtAppearance::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w15:val", m_oVal ); + } + void CSdtAppearance::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CSdtAppearance::ToString() const + { + std::wstring sResult; + if(m_oVal.IsInit()) + { + sResult = L"w15:val=\"" + m_oVal->ToString() + L"\""; + } + + return sResult; + } + void CSdtAppearance::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w15:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } +//---------------------------------------------------------------------------------------------------- + CSdtText::CSdtText() + { + } + CSdtText::~CSdtText() + { + } + void CSdtText::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:multiLine", m_oMultiLine ); + } + void CSdtText::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CSdtText::ToString() const + { + std::wstring sResult; + if(m_oMultiLine.IsInit()) + { + sResult = L"w:multiLine=\"" + m_oMultiLine->ToString() + L"\""; + } + + return sResult; + } + void CSdtText::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:multiLine", m_oMultiLine ) + WritingElement_ReadAttributes_End( oReader ) + } +//---------------------------------------------------------------------------------------------------- + CLock::CLock() + { + } + CLock::~CLock() + { + } + void CLock::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CLock::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CLock::ToString() const + { + std::wstring sResult = L"w:val=\"" + m_oVal.ToString() + L"\""; + + return sResult; + } + void CLock::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } +//---------------------------------------------------------------------------------------------------- + CSdtDateMappingType::CSdtDateMappingType() + { + } + CSdtDateMappingType::~CSdtDateMappingType() + { + } + void CSdtDateMappingType::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CSdtDateMappingType::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CSdtDateMappingType::ToString() const + { + std::wstring sResult = L"w:val=\"" + m_oVal.ToString() + L"\""; + return sResult; + } + void CSdtDateMappingType::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } +//---------------------------------------------------------------------------------------------------- + CCalendarType::CCalendarType() + { + } + CCalendarType::~CCalendarType() + { + } + void CCalendarType::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CCalendarType::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CCalendarType::ToString() const + { + std::wstring sResult = L"w:val=\"" + m_oVal.ToString() + L"\""; + return sResult; + } + void CCalendarType::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + m_oVal.SetValue(SimpleTypes::calendartypeGregorian); + + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } +//---------------------------------------------------------------------------------------------------- + CDataBinding::CDataBinding() + { + } + CDataBinding::~CDataBinding() + { + } + void CDataBinding::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:prefixMappings", m_sPrefixMappings ); + XmlMacroReadAttributeBase( oNode, L"w:storeItemID", m_sStoreItemID ); + XmlMacroReadAttributeBase( oNode, L"w:xpath", m_sXPath ); + } + void CDataBinding::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CDataBinding::ToString() const + { + std::wstring sResult; + + if ( m_sPrefixMappings.IsInit() ) + { + sResult += L"w:prefixMappings=\""; + sResult += m_sPrefixMappings.get2(); + sResult += L"\" "; + } + + if ( m_sXPath.IsInit() ) + { + sResult += L"w:xpath=\""; + sResult += m_sXPath.get2(); + sResult += L"\" "; + } + + if ( m_sStoreItemID.IsInit() ) + { + sResult += L"w:storeItemID=\""; + sResult += m_sStoreItemID.get2(); + sResult += L"\" "; + } + return sResult; + } + void CDataBinding::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:prefixMappings", m_sPrefixMappings ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:storeItemID", m_sStoreItemID ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:xpath", m_sXPath ) + WritingElement_ReadAttributes_End( oReader ) + } +//---------------------------------------------------------------------------------------------------- + CSdtListItem::CSdtListItem() + { + } + CSdtListItem::~CSdtListItem() + { + } + void CSdtListItem::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:displayText", m_sDisplayText ); + XmlMacroReadAttributeBase( oNode, L"w:value", m_sValue ); + } + void CSdtListItem::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CSdtListItem::ToString() const + { + std::wstring sResult; + + if ( m_sDisplayText.IsInit() ) + { + sResult += L"w:displayText=\""; + sResult += XmlUtils::EncodeXmlString(*m_sDisplayText); + sResult += L"\" "; + } + + if ( m_sValue.IsInit() ) + { + sResult += L"w:value=\""; + sResult += XmlUtils::EncodeXmlString(*m_sValue); + sResult += L"\" "; + } + + return sResult; + } + void CSdtListItem::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:displayText", m_sDisplayText ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:value", m_sValue ) + WritingElement_ReadAttributes_End( oReader ) + } +//---------------------------------------------------------------------------------------------------- + +//---------------------------------------------------------------------------------------------------- } } //----------------------------------------------------------------------------------------------------------------------------- diff --git a/OOXML/DocxFormat/Logic/Sdt.h b/OOXML/DocxFormat/Logic/Sdt.h index 4049eb3235..8983f9cad4 100644 --- a/OOXML/DocxFormat/Logic/Sdt.h +++ b/OOXML/DocxFormat/Logic/Sdt.h @@ -47,58 +47,17 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CSdtListItem) - CSdtListItem() - { - } - virtual ~CSdtListItem() - { - } + CSdtListItem(); + virtual ~CSdtListItem(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:displayText", m_sDisplayText ); - XmlMacroReadAttributeBase( oNode, L"w:value", m_sValue ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); - - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_sDisplayText.IsInit() ) - { - sResult += L"w:displayText=\""; - sResult += XmlUtils::EncodeXmlString(*m_sDisplayText); - sResult += L"\" "; - } - - if ( m_sValue.IsInit() ) - { - sResult += L"w:value=\""; - sResult += XmlUtils::EncodeXmlString(*m_sValue); - sResult += L"\" "; - } - - return sResult; - } + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:displayText", m_sDisplayText ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:value", m_sValue ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable_string m_sDisplayText; nullable_string m_sValue; }; @@ -110,65 +69,17 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CDataBinding) - CDataBinding() - { - } - virtual ~CDataBinding() - { - } + CDataBinding(); + virtual ~CDataBinding(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:prefixMappings", m_sPrefixMappings ); - XmlMacroReadAttributeBase( oNode, L"w:storeItemID", m_sStoreItemID ); - XmlMacroReadAttributeBase( oNode, L"w:xpath", m_sXPath ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - - if ( m_sPrefixMappings.IsInit() ) - { - sResult += L"w:prefixMappings=\""; - sResult += m_sPrefixMappings.get2(); - sResult += L"\" "; - } - - if ( m_sXPath.IsInit() ) - { - sResult += L"w:xpath=\""; - sResult += m_sXPath.get2(); - sResult += L"\" "; - } - - if ( m_sStoreItemID.IsInit() ) - { - sResult += L"w:storeItemID=\""; - sResult += m_sStoreItemID.get2(); - sResult += L"\" "; - } - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:prefixMappings", m_sPrefixMappings ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:storeItemID", m_sStoreItemID ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:xpath", m_sXPath ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_sPrefixMappings; nullable m_sStoreItemID; nullable m_sXPath; @@ -181,42 +92,17 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CCalendarType) - CCalendarType() - { - } - virtual ~CCalendarType() - { - } + CCalendarType(); + virtual ~CCalendarType(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult = L"w:val=\"" + m_oVal.ToString() + L"\""; - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - m_oVal.SetValue(SimpleTypes::calendartypeGregorian); - - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - SimpleTypes::CCalendarType m_oVal; }; @@ -227,40 +113,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CSdtDateMappingType) - CSdtDateMappingType() - { - } - virtual ~CSdtDateMappingType() - { - } + CSdtDateMappingType(); + virtual ~CSdtDateMappingType(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult = L"w:val=\"" + m_oVal.ToString() + L"\""; - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - SimpleTypes::CSdtDateMappingType m_oVal; }; @@ -271,41 +135,17 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CLock) - CLock() - { - } - virtual ~CLock() - { - } + CLock(); + virtual ~CLock(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult = L"w:val=\"" + m_oVal.ToString() + L"\""; - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - SimpleTypes::CLock m_oVal; }; @@ -316,45 +156,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CSdtText) - CSdtText() - { - } - virtual ~CSdtText() - { - } + CSdtText(); + virtual ~CSdtText(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:multiLine", m_oMultiLine ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - if(m_oMultiLine.IsInit()) - { - sResult = L"w:multiLine=\"" + m_oMultiLine->ToString() + L"\""; - } + virtual std::wstring ToString() const; - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:multiLine", m_oMultiLine ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oMultiLine; }; //-------------------------------------------------------------------------------- @@ -364,42 +177,15 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CSdtAppearance) - CSdtAppearance() - { - } - virtual ~CSdtAppearance() - { - } + CSdtAppearance(); + virtual ~CSdtAppearance(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w15:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring ToString() const; - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; - if(m_oVal.IsInit()) - { - sResult = L"w15:val=\"" + m_oVal->ToString() + L"\""; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w15:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: @@ -411,13 +197,8 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CComb) - CComb() - { - } - virtual ~CComb() - { - } - + CComb(); + virtual ~CComb(); virtual void FromXML(XmlUtils::CXmlNode& oNode); virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); virtual std::wstring ToString() const; @@ -437,13 +218,8 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CTextFormFormat) - CTextFormFormat() - { - } - virtual ~CTextFormFormat() - { - } - + CTextFormFormat(); + virtual ~CTextFormFormat(); virtual void FromXML(XmlUtils::CXmlNode& oNode); virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); virtual std::wstring ToString() const; @@ -456,6 +232,7 @@ namespace ComplexTypes nullable_string m_oVal; nullable_string m_oSymbols; }; + } // Word } // ComplexTypes diff --git a/OOXML/DocxFormat/Logic/SectionProperty.cpp b/OOXML/DocxFormat/Logic/SectionProperty.cpp index 68afd755cd..331bc0b534 100644 --- a/OOXML/DocxFormat/Logic/SectionProperty.cpp +++ b/OOXML/DocxFormat/Logic/SectionProperty.cpp @@ -34,6 +34,945 @@ #include "SectionProperty.h" +namespace ComplexTypes +{ + namespace Word + { + //-------------------------------------------------------------------------------- + // Column 17.6.3 (Part 1) + //-------------------------------------------------------------------------------- + + CColumn::CColumn() + { + } + CColumn::~CColumn() + { + } + void CColumn::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:space", m_oSpace ); + XmlMacroReadAttributeBase( oNode, L"w:w", m_oW ); + } + void CColumn::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CColumn::ToString() const + { + std::wstring sResult; + + if ( m_oW.IsInit() ) + { + sResult += L"w:w=\"" + std::to_wstring(m_oW->ToTwips()) + L"\" "; + } + + if ( m_oSpace.IsInit() ) + { + sResult += L"w:space=\"" + std::to_wstring(m_oSpace->ToTwips()) + L"\" "; + } + + return sResult; + } + void CColumn::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"w:space"), m_oSpace ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:w"), m_oW ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // DocGrid 17.6.5 (Part 1) + //-------------------------------------------------------------------------------- + + CDocGrid::CDocGrid() + { + } + CDocGrid::~CDocGrid() + { + } + void CDocGrid::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 ); + } + void CDocGrid::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CDocGrid::ToString() const + { + std::wstring sResult; + + if (m_oType.IsInit()) + { + sResult += L" w:type=\"" + m_oType->ToString() + L"\""; + } + if ( m_oLinePitch.IsInit() ) + { + sResult += L" w:linePitch=\"" + m_oLinePitch->ToString() + L"\""; + } + if (m_oCharSpace.IsInit()) + { + sResult += L" w:charSpace=\"" + m_oCharSpace->ToString() + L"\""; + } + return sResult; + } + void CDocGrid::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 ) + } + + //-------------------------------------------------------------------------------- + // HdrFtrRef 17.10.5 (Part 1) + //-------------------------------------------------------------------------------- + + CHdrFtrRef::CHdrFtrRef() + { + } + CHdrFtrRef::~CHdrFtrRef() + { + } + void CHdrFtrRef::FromXML(XmlUtils::CXmlNode& oNode) + {//todooo переделать на перебор всех и без неймспейсов + XmlMacroReadAttributeBase( oNode, L"r:id", m_oId ); + XmlMacroReadAttributeBase( oNode, L"w:type", m_oType ); + + if (false == m_oId.IsInit()) + { + XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); + } + } + void CHdrFtrRef::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CHdrFtrRef::ToString() const + { + std::wstring sResult; + + if ( m_oType.IsInit() ) + { + sResult += L" w:type=\"" + m_oType->ToString() + L"\""; + } + if ( m_oId.IsInit() ) + { + sResult += L" r:id=\"" + m_oId->ToString() + L"\""; + } + return sResult; + } + void CHdrFtrRef::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start_No_NS( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"id"), m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"type"), m_oType ) + WritingElement_ReadAttributes_End_No_NS( oReader ) + } + + //-------------------------------------------------------------------------------- + // LineNumber 17.6.8 (Part 1) + //-------------------------------------------------------------------------------- + + CLineNumber::CLineNumber() + { + } + CLineNumber::~CLineNumber() + { + } + void CLineNumber::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, (L"w:countBy"), m_oCountBy ); + XmlMacroReadAttributeBase( oNode, (L"w:distance"), m_oDistance ); + XmlMacroReadAttributeBase( oNode, (L"w:restart"), m_oRestart ); + XmlMacroReadAttributeBase( oNode, (L"w:start"), m_oStart ); + } + void CLineNumber::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CLineNumber::ToString() const + { + std::wstring sResult; + + if ( m_oCountBy.IsInit() ) + { + sResult += (L"w:countBy=\""); + sResult += m_oCountBy->ToString(); + sResult += (L"\" "); + } + + if ( m_oDistance.IsInit() ) + { + sResult += (L"w:distance=\""); + sResult += std::to_wstring(m_oDistance->ToTwips()); + sResult += (L"\" "); + } + + if ( m_oRestart.IsInit() ) + { + sResult += (L"w:restart=\""); + sResult += m_oRestart->ToString(); + sResult += (L"\" "); + } + + if ( m_oStart.IsInit() ) + { + sResult += (L"w:start=\""); + sResult += m_oStart->ToString(); + sResult += (L"\" "); + } + + return sResult; + } + void CLineNumber::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"w:countBy"), m_oCountBy ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:distance"), m_oDistance ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:restart"), m_oRestart ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:start"), m_oStart ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // PaperSource 17.6.9 (Part 1) + //-------------------------------------------------------------------------------- + + CPaperSource::CPaperSource() + { + } + CPaperSource::~CPaperSource() + { + } + void CPaperSource::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, (L"w:first"), m_oFirst ); + XmlMacroReadAttributeBase( oNode, (L"w:other"), m_oOther ); + } + void CPaperSource::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CPaperSource::ToString() const + { + std::wstring sResult; + + if ( m_oFirst.IsInit() ) + { + sResult += (L"w:first=\""); + sResult += m_oFirst->ToString(); + sResult += (L"\" "); + } + + if ( m_oOther.IsInit() ) + { + sResult += (L"w:other=\""); + sResult += m_oOther->ToString(); + sResult += (L"\" "); + } + + return sResult; + } + void CPaperSource::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"w:first"), m_oFirst ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:other"), m_oOther ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // PageBorder 17.6.7 (Part 1) + //-------------------------------------------------------------------------------- + + CPageBorder::CPageBorder() + { + } + CPageBorder::~CPageBorder() + { + } + void CPageBorder::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, (L"w:color"), m_oColor ); + XmlMacroReadAttributeBase( oNode, (L"w:frame"), m_oFrame ); + XmlMacroReadAttributeBase( oNode, (L"r:id"), m_oId ); + XmlMacroReadAttributeBase( oNode, (L"w:shadow"), m_oShadow ); + XmlMacroReadAttributeBase( oNode, (L"w:space"), m_oSpace ); + XmlMacroReadAttributeBase( oNode, (L"w:sz"), m_oSz ); + XmlMacroReadAttributeBase( oNode, (L"w:themeColor"), m_oThemeColor ); + XmlMacroReadAttributeBase( oNode, (L"w:themeShade"), m_oThemeShade ); + XmlMacroReadAttributeBase( oNode, (L"w:themeTint"), m_oThemeTint ); + XmlMacroReadAttributeBase( oNode, (L"w:val"), m_oVal ); + + if (false == m_oId.IsInit()) + { + XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); + } + } + void CPageBorder::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CPageBorder::ToString() const + { + std::wstring sResult; + + if ( m_oColor.IsInit() ) + { + sResult += (L"w:color=\""); + sResult += m_oColor->ToStringNoAlpha(); + sResult += (L"\" "); + } + + if ( m_oFrame.IsInit() ) + { + sResult += (L"w:frame=\""); + sResult += m_oFrame->ToString2(SimpleTypes::onofftostring1); + sResult += (L"\" "); + } + if ( m_oId.IsInit() ) + { + sResult += (L"r:id=\""); + sResult += m_oId->ToString(); + sResult += (L"\" "); + } + + if ( m_oShadow.IsInit() ) + { + sResult += (L"w:shadow=\""); + sResult += m_oShadow->ToString2(SimpleTypes::onofftostring1); + sResult += (L"\" "); + } + + if ( m_oSpace.IsInit() ) + { + sResult += (L"w:space=\""); + sResult += m_oSpace->ToString(); + sResult += (L"\" "); + } + + if ( m_oSz.IsInit() ) + { + sResult += (L"w:sz=\""); + sResult += m_oSz->ToString(); + sResult += (L"\" "); + } + if ( m_oThemeColor.IsInit() ) + { + sResult += (L"w:themeColor=\""); + sResult += m_oThemeColor->ToString(); + sResult += (L"\" "); + } + + if ( m_oThemeShade.IsInit() ) + { + sResult += (L"w:themeShade=\""); + sResult += m_oThemeShade->ToString(); + sResult += (L"\" "); + } + + if ( m_oThemeTint.IsInit() ) + { + sResult += (L"w:themeTint=\""); + sResult += m_oThemeTint->ToString(); + sResult += (L"\" "); + } + + if ( m_oVal.IsInit() ) + { + sResult += (L"w:val=\""); + sResult += m_oVal->ToString(); + sResult += (L"\" "); + } + + return sResult; + } + void CPageBorder::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"w:color"), m_oColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:frame"), m_oFrame ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:id"), m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"relationships:id"), m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:shadow"), m_oShadow ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:space"), m_oSpace ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:sz"), m_oSz ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeColor"), m_oThemeColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeShade"), m_oThemeShade ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeTint"), m_oThemeTint ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:val"), m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // BottomPageBorder 17.6.2 (Part 1) + //-------------------------------------------------------------------------------- + + CBottomPageBorder::CBottomPageBorder() + { + } + CBottomPageBorder::~CBottomPageBorder() + { + } + void CBottomPageBorder::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"r:bottomLeft", m_oBottomLeft ); + XmlMacroReadAttributeBase( oNode, L"r:bottomRight", m_oBottomRight ); + XmlMacroReadAttributeBase( oNode, L"w:color", m_oColor ); + XmlMacroReadAttributeBase( oNode, L"w:frame", m_oFrame ); + XmlMacroReadAttributeBase( oNode, L"r:id", m_oId ); + XmlMacroReadAttributeBase( oNode, L"w:shadow", m_oShadow ); + XmlMacroReadAttributeBase( oNode, L"w:space", m_oSpace ); + XmlMacroReadAttributeBase( oNode, L"w:sz", m_oSz ); + XmlMacroReadAttributeBase( oNode, L"w:themeColor", m_oThemeColor ); + XmlMacroReadAttributeBase( oNode, L"w:themeShade", m_oThemeShade ); + XmlMacroReadAttributeBase( oNode, L"w:themeTint", m_oThemeTint ); + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + + if (false == m_oId.IsInit()) + { + XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); + } + } + void CBottomPageBorder::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CBottomPageBorder::ToString() const + { + std::wstring sResult; + + if ( m_oBottomLeft.IsInit() ) + { + sResult += (L"r:bottomLeft=\""); + sResult += m_oBottomLeft->ToString(); + sResult += (L"\" "); + } + + if ( m_oBottomRight.IsInit() ) + { + sResult += (L"r:bottomRight=\""); + sResult += m_oBottomRight->ToString(); + sResult += (L"\" "); + } + + if ( m_oColor.IsInit() ) + { + sResult += (L"w:color=\""); + sResult += m_oColor->ToStringNoAlpha(); + sResult += (L"\" "); + } + + if ( m_oFrame.IsInit() ) + { + sResult += (L"w:frame=\""); + sResult += m_oFrame->ToString2(SimpleTypes::onofftostring1); + sResult += (L"\" "); + } + if ( m_oId.IsInit() ) + { + sResult += (L"r:id=\""); + sResult += m_oId->ToString(); + sResult += (L"\" "); + } + + if ( m_oShadow.IsInit() ) + { + sResult += (L"w:shadow=\""); + sResult += m_oShadow->ToString2(SimpleTypes::onofftostring1); + sResult += (L"\" "); + } + + if ( m_oSpace.IsInit() ) + { + sResult += (L"w:space=\""); + sResult += m_oSpace->ToString(); + sResult += (L"\" "); + } + + if ( m_oSz.IsInit() ) + { + sResult += (L"w:sz=\""); + sResult += m_oSz->ToString(); + sResult += (L"\" "); + } + if ( m_oThemeColor.IsInit() ) + { + sResult += (L"w:themeColor=\""); + sResult += m_oThemeColor->ToString(); + sResult += (L"\" "); + } + + if ( m_oThemeShade.IsInit() ) + { + sResult += (L"w:themeShade=\""); + sResult += m_oThemeShade->ToString(); + sResult += (L"\" "); + } + + if ( m_oThemeTint.IsInit() ) + { + sResult += (L"w:themeTint=\""); + sResult += m_oThemeTint->ToString(); + sResult += (L"\" "); + } + + if ( m_oVal.IsInit() ) + { + sResult += (L"w:val=\""); + sResult += m_oVal->ToString(); + sResult += (L"\" "); + } + + return sResult; + } + void CBottomPageBorder::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"r:bottomLeft"), m_oBottomLeft ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:bottomRight"), m_oBottomRight ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:color"), m_oColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:frame"), m_oFrame ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:id"), m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"relationships:id"), m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:shadow"), m_oShadow ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:space"), m_oSpace ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:sz"), m_oSz ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeColor"), m_oThemeColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeShade"), m_oThemeShade ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeTint"), m_oThemeTint ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:val"), m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // TopPageBorder 17.6.7 (Part 1) + //-------------------------------------------------------------------------------- + + CTopPageBorder::CTopPageBorder() + { + } + CTopPageBorder::~CTopPageBorder() + { + } + void CTopPageBorder::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, (L"w:color"), m_oColor ); + XmlMacroReadAttributeBase( oNode, (L"w:frame"), m_oFrame ); + XmlMacroReadAttributeBase( oNode, (L"r:id"), m_oId ); + XmlMacroReadAttributeBase( oNode, (L"w:shadow"), m_oShadow ); + XmlMacroReadAttributeBase( oNode, (L"w:space"), m_oSpace ); + XmlMacroReadAttributeBase( oNode, (L"w:sz"), m_oSz ); + XmlMacroReadAttributeBase( oNode, (L"w:themeColor"), m_oThemeColor ); + XmlMacroReadAttributeBase( oNode, (L"w:themeShade"), m_oThemeShade ); + XmlMacroReadAttributeBase( oNode, (L"w:themeTint"), m_oThemeTint ); + XmlMacroReadAttributeBase( oNode, (L"r:topLeft"), m_oTopLeft ); + XmlMacroReadAttributeBase( oNode, (L"r:topRight"), m_oTopRight ); + XmlMacroReadAttributeBase( oNode, (L"w:val"), m_oVal ); + + if (false == m_oId.IsInit()) + { + XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); + } + } + void CTopPageBorder::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CTopPageBorder::ToString() const + { + std::wstring sResult; + + if ( m_oColor.IsInit() ) + { + sResult += (L"w:color=\""); + sResult += m_oColor->ToStringNoAlpha(); + sResult += (L"\" "); + } + + if ( m_oFrame.IsInit() ) + { + sResult += (L"w:frame=\""); + sResult += m_oFrame->ToString2(SimpleTypes::onofftostring1); + sResult += (L"\" "); + } + if ( m_oId.IsInit() ) + { + sResult += (L"r:id=\""); + sResult += m_oId->ToString(); + sResult += (L"\" "); + } + + if ( m_oShadow.IsInit() ) + { + sResult += (L"w:shadow=\""); + sResult += m_oShadow->ToString2(SimpleTypes::onofftostring1); + sResult += (L"\" "); + } + + if ( m_oSpace.IsInit() ) + { + sResult += (L"w:space=\""); + sResult += m_oSpace->ToString(); + sResult += (L"\" "); + } + + if ( m_oSz.IsInit() ) + { + sResult += (L"w:sz=\""); + sResult += m_oSz->ToString(); + sResult += (L"\" "); + } + if ( m_oThemeColor.IsInit() ) + { + sResult += (L"w:themeColor=\""); + sResult += m_oThemeColor->ToString(); + sResult += (L"\" "); + } + + if ( m_oThemeShade.IsInit() ) + { + sResult += (L"w:themeShade=\""); + sResult += m_oThemeShade->ToString(); + sResult += (L"\" "); + } + + if ( m_oThemeTint.IsInit() ) + { + sResult += (L"w:themeTint=\""); + sResult += m_oThemeTint->ToString(); + sResult += (L"\" "); + } + + if ( m_oTopLeft.IsInit() ) + { + sResult += (L"r:topLeft=\""); + sResult += m_oTopLeft->ToString(); + sResult += (L"\" "); + } + + if ( m_oTopRight.IsInit() ) + { + sResult += (L"r:topRight=\""); + sResult += m_oTopRight->ToString(); + sResult += (L"\" "); + } + + if ( m_oVal.IsInit() ) + { + sResult += (L"w:val=\""); + sResult += m_oVal->ToString(); + sResult += (L"\" "); + } + + return sResult; + } + void CTopPageBorder::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"w:color"), m_oColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:frame"), m_oFrame ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:id"), m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"relationships:id"), m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:shadow"), m_oShadow ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:space"), m_oSpace ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:sz"), m_oSz ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeColor"), m_oThemeColor ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeShade"), m_oThemeShade ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeTint"), m_oThemeTint ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:topLeft"), m_oTopLeft ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:topRight"), m_oTopRight ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:val"), m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // PageMar 17.6.11 (Part 1) + //-------------------------------------------------------------------------------- + + CPageMar::CPageMar() + { + } + CPageMar::~CPageMar() + { + } + void CPageMar::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, (L"w:bottom"), m_oBottom ); + XmlMacroReadAttributeBase( oNode, (L"w:footer"), m_oFooter ); + XmlMacroReadAttributeBase( oNode, (L"w:gutter"), m_oGutter ); + XmlMacroReadAttributeBase( oNode, (L"w:header"), m_oHeader ); + XmlMacroReadAttributeBase( oNode, (L"w:left"), m_oLeft ); + XmlMacroReadAttributeBase( oNode, (L"w:right"), m_oRight ); + XmlMacroReadAttributeBase( oNode, (L"w:top"), m_oTop ); + } + void CPageMar::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CPageMar::ToString() const + { + 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=\"" + 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=\"" + m_oFooter->ToString() + L"\""; + } + if ( m_oGutter.IsInit() ) + { + sResult += L" w:gutter=\"" + m_oGutter->ToString() + L"\""; + } + return sResult; + } + void CPageMar::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"w:bottom"), m_oBottom ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:footer"), m_oFooter ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:gutter"), m_oGutter ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:header"), m_oHeader ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:left"), m_oLeft ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:right"), m_oRight ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:top"), m_oTop ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // PageNumber 17.6.12 (Part 1) + //-------------------------------------------------------------------------------- + + CPageNumber::CPageNumber() + { + } + CPageNumber::~CPageNumber() + { + } + void CPageNumber::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, (L"w:chapSep"), m_oChapSep ); + XmlMacroReadAttributeBase( oNode, (L"w:chapStyle"), m_oChapStyle ); + XmlMacroReadAttributeBase( oNode, (L"w:fmt"), m_oFmt ); + XmlMacroReadAttributeBase( oNode, (L"w:start"), m_oStart ); + } + void CPageNumber::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CPageNumber::ToString() const + { + std::wstring sResult; + + if ( m_oChapSep.IsInit() ) + { + sResult += (L"w:chapSep=\""); + sResult += m_oChapSep->ToString(); + sResult += (L"\" "); + } + + if ( m_oChapStyle.IsInit() ) + { + sResult += (L"w:chapStyle=\""); + sResult += m_oChapStyle->ToString(); + sResult += (L"\" "); + } + if ( m_oFmt.IsInit() ) + { + sResult += (L"w:fmt=\""); + sResult += m_oFmt->ToString(); + sResult += (L"\" "); + } + if ( m_oStart.IsInit() ) + { + sResult += (L"w:start=\""); + sResult += m_oStart->ToString(); + sResult += (L"\" "); + } + + return sResult; + } + void CPageNumber::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"w:chapSep"), m_oChapSep ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:chapStyle"), m_oChapStyle ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:fmt"), m_oFmt ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:start"), m_oStart ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // PageSz 17.6.13 (Part 1) + //-------------------------------------------------------------------------------- + + CPageSz::CPageSz() + { + } + CPageSz::~CPageSz() + { + } + void CPageSz::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, (L"w:code"), m_oCode ); + XmlMacroReadAttributeBase( oNode, (L"w:h"), m_oH ); + XmlMacroReadAttributeBase( oNode, (L"w:orient"), m_oOrient ); + XmlMacroReadAttributeBase( oNode, (L"w:w"), m_oW ); + } + void CPageSz::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CPageSz::ToString() const + { + std::wstring sResult; + + if ( m_oCode.IsInit() ) + { + sResult += (L"w:code=\""); + sResult += m_oCode->ToString(); + sResult += (L"\" "); + } + + if ( m_oH.IsInit() ) + { + sResult += (L"w:h=\""); + sResult += m_oH->ToString(); + sResult += (L"\" "); + } + if ( m_oOrient.IsInit() ) + { + sResult += (L"w:orient=\""); + sResult += m_oOrient->ToString(); + sResult += (L"\" "); + } + if ( m_oW.IsInit() ) + { + sResult += (L"w:w=\""); + sResult += m_oW->ToString(); + sResult += (L"\" "); + } + + return sResult; + } + void CPageSz::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, (L"w:code"), m_oCode ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:h"), m_oH ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:orient"), m_oOrient ) + WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:w"), m_oW ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // SectType 17.6.22 (Part 1) + //-------------------------------------------------------------------------------- + + CSectType::CSectType() + { + } + CSectType::~CSectType() + { + } + void CSectType::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, (L"w:val"), m_oVal ); + } + void CSectType::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CSectType::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + void CSectType::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, (L"w:val"), m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + + } // Word +} // ComplexTypes + + namespace OOX { namespace Logic diff --git a/OOXML/DocxFormat/Logic/SectionProperty.h b/OOXML/DocxFormat/Logic/SectionProperty.h index ae8f9ae18e..97f9ff2cc9 100644 --- a/OOXML/DocxFormat/Logic/SectionProperty.h +++ b/OOXML/DocxFormat/Logic/SectionProperty.h @@ -49,54 +49,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CColumn) - CColumn() - { - } - virtual ~CColumn() - { - } + CColumn(); + virtual ~CColumn(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:space", m_oSpace ); - XmlMacroReadAttributeBase( oNode, L"w:w", m_oW ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oW.IsInit() ) - { - sResult += L"w:w=\"" + std::to_wstring(m_oW->ToTwips()) + L"\" "; - } - - if ( m_oSpace.IsInit() ) - { - sResult += L"w:space=\"" + std::to_wstring(m_oSpace->ToTwips()) + L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"w:space"), m_oSpace ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:w"), m_oW ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oSpace; nullable m_oW; }; @@ -108,54 +72,17 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CDocGrid) - CDocGrid() - { - } - virtual ~CDocGrid() - { - } + CDocGrid(); + virtual ~CDocGrid(); - 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) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if (m_oType.IsInit()) - { - sResult += L" w:type=\"" + m_oType->ToString() + L"\""; - } - if ( m_oLinePitch.IsInit() ) - { - sResult += L" w:linePitch=\"" + m_oLinePitch->ToString() + L"\""; - } - if (m_oCharSpace.IsInit()) - { - 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 ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable m_oCharSpace; nullable m_oLinePitch; @@ -169,56 +96,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CHdrFtrRef) - CHdrFtrRef() - { - } - virtual ~CHdrFtrRef() - { - } + CHdrFtrRef(); + virtual ~CHdrFtrRef(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - {//todooo переделать на перебор всех и без неймспейсов - XmlMacroReadAttributeBase( oNode, L"r:id", m_oId ); - XmlMacroReadAttributeBase( oNode, L"w:type", m_oType ); - - if (false == m_oId.IsInit()) - { - XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); - } - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oType.IsInit() ) - { - sResult += L" w:type=\"" + m_oType->ToString() + L"\""; - } - if ( m_oId.IsInit() ) - { - sResult += L" r:id=\"" + m_oId->ToString() + L"\""; - } - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start_No_NS( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"id"), m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"type"), m_oType ) - WritingElement_ReadAttributes_End_No_NS( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oId; nullable m_oType; }; @@ -230,76 +119,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CLineNumber) - CLineNumber() - { - } - virtual ~CLineNumber() - { - } + CLineNumber(); + virtual ~CLineNumber(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, (L"w:countBy"), m_oCountBy ); - XmlMacroReadAttributeBase( oNode, (L"w:distance"), m_oDistance ); - XmlMacroReadAttributeBase( oNode, (L"w:restart"), m_oRestart ); - XmlMacroReadAttributeBase( oNode, (L"w:start"), m_oStart ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oCountBy.IsInit() ) - { - sResult += (L"w:countBy=\""); - sResult += m_oCountBy->ToString(); - sResult += (L"\" "); - } - - if ( m_oDistance.IsInit() ) - { - sResult += (L"w:distance=\""); - sResult += std::to_wstring(m_oDistance->ToTwips()); - sResult += (L"\" "); - } - - if ( m_oRestart.IsInit() ) - { - sResult += (L"w:restart=\""); - sResult += m_oRestart->ToString(); - sResult += (L"\" "); - } - - if ( m_oStart.IsInit() ) - { - sResult += (L"w:start=\""); - sResult += m_oStart->ToString(); - sResult += (L"\" "); - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"w:countBy"), m_oCountBy ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:distance"), m_oDistance ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:restart"), m_oRestart ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:start"), m_oStart ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oCountBy; nullable m_oDistance; nullable m_oRestart; @@ -313,58 +144,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CPaperSource) - CPaperSource() - { - } - virtual ~CPaperSource() - { - } + CPaperSource(); + virtual ~CPaperSource(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, (L"w:first"), m_oFirst ); - XmlMacroReadAttributeBase( oNode, (L"w:other"), m_oOther ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oFirst.IsInit() ) - { - sResult += (L"w:first=\""); - sResult += m_oFirst->ToString(); - sResult += (L"\" "); - } - - if ( m_oOther.IsInit() ) - { - sResult += (L"w:other=\""); - sResult += m_oOther->ToString(); - sResult += (L"\" "); - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"w:first"), m_oFirst ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:other"), m_oOther ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oFirst; nullable m_oOther; }; @@ -376,133 +167,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CPageBorder) - CPageBorder() - { - } - virtual ~CPageBorder() - { - } + CPageBorder(); + virtual ~CPageBorder(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, (L"w:color"), m_oColor ); - XmlMacroReadAttributeBase( oNode, (L"w:frame"), m_oFrame ); - XmlMacroReadAttributeBase( oNode, (L"r:id"), m_oId ); - XmlMacroReadAttributeBase( oNode, (L"w:shadow"), m_oShadow ); - XmlMacroReadAttributeBase( oNode, (L"w:space"), m_oSpace ); - XmlMacroReadAttributeBase( oNode, (L"w:sz"), m_oSz ); - XmlMacroReadAttributeBase( oNode, (L"w:themeColor"), m_oThemeColor ); - XmlMacroReadAttributeBase( oNode, (L"w:themeShade"), m_oThemeShade ); - XmlMacroReadAttributeBase( oNode, (L"w:themeTint"), m_oThemeTint ); - XmlMacroReadAttributeBase( oNode, (L"w:val"), m_oVal ); - - if (false == m_oId.IsInit()) - { - XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); - } - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oColor.IsInit() ) - { - sResult += (L"w:color=\""); - sResult += m_oColor->ToStringNoAlpha(); - sResult += (L"\" "); - } - - if ( m_oFrame.IsInit() ) - { - sResult += (L"w:frame=\""); - sResult += m_oFrame->ToString2(SimpleTypes::onofftostring1); - sResult += (L"\" "); - } - if ( m_oId.IsInit() ) - { - sResult += (L"r:id=\""); - sResult += m_oId->ToString(); - sResult += (L"\" "); - } - - if ( m_oShadow.IsInit() ) - { - sResult += (L"w:shadow=\""); - sResult += m_oShadow->ToString2(SimpleTypes::onofftostring1); - sResult += (L"\" "); - } - - if ( m_oSpace.IsInit() ) - { - sResult += (L"w:space=\""); - sResult += m_oSpace->ToString(); - sResult += (L"\" "); - } - - if ( m_oSz.IsInit() ) - { - sResult += (L"w:sz=\""); - sResult += m_oSz->ToString(); - sResult += (L"\" "); - } - if ( m_oThemeColor.IsInit() ) - { - sResult += (L"w:themeColor=\""); - sResult += m_oThemeColor->ToString(); - sResult += (L"\" "); - } - - if ( m_oThemeShade.IsInit() ) - { - sResult += (L"w:themeShade=\""); - sResult += m_oThemeShade->ToString(); - sResult += (L"\" "); - } - - if ( m_oThemeTint.IsInit() ) - { - sResult += (L"w:themeTint=\""); - sResult += m_oThemeTint->ToString(); - sResult += (L"\" "); - } - - if ( m_oVal.IsInit() ) - { - sResult += (L"w:val=\""); - sResult += m_oVal->ToString(); - sResult += (L"\" "); - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"w:color"), m_oColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:frame"), m_oFrame ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:id"), m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"relationships:id"), m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:shadow"), m_oShadow ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:space"), m_oSpace ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:sz"), m_oSz ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeColor"), m_oThemeColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeShade"), m_oThemeShade ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeTint"), m_oThemeTint ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:val"), m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oColor; nullable m_oFrame; nullable m_oId; @@ -522,151 +198,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CBottomPageBorder) - CBottomPageBorder() - { - } - virtual ~CBottomPageBorder() - { - } + CBottomPageBorder(); + virtual ~CBottomPageBorder(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"r:bottomLeft", m_oBottomLeft ); - XmlMacroReadAttributeBase( oNode, L"r:bottomRight", m_oBottomRight ); - XmlMacroReadAttributeBase( oNode, L"w:color", m_oColor ); - XmlMacroReadAttributeBase( oNode, L"w:frame", m_oFrame ); - XmlMacroReadAttributeBase( oNode, L"r:id", m_oId ); - XmlMacroReadAttributeBase( oNode, L"w:shadow", m_oShadow ); - XmlMacroReadAttributeBase( oNode, L"w:space", m_oSpace ); - XmlMacroReadAttributeBase( oNode, L"w:sz", m_oSz ); - XmlMacroReadAttributeBase( oNode, L"w:themeColor", m_oThemeColor ); - XmlMacroReadAttributeBase( oNode, L"w:themeShade", m_oThemeShade ); - XmlMacroReadAttributeBase( oNode, L"w:themeTint", m_oThemeTint ); - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - - if (false == m_oId.IsInit()) - { - XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); - } - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oBottomLeft.IsInit() ) - { - sResult += (L"r:bottomLeft=\""); - sResult += m_oBottomLeft->ToString(); - sResult += (L"\" "); - } - - if ( m_oBottomRight.IsInit() ) - { - sResult += (L"r:bottomRight=\""); - sResult += m_oBottomRight->ToString(); - sResult += (L"\" "); - } - - if ( m_oColor.IsInit() ) - { - sResult += (L"w:color=\""); - sResult += m_oColor->ToStringNoAlpha(); - sResult += (L"\" "); - } - - if ( m_oFrame.IsInit() ) - { - sResult += (L"w:frame=\""); - sResult += m_oFrame->ToString2(SimpleTypes::onofftostring1); - sResult += (L"\" "); - } - if ( m_oId.IsInit() ) - { - sResult += (L"r:id=\""); - sResult += m_oId->ToString(); - sResult += (L"\" "); - } - - if ( m_oShadow.IsInit() ) - { - sResult += (L"w:shadow=\""); - sResult += m_oShadow->ToString2(SimpleTypes::onofftostring1); - sResult += (L"\" "); - } - - if ( m_oSpace.IsInit() ) - { - sResult += (L"w:space=\""); - sResult += m_oSpace->ToString(); - sResult += (L"\" "); - } - - if ( m_oSz.IsInit() ) - { - sResult += (L"w:sz=\""); - sResult += m_oSz->ToString(); - sResult += (L"\" "); - } - if ( m_oThemeColor.IsInit() ) - { - sResult += (L"w:themeColor=\""); - sResult += m_oThemeColor->ToString(); - sResult += (L"\" "); - } - - if ( m_oThemeShade.IsInit() ) - { - sResult += (L"w:themeShade=\""); - sResult += m_oThemeShade->ToString(); - sResult += (L"\" "); - } - - if ( m_oThemeTint.IsInit() ) - { - sResult += (L"w:themeTint=\""); - sResult += m_oThemeTint->ToString(); - sResult += (L"\" "); - } - - if ( m_oVal.IsInit() ) - { - sResult += (L"w:val=\""); - sResult += m_oVal->ToString(); - sResult += (L"\" "); - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"r:bottomLeft"), m_oBottomLeft ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:bottomRight"), m_oBottomRight ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:color"), m_oColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:frame"), m_oFrame ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:id"), m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"relationships:id"), m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:shadow"), m_oShadow ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:space"), m_oSpace ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:sz"), m_oSz ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeColor"), m_oThemeColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeShade"), m_oThemeShade ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeTint"), m_oThemeTint ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:val"), m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oBottomLeft; nullable m_oBottomRight; }; @@ -678,151 +221,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CTopPageBorder) - CTopPageBorder() - { - } - virtual ~CTopPageBorder() - { - } + CTopPageBorder(); + virtual ~CTopPageBorder(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, (L"w:color"), m_oColor ); - XmlMacroReadAttributeBase( oNode, (L"w:frame"), m_oFrame ); - XmlMacroReadAttributeBase( oNode, (L"r:id"), m_oId ); - XmlMacroReadAttributeBase( oNode, (L"w:shadow"), m_oShadow ); - XmlMacroReadAttributeBase( oNode, (L"w:space"), m_oSpace ); - XmlMacroReadAttributeBase( oNode, (L"w:sz"), m_oSz ); - XmlMacroReadAttributeBase( oNode, (L"w:themeColor"), m_oThemeColor ); - XmlMacroReadAttributeBase( oNode, (L"w:themeShade"), m_oThemeShade ); - XmlMacroReadAttributeBase( oNode, (L"w:themeTint"), m_oThemeTint ); - XmlMacroReadAttributeBase( oNode, (L"r:topLeft"), m_oTopLeft ); - XmlMacroReadAttributeBase( oNode, (L"r:topRight"), m_oTopRight ); - XmlMacroReadAttributeBase( oNode, (L"w:val"), m_oVal ); - - if (false == m_oId.IsInit()) - { - XmlMacroReadAttributeBase( oNode, L"relationships:id", m_oId ); - } - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oColor.IsInit() ) - { - sResult += (L"w:color=\""); - sResult += m_oColor->ToStringNoAlpha(); - sResult += (L"\" "); - } - - if ( m_oFrame.IsInit() ) - { - sResult += (L"w:frame=\""); - sResult += m_oFrame->ToString2(SimpleTypes::onofftostring1); - sResult += (L"\" "); - } - if ( m_oId.IsInit() ) - { - sResult += (L"r:id=\""); - sResult += m_oId->ToString(); - sResult += (L"\" "); - } - - if ( m_oShadow.IsInit() ) - { - sResult += (L"w:shadow=\""); - sResult += m_oShadow->ToString2(SimpleTypes::onofftostring1); - sResult += (L"\" "); - } - - if ( m_oSpace.IsInit() ) - { - sResult += (L"w:space=\""); - sResult += m_oSpace->ToString(); - sResult += (L"\" "); - } - - if ( m_oSz.IsInit() ) - { - sResult += (L"w:sz=\""); - sResult += m_oSz->ToString(); - sResult += (L"\" "); - } - if ( m_oThemeColor.IsInit() ) - { - sResult += (L"w:themeColor=\""); - sResult += m_oThemeColor->ToString(); - sResult += (L"\" "); - } - - if ( m_oThemeShade.IsInit() ) - { - sResult += (L"w:themeShade=\""); - sResult += m_oThemeShade->ToString(); - sResult += (L"\" "); - } - - if ( m_oThemeTint.IsInit() ) - { - sResult += (L"w:themeTint=\""); - sResult += m_oThemeTint->ToString(); - sResult += (L"\" "); - } - - if ( m_oTopLeft.IsInit() ) - { - sResult += (L"r:topLeft=\""); - sResult += m_oTopLeft->ToString(); - sResult += (L"\" "); - } - - if ( m_oTopRight.IsInit() ) - { - sResult += (L"r:topRight=\""); - sResult += m_oTopRight->ToString(); - sResult += (L"\" "); - } - - if ( m_oVal.IsInit() ) - { - sResult += (L"w:val=\""); - sResult += m_oVal->ToString(); - sResult += (L"\" "); - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"w:color"), m_oColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:frame"), m_oFrame ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:id"), m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"relationships:id"), m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:shadow"), m_oShadow ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:space"), m_oSpace ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:sz"), m_oSz ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeColor"), m_oThemeColor ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeShade"), m_oThemeShade ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:themeTint"), m_oThemeTint ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:topLeft"), m_oTopLeft ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"r:topRight"), m_oTopRight ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:val"), m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oTopLeft; nullable m_oTopRight; }; @@ -834,77 +244,17 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CPageMar) - CPageMar() - { - } - virtual ~CPageMar() - { - } + CPageMar(); + virtual ~CPageMar(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, (L"w:bottom"), m_oBottom ); - XmlMacroReadAttributeBase( oNode, (L"w:footer"), m_oFooter ); - XmlMacroReadAttributeBase( oNode, (L"w:gutter"), m_oGutter ); - XmlMacroReadAttributeBase( oNode, (L"w:header"), m_oHeader ); - XmlMacroReadAttributeBase( oNode, (L"w:left"), m_oLeft ); - XmlMacroReadAttributeBase( oNode, (L"w:right"), m_oRight ); - XmlMacroReadAttributeBase( oNode, (L"w:top"), m_oTop ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - 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=\"" + 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=\"" + m_oFooter->ToString() + L"\""; - } - if ( m_oGutter.IsInit() ) - { - sResult += L" w:gutter=\"" + m_oGutter->ToString() + L"\""; - } - return sResult; - } private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"w:bottom"), m_oBottom ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:footer"), m_oFooter ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:gutter"), m_oGutter ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:header"), m_oHeader ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:left"), m_oLeft ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:right"), m_oRight ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:top"), m_oTop ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable m_oBottom; nullable m_oFooter; @@ -922,74 +272,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CPageNumber) - CPageNumber() - { - } - virtual ~CPageNumber() - { - } + CPageNumber(); + virtual ~CPageNumber(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, (L"w:chapSep"), m_oChapSep ); - XmlMacroReadAttributeBase( oNode, (L"w:chapStyle"), m_oChapStyle ); - XmlMacroReadAttributeBase( oNode, (L"w:fmt"), m_oFmt ); - XmlMacroReadAttributeBase( oNode, (L"w:start"), m_oStart ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oChapSep.IsInit() ) - { - sResult += (L"w:chapSep=\""); - sResult += m_oChapSep->ToString(); - sResult += (L"\" "); - } - - if ( m_oChapStyle.IsInit() ) - { - sResult += (L"w:chapStyle=\""); - sResult += m_oChapStyle->ToString(); - sResult += (L"\" "); - } - if ( m_oFmt.IsInit() ) - { - sResult += (L"w:fmt=\""); - sResult += m_oFmt->ToString(); - sResult += (L"\" "); - } - if ( m_oStart.IsInit() ) - { - sResult += (L"w:start=\""); - sResult += m_oStart->ToString(); - sResult += (L"\" "); - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"w:chapSep"), m_oChapSep ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:chapStyle"), m_oChapStyle ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:fmt"), m_oFmt ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:start"), m_oStart ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oChapSep; nullable m_oChapStyle; nullable m_oFmt; @@ -1003,74 +297,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CPageSz) - CPageSz() - { - } - virtual ~CPageSz() - { - } + CPageSz(); + virtual ~CPageSz(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, (L"w:code"), m_oCode ); - XmlMacroReadAttributeBase( oNode, (L"w:h"), m_oH ); - XmlMacroReadAttributeBase( oNode, (L"w:orient"), m_oOrient ); - XmlMacroReadAttributeBase( oNode, (L"w:w"), m_oW ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oCode.IsInit() ) - { - sResult += (L"w:code=\""); - sResult += m_oCode->ToString(); - sResult += (L"\" "); - } - - if ( m_oH.IsInit() ) - { - sResult += (L"w:h=\""); - sResult += m_oH->ToString(); - sResult += (L"\" "); - } - if ( m_oOrient.IsInit() ) - { - sResult += (L"w:orient=\""); - sResult += m_oOrient->ToString(); - sResult += (L"\" "); - } - if ( m_oW.IsInit() ) - { - sResult += (L"w:w=\""); - sResult += m_oW->ToString(); - sResult += (L"\" "); - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, (L"w:code"), m_oCode ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:h"), m_oH ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:orient"), m_oOrient ) - WritingElement_ReadAttributes_Read_else_if( oReader, (L"w:w"), m_oW ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oCode; nullable m_oH; nullable m_oOrient; @@ -1084,49 +322,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CSectType) - CSectType() - { - } - virtual ~CSectType() - { - } + CSectType(); + virtual ~CSectType(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, (L"w:val"), m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, (L"w:val"), m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oVal; }; diff --git a/OOXML/DocxFormat/Logic/Table.cpp b/OOXML/DocxFormat/Logic/Table.cpp index dba726c876..29d6fbe0b1 100644 --- a/OOXML/DocxFormat/Logic/Table.cpp +++ b/OOXML/DocxFormat/Logic/Table.cpp @@ -36,6 +36,55 @@ #include "../Math/oMathPara.h" #include "../Math/OMath.h" +namespace ComplexTypes +{ + namespace Word + { + //-------------------------------------------------------------------------------- + // TblGridCol 17.4.16 (Part 1) + //-------------------------------------------------------------------------------- + + CTblGridCol::CTblGridCol() + { + } + CTblGridCol::~CTblGridCol() + { + } + void CTblGridCol::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:w", m_oW ); + } + void CTblGridCol::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CTblGridCol::ToString() const + { + std::wstring sResult; + + if ( m_oW.IsInit() ) + { + sResult += L"w:w=\""; + sResult += m_oW->ToString(); + sResult += L"\" "; + } + + return sResult; + } + void CTblGridCol::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:w", m_oW ) + WritingElement_ReadAttributes_End( oReader ) + } + + } // Word +} // ComplexTypes + namespace OOX { namespace Logic @@ -129,13 +178,17 @@ namespace OOX return sResult; } - + EElementType CTblGridChange::getType() const + { + return et_w_tblGridChange; + } void CTblGridChange::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:id"), m_oId ) WritingElement_ReadAttributes_End( oReader ) } + //-------------------------------------------------------------------------------- // CTblPrExChange //-------------------------------------------------------------------------------- @@ -240,7 +293,10 @@ namespace OOX return sResult; } - + EElementType CTblPrExChange::getType() const + { + return et_w_tblPrExChange; + } void CTblPrExChange::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) @@ -250,6 +306,7 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if( oReader, _T("oouserid"), m_sUserId ) WritingElement_ReadAttributes_End( oReader ) } + //-------------------------------------------------------------------------------- // CTbl 17.4.38 (Part 1) //-------------------------------------------------------------------------------- @@ -259,6 +316,46 @@ namespace OOX // // + CTbl::CTbl(OOX::Document *pMain) : WritingElementWithChilds<>(pMain) + { + m_oTableProperties = NULL; + m_nCountRow = 0; + } + CTbl::CTbl(XmlUtils::CXmlNode &oNode) : WritingElementWithChilds<>(NULL) + { + m_oTableProperties = NULL; + m_nCountRow = 0; + fromXML( oNode ); + } + CTbl::CTbl(XmlUtils::CXmlLiteReader& oReader) : WritingElementWithChilds<>(NULL) + { + m_oTableProperties = NULL; + m_nCountRow = 0; + fromXML( oReader ); + } + CTbl::~CTbl() + { + } + const CTbl& CTbl::operator =(const XmlUtils::CXmlNode& oNode) + { + ClearItems(); + fromXML( (XmlUtils::CXmlNode&)oNode ); + return *this; + } + const CTbl& CTbl::operator =(const XmlUtils::CXmlLiteReader& oReader) + { + ClearItems(); + fromXML( (XmlUtils::CXmlLiteReader&)oReader ); + return *this; + } + void CTbl::ClearItems() + { + m_oTblGrid.reset(); + m_oTableProperties = NULL; + m_nCountRow = 0; + + WritingElementWithChilds::ClearItems(); + } void CTbl::fromXML(XmlUtils::CXmlNode& oNode) { XmlUtils::CXmlNodes oChilds; @@ -343,8 +440,6 @@ namespace OOX } } } - - void CTbl::fromXML(XmlUtils::CXmlLiteReader& oReader) { if ( oReader.IsEmptyNode() ) @@ -474,6 +569,10 @@ namespace OOX return sResult; } + EElementType CTbl::getType() const + { + return et_w_tbl; + } //-------------------------------------------------------------------------------- // CTr 17.4.79 (Part 1) @@ -484,6 +583,49 @@ namespace OOX // // + CTr::CTr(OOX::Document *pMain) : WritingElementWithChilds<>(pMain) + { + m_nCountCell = 0; + m_pTableRowProperties = NULL; + } + CTr::CTr(XmlUtils::CXmlNode &oNode) : WritingElementWithChilds<>(NULL) + { + m_nCountCell = 0; + m_pTableRowProperties = NULL; + fromXML( oNode ); + } + CTr::CTr(XmlUtils::CXmlLiteReader& oReader) : WritingElementWithChilds<>(NULL) + { + m_nCountCell = 0; + m_pTableRowProperties = NULL; + fromXML( oReader ); + } + CTr::~CTr() + { + } + const CTr& CTr::operator =(const XmlUtils::CXmlNode& oNode) + { + ClearItems(); + fromXML( (XmlUtils::CXmlNode&)oNode ); + return *this; + } + const CTr& CTr::operator =(const XmlUtils::CXmlLiteReader& oReader) + { + ClearItems(); + fromXML( (XmlUtils::CXmlLiteReader&)oReader ); + return *this; + } + void CTr::ClearItems() + { + m_pTableRowProperties = NULL; + m_oRsidDel.reset(); + m_oRsidR.reset(); + m_oRsidRPr.reset(); + m_oRsidTr.reset(); + + WritingElementWithChilds::ClearItems(); + + } void CTr::fromXML(XmlUtils::CXmlNode& oNode) { XmlMacroReadAttributeBase( oNode, _T("w:rsidDel"), m_oRsidDel ); @@ -591,8 +733,6 @@ namespace OOX } } } - - void CTr::fromXML(XmlUtils::CXmlLiteReader& oReader) { ReadAttributes( oReader ); @@ -721,8 +861,6 @@ namespace OOX } m_nCountCell = nNumCol; } - - std::wstring CTr::toXML() const { std::wstring sResult = _T(" // + CTc::CTc(OOX::Document *pMain) : WritingElementWithChilds<>(pMain) + { + m_nNumCol = 0; + m_pTableCellProperties = NULL; + } + CTc::CTc(XmlUtils::CXmlNode &oNode) : WritingElementWithChilds<>(NULL) + { + m_nNumCol = 0; + m_pTableCellProperties = NULL; + fromXML( oNode ); + } + CTc::CTc(XmlUtils::CXmlLiteReader& oReader) : WritingElementWithChilds<>(NULL) + { + m_nNumCol = 0; + m_pTableCellProperties = NULL; + fromXML( oReader ); + } + CTc::~CTc() + { + } + const CTc& CTc::operator =(const XmlUtils::CXmlNode& oNode) + { + ClearItems(); + + fromXML( (XmlUtils::CXmlNode&)oNode ); + return *this; + } + const CTc& CTc::operator =(const XmlUtils::CXmlLiteReader& oReader) + { + ClearItems(); + + fromXML( (XmlUtils::CXmlLiteReader&)oReader ); + return *this; + } + void CTc::ClearItems() + { + m_pTableCellProperties = NULL; + m_nNumCol = 0; + m_sId.reset(); + + WritingElementWithChilds::ClearItems(); + } void CTc::fromXML(XmlUtils::CXmlNode& oNode) { XmlMacroReadAttributeBase( oNode, _T("w:id"), m_sId ); @@ -850,8 +1035,6 @@ namespace OOX } } } - - void CTc::fromXML(XmlUtils::CXmlLiteReader& oReader) { ReadAttributes( oReader ); @@ -958,7 +1141,6 @@ namespace OOX } } } - std::wstring CTc::toXML() const { std::wstring sResult; @@ -984,11 +1166,16 @@ namespace OOX return sResult; } + EElementType CTc::getType() const + { + return et_w_tc; + } void CTc::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:id"), m_sId ) WritingElement_ReadAttributes_End( oReader ) } + } // namespace Logic } // namespace OOX diff --git a/OOXML/DocxFormat/Logic/Table.h b/OOXML/DocxFormat/Logic/Table.h index f7eaea86aa..41409d3c09 100644 --- a/OOXML/DocxFormat/Logic/Table.h +++ b/OOXML/DocxFormat/Logic/Table.h @@ -48,49 +48,18 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CTblGridCol) - CTblGridCol() - { - } - virtual ~CTblGridCol() - { - } + CTblGridCol(); + virtual ~CTblGridCol(); - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:w", m_oW ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual std::wstring ToString() const; - if ( m_oW.IsInit() ) - { - sResult += L"w:w=\""; - sResult += m_oW->ToString(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:w", m_oW ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oW; }; @@ -119,21 +88,17 @@ namespace OOX virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return et_w_tblGridChange; - } + virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oId; CTblGrid *m_pTblGrid; }; + //-------------------------------------------------------------------------------- // CTblGrid 17.4.49 (Part 1) //-------------------------------------------------------------------------------- @@ -248,6 +213,7 @@ namespace OOX // CTblPrExChange 17.13.5.35 (Part 1) //-------------------------------------------------------------------------------- class CTblPrEx; + class CTblPrExChange : public WritingElement { public: @@ -261,17 +227,12 @@ namespace OOX virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return et_w_tblPrExChange; - } + virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - // Attributes nullable m_sAuthor; nullable m_oDate; @@ -281,6 +242,7 @@ namespace OOX // Childs nullable m_pTblPrEx; }; + //-------------------------------------------------------------------------------- // CTblPrEx 17.4.61 (Part 1) //-------------------------------------------------------------------------------- @@ -398,63 +360,28 @@ namespace OOX nullable m_oTblPrExChange; nullable m_oTblW; }; + //-------------------------------------------------------------------------------- // CTbl 17.4.38 (Part 1) //-------------------------------------------------------------------------------- class CTbl : public WritingElementWithChilds<> { public: - CTbl(OOX::Document *pMain = NULL) : WritingElementWithChilds<>(pMain) - { - m_oTableProperties = NULL; - m_nCountRow = 0; - } - CTbl(XmlUtils::CXmlNode &oNode) : WritingElementWithChilds<>(NULL) - { - m_oTableProperties = NULL; - m_nCountRow = 0; - fromXML( oNode ); - } - CTbl(XmlUtils::CXmlLiteReader& oReader) : WritingElementWithChilds<>(NULL) - { - m_oTableProperties = NULL; - m_nCountRow = 0; - fromXML( oReader ); - } - virtual ~CTbl() - { - } + CTbl(OOX::Document *pMain = NULL); + CTbl(XmlUtils::CXmlNode &oNode); + CTbl(XmlUtils::CXmlLiteReader& oReader); + virtual ~CTbl(); - const CTbl &operator =(const XmlUtils::CXmlNode& oNode) - { - ClearItems(); - fromXML( (XmlUtils::CXmlNode&)oNode ); - return *this; - } - - const CTbl &operator =(const XmlUtils::CXmlLiteReader& oReader) - { - ClearItems(); - fromXML( (XmlUtils::CXmlLiteReader&)oReader ); - return *this; - } - - virtual void ClearItems() - { - m_oTblGrid.reset(); - m_oTableProperties = NULL; - m_nCountRow = 0; - - WritingElementWithChilds::ClearItems(); - } + const CTbl &operator =(const XmlUtils::CXmlNode& oNode); + const CTbl &operator =(const XmlUtils::CXmlLiteReader& oReader); + virtual void ClearItems(); virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return et_w_tbl; - } + virtual EElementType getType() const; + void CreateElements(XmlUtils::CXmlLiteReader &oReader, int Depth); int m_nCountRow; @@ -469,56 +396,20 @@ namespace OOX class CTr : public WritingElementWithChilds<> { public: - CTr(OOX::Document *pMain = NULL) : WritingElementWithChilds<>(pMain) - { - m_nCountCell = 0; - m_pTableRowProperties = NULL; - } - CTr(XmlUtils::CXmlNode &oNode) : WritingElementWithChilds<>(NULL) - { - m_nCountCell = 0; - m_pTableRowProperties = NULL; - fromXML( oNode ); - } - CTr(XmlUtils::CXmlLiteReader& oReader) : WritingElementWithChilds<>(NULL) - { - m_nCountCell = 0; - m_pTableRowProperties = NULL; - fromXML( oReader ); - } - virtual ~CTr() - { - } - const CTr &operator =(const XmlUtils::CXmlNode& oNode) - { - ClearItems(); - fromXML( (XmlUtils::CXmlNode&)oNode ); - return *this; - } - const CTr &operator =(const XmlUtils::CXmlLiteReader& oReader) - { - ClearItems(); - fromXML( (XmlUtils::CXmlLiteReader&)oReader ); - return *this; - } - virtual void ClearItems() - { - m_pTableRowProperties = NULL; - m_oRsidDel.reset(); - m_oRsidR.reset(); - m_oRsidRPr.reset(); - m_oRsidTr.reset(); + CTr(OOX::Document *pMain = NULL); + CTr(XmlUtils::CXmlNode &oNode); + CTr(XmlUtils::CXmlLiteReader& oReader); + virtual ~CTr(); - WritingElementWithChilds::ClearItems(); + const CTr &operator =(const XmlUtils::CXmlNode& oNode); + const CTr &operator =(const XmlUtils::CXmlLiteReader& oReader); + + virtual void ClearItems(); - } virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return et_w_tr; - } + virtual EElementType getType() const; private: void CreateElements(XmlUtils::CXmlLiteReader &oReader, int Depth); @@ -542,56 +433,20 @@ namespace OOX class CTc : public WritingElementWithChilds<> { public: - CTc(OOX::Document *pMain = NULL) : WritingElementWithChilds<>(pMain) - { - m_nNumCol = 0; - m_pTableCellProperties = NULL; - } - CTc(XmlUtils::CXmlNode &oNode) : WritingElementWithChilds<>(NULL) - { - m_nNumCol = 0; - m_pTableCellProperties = NULL; - fromXML( oNode ); - } - CTc(XmlUtils::CXmlLiteReader& oReader) : WritingElementWithChilds<>(NULL) - { - m_nNumCol = 0; - m_pTableCellProperties = NULL; - fromXML( oReader ); - } - virtual ~CTc() - { - } - const CTc &operator =(const XmlUtils::CXmlNode& oNode) - { - ClearItems(); - - fromXML( (XmlUtils::CXmlNode&)oNode ); - return *this; - } - const CTc &operator =(const XmlUtils::CXmlLiteReader& oReader) - { - ClearItems(); - - fromXML( (XmlUtils::CXmlLiteReader&)oReader ); - return *this; - } - virtual void ClearItems() - { - m_pTableCellProperties = NULL; - m_nNumCol = 0; - m_sId.reset(); + CTc(OOX::Document *pMain = NULL); + CTc(XmlUtils::CXmlNode &oNode); + CTc(XmlUtils::CXmlLiteReader& oReader); + virtual ~CTc(); - WritingElementWithChilds::ClearItems(); - } + const CTc &operator =(const XmlUtils::CXmlNode& oNode); + const CTc &operator =(const XmlUtils::CXmlLiteReader& oReader); + + virtual void ClearItems(); virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return et_w_tc; - } + virtual EElementType getType() const; private: void CreateElements(XmlUtils::CXmlLiteReader &oReader, int Depth); diff --git a/OOXML/DocxFormat/Logic/TableProperty.cpp b/OOXML/DocxFormat/Logic/TableProperty.cpp index bac83cd104..4a4f1f7858 100644 --- a/OOXML/DocxFormat/Logic/TableProperty.cpp +++ b/OOXML/DocxFormat/Logic/TableProperty.cpp @@ -31,12 +31,926 @@ */ #include "TableProperty.h" +namespace ComplexTypes +{ + namespace Word + { + //-------------------------------------------------------------------------------- + // CellMergeTrackChange + //-------------------------------------------------------------------------------- + + CCellMergeTrackChange::CCellMergeTrackChange() + { + } + CCellMergeTrackChange::~CCellMergeTrackChange() + { + } + void CCellMergeTrackChange::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:author", m_sAuthor ); + XmlMacroReadAttributeBase( oNode, L"w:date", m_oDate ); + XmlMacroReadAttributeBase( oNode, L"w:id", m_oId ); + XmlMacroReadAttributeBase( oNode, L"w:vMerge", m_oVMerge ); + XmlMacroReadAttributeBase( oNode, L"w:vMergeOrig", m_oVMergeOrig ); + XmlMacroReadAttributeBase( oNode, L"oouserid", m_sUserId ); + } + void CCellMergeTrackChange::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CCellMergeTrackChange::ToString() const + { + std::wstring sResult; + + if ( m_sAuthor.IsInit() ) + { + sResult += L"w:author=\""; + sResult += m_sAuthor.get2(); + sResult += L"\" "; + } + + ComplexTypes_WriteAttribute( L"w:date=\"", m_oDate ); + ComplexTypes_WriteAttribute( L"w:id=\"", m_oId ); + ComplexTypes_WriteAttribute( L"w:vMerge=\"", m_oVMerge ); + ComplexTypes_WriteAttribute( L"w:vMergeOrig=\"", m_oVMergeOrig ); + + if ( m_sUserId.IsInit() ) + { + sResult += L"oouserid=\""; + sResult += m_sUserId.get2(); + sResult += L"\" "; + } + + return sResult; + } + void CCellMergeTrackChange::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:author", m_sAuthor ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:date", m_oDate ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:id", m_oId ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:vMerge", m_oVMerge ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:vMergeOrig", m_oVMergeOrig ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"oouserid", m_sUserId ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // HMerge + //-------------------------------------------------------------------------------- + + CHMerge::CHMerge() + { + } + CHMerge::~CHMerge() + { + } + void CHMerge::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CHMerge::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CHMerge::ToString() const + { + std::wstring sResult; + + ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); + + return sResult; + } + void CHMerge::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // VMerge + //-------------------------------------------------------------------------------- + + CVMerge::CVMerge() + { + } + CVMerge::~CVMerge() + { + } + void CVMerge::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CVMerge::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CVMerge::ToString() const + { + std::wstring sResult; + + ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); + + return sResult; + } + void CVMerge::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // Height + //-------------------------------------------------------------------------------- + CHeight::CHeight() + { + } + CHeight::~CHeight() + { + } + void CHeight::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:hRule", m_oHRule ); + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + XmlMacroReadAttributeBase(oNode, L"w:h-rule", m_oHRule); + } + void CHeight::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CHeight::ToString() const + { + std::wstring sResult; + + ComplexTypes_WriteAttribute( L"w:hRule=\"", m_oHRule ); + ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); + + return sResult; + } + void CHeight::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:hRule", m_oHRule ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_Read_else_if(oReader, L"w:h-rule", m_oHRule) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // JcTable + //-------------------------------------------------------------------------------- + + CJcTable::CJcTable() + { + } + CJcTable::~CJcTable() + { + } + void CJcTable::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CJcTable::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CJcTable::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + void CJcTable::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // TblLayoutType + //-------------------------------------------------------------------------------- + + CTblLayoutType::CTblLayoutType() + { + } + CTblLayoutType::~CTblLayoutType() + { + } + void CTblLayoutType::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:type", m_oType ); + } + void CTblLayoutType::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CTblLayoutType::ToString() const + { + std::wstring sResult; + + if ( m_oType.IsInit() ) + { + sResult += L"w:type=\""; + sResult += m_oType->ToString(); + sResult += L"\" "; + } + + return sResult; + } + void CTblLayoutType::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:type", m_oType ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // TblLook + //-------------------------------------------------------------------------------- + + CTblLook::CTblLook() + { + } + CTblLook::~CTblLook() + { + } + void CTblLook::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:firstColumn", m_oFirstColumn ); + XmlMacroReadAttributeBase( oNode, L"w:firstRow", m_oFirstRow ); + XmlMacroReadAttributeBase( oNode, L"w:lastColumn", m_oLastColumn ); + XmlMacroReadAttributeBase( oNode, L"w:lastRow", m_oLastRow ); + XmlMacroReadAttributeBase( oNode, L"w:noHBand", m_oNoHBand ); + XmlMacroReadAttributeBase( oNode, L"w:noVBand", m_oNoVBand ); + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CTblLook::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CTblLook::ToString() const + { + std::wstring sResult; + + if ( m_oFirstColumn.IsInit() ) + { + sResult += L"w:firstColumn=\""; + sResult += m_oFirstColumn->ToString(); + sResult += L"\" "; + } + + if ( m_oFirstRow.IsInit() ) + { + sResult += L"w:firstRow=\""; + sResult += m_oFirstRow->ToString(); + sResult += L"\" "; + } + + if ( m_oLastColumn.IsInit() ) + { + sResult += L"w:lastColumn=\""; + sResult += m_oLastColumn->ToString(); + sResult += L"\" "; + } + + if ( m_oLastRow.IsInit() ) + { + sResult += L"w:lastRow=\""; + sResult += m_oLastRow->ToString(); + sResult += L"\" "; + } + + if ( m_oNoHBand.IsInit() ) + { + sResult += L"w:noHBand=\""; + sResult += m_oNoHBand->ToString(); + sResult += L"\" "; + } + + if ( m_oNoVBand.IsInit() ) + { + sResult += L"w:noVBand=\""; + sResult += m_oNoVBand->ToString(); + sResult += L"\" "; + } + + ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); + + return sResult; + } + const bool CTblLook::IsFirstRow() const + { + if ( m_oFirstRow.IsInit() ) + return ( SimpleTypes::onoffTrue == m_oFirstRow->GetValue() ); + + if ( m_oVal.IsInit() ) + return ( 0 != ( m_oVal->GetValue() & 0x0020 ) ); + + return false; + } + const bool CTblLook::IsLastRow() const + { + if ( m_oLastRow.IsInit() ) + return ( SimpleTypes::onoffTrue == m_oLastRow->GetValue() ); + + if ( m_oVal.IsInit() ) + return ( 0 != ( m_oVal->GetValue() & 0x0040 ) ); + + return false; + } + const bool CTblLook::IsFirstColumn() const + { + if ( m_oFirstColumn.IsInit() ) + return ( SimpleTypes::onoffTrue == m_oFirstColumn->GetValue() ); + + if ( m_oVal.IsInit() ) + return ( 0 != ( m_oVal->GetValue() & 0x0080 ) ); + + return false; + } + const bool CTblLook::IsLastColumn () const + { + if ( m_oLastColumn.IsInit() ) + return ( SimpleTypes::onoffTrue == m_oLastColumn->GetValue() ); + + if ( m_oVal.IsInit() ) + return ( 0 != ( m_oVal->GetValue() & 0x0100 ) ); + + return false; + } + const bool CTblLook::IsNoHBand () const + { + if ( m_oNoHBand.IsInit() ) + return ( SimpleTypes::onoffTrue == m_oNoHBand->GetValue() ); + + if ( m_oVal.IsInit() ) + return ( 0 != ( m_oVal->GetValue() & 0x0200 ) ); + + return false; + } + const bool CTblLook::IsNoVBand () const + { + if ( m_oNoVBand.IsInit() ) + return ( SimpleTypes::onoffTrue == m_oNoVBand->GetValue() ); + + if ( m_oVal.IsInit() ) + return ( 0 != ( m_oVal->GetValue() & 0x0400 ) ); + + return false; + } + const int CTblLook::GetValue() const + { + int nRes = 0; + if(m_oVal.IsInit()) + nRes = m_oVal->GetValue(); + else + { + if ( m_oNoVBand.IsInit() && SimpleTypes::onoffTrue == m_oNoVBand->GetValue()) + nRes |= 0x0400; + if ( m_oNoHBand.IsInit() && SimpleTypes::onoffTrue == m_oNoHBand->GetValue()) + nRes |= 0x0200; + if ( m_oLastColumn.IsInit() && SimpleTypes::onoffTrue == m_oLastColumn->GetValue()) + nRes |= 0x0100; + if ( m_oFirstColumn.IsInit() && SimpleTypes::onoffTrue == m_oFirstColumn->GetValue()) + nRes |= 0x0080; + if ( m_oLastRow.IsInit() && SimpleTypes::onoffTrue == m_oLastRow->GetValue()) + nRes |= 0x0040; + if ( m_oFirstRow.IsInit() && SimpleTypes::onoffTrue == m_oFirstRow->GetValue()) + nRes |= 0x0020; + } + return nRes; + } + void CTblLook::SetValue(int nVal) + { + m_oVal.Init(); + m_oVal->SetValue(nVal); + if ( 0 != (nVal & 0x0400)) + { + m_oNoVBand.Init(); + m_oNoVBand->FromBool(true); + } + if ( 0 != (nVal & 0x0200)) + { + m_oNoHBand.Init(); + m_oNoHBand->FromBool(true); + } + if ( 0 != (nVal & 0x0100)) + { + m_oLastColumn.Init(); + m_oLastColumn->FromBool(true); + } + if ( 0 != (nVal & 0x0080)) + { + m_oFirstColumn.Init(); + m_oFirstColumn->FromBool(true); + } + if ( 0 != (nVal & 0x0040)) + { + m_oLastRow.Init(); + m_oLastRow->FromBool(true); + } + if ( 0 != (nVal & 0x0020)) + { + m_oFirstRow.Init(); + m_oFirstRow->FromBool(true); + } + } + void CTblLook::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:firstColumn", m_oFirstColumn ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstRow", m_oFirstRow ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastColumn", m_oLastColumn ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastRow", m_oLastRow ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:noHBand", m_oNoHBand ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:noVBand", m_oNoVBand ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // TblOverlap + //-------------------------------------------------------------------------------- + + CTblOverlap::CTblOverlap() + { + } + CTblOverlap::~CTblOverlap() + { + } + void CTblOverlap::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); + } + void CTblOverlap::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) + WritingElement_ReadAttributes_End( oReader ) + } + std::wstring CTblOverlap::ToString() const + { + std::wstring sResult; + + if ( m_oVal.IsInit() ) + { + sResult += L"w:val=\""; + sResult += m_oVal->ToString(); + sResult += L"\" "; + } + + return sResult; + } + + //-------------------------------------------------------------------------------- + // TblPPr + //-------------------------------------------------------------------------------- + CTblPPr::CTblPPr() + { + } + CTblPPr::~CTblPPr() + { + } + void CTblPPr::PrepareAfterRead() + { + if(false == m_oHorzAnchor.IsInit()) + { + m_oHorzAnchor.Init(); + m_oHorzAnchor->SetValue(SimpleTypes::hanchorText); + } + if(false == m_oVertAnchor.IsInit()) + { + m_oVertAnchor.Init(); + m_oVertAnchor->SetValue(SimpleTypes::vanchorMargin); + } + if(false == m_oTblpXSpec.IsInit()) + { + if(false == m_oTblpX.IsInit()) + { + m_oTblpX.Init(); + m_oTblpX->FromTwips(0); + } + //Several values of sprmTDxaAbs have special meanings as specified by + //[ECMA-376] Part 4, Section 2.18.114. These values are specified as + //follows. + switch(m_oTblpX->ToTwips()) + { + case 0: + m_oTblpX.reset(NULL); + m_oTblpXSpec.Init(); + m_oTblpXSpec->SetValue(SimpleTypes::xalignLeft); + break; + case -4: + m_oTblpX.reset(NULL); + m_oTblpXSpec.Init(); + m_oTblpXSpec->SetValue(SimpleTypes::xalignCenter); + break; + case -8: + m_oTblpX.reset(NULL); + m_oTblpXSpec.Init(); + m_oTblpXSpec->SetValue(SimpleTypes::xalignRight); + break; + case -12: + m_oTblpX.reset(NULL); + m_oTblpXSpec.Init(); + m_oTblpXSpec->SetValue(SimpleTypes::xalignInside); + break; + case -16: + m_oTblpX.reset(NULL); + m_oTblpXSpec.Init(); + m_oTblpXSpec->SetValue(SimpleTypes::xalignOutside); + break; + } + } + if(false == m_oTblpYSpec.IsInit()) + { + if(false == m_oTblpY.IsInit()) + { + m_oTblpY.Init(); + m_oTblpY->FromTwips(0); + } + //The meanings that are provided correspond to + //values that are defined in [ECMA-376] Part 4, Section 2.18.115 ST_YAlign + //(Vertical Alignment Location). + switch(m_oTblpY->ToTwips()) + { + case 0: + m_oVertAnchor.Init(); + m_oVertAnchor->SetValue(SimpleTypes::vanchorText); + break; + case -4: + m_oTblpY.reset(NULL); + m_oTblpYSpec.Init(); + m_oTblpYSpec->SetValue(SimpleTypes::yalignTop); + break; + case -8: + m_oTblpY.reset(NULL); + m_oTblpYSpec.Init(); + m_oTblpYSpec->SetValue(SimpleTypes::yalignCenter); + break; + case -12: + m_oTblpY.reset(NULL); + m_oTblpYSpec.Init(); + m_oTblpYSpec->SetValue(SimpleTypes::yalignBottom); + break; + case -16: + m_oTblpY.reset(NULL); + m_oTblpYSpec.Init(); + m_oTblpYSpec->SetValue(SimpleTypes::yalignInside); + break; + case -20: + m_oTblpY.reset(NULL); + m_oTblpYSpec.Init(); + m_oTblpYSpec->SetValue(SimpleTypes::yalignOutside); + break; + } + } + } + void CTblPPr::FromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase( oNode, L"w:bottomFromText", m_oBottomFromText ); + XmlMacroReadAttributeBase( oNode, L"w:horzAnchor", m_oHorzAnchor ); + XmlMacroReadAttributeBase( oNode, L"w:leftFromText", m_oLeftFromText ); + XmlMacroReadAttributeBase( oNode, L"w:rightFromText", m_oRightFromText ); + XmlMacroReadAttributeBase( oNode, L"w:tblpX", m_oTblpX ); + XmlMacroReadAttributeBase( oNode, L"w:tblpXSpec", m_oTblpXSpec ); + XmlMacroReadAttributeBase( oNode, L"w:tblpY", m_oTblpY ); + XmlMacroReadAttributeBase( oNode, L"w:tblpYSpec", m_oTblpYSpec ); + XmlMacroReadAttributeBase( oNode, L"w:topFromText", m_oTopFromText ); + XmlMacroReadAttributeBase( oNode, L"w:vertAnchor", m_oVertAnchor ); + PrepareAfterRead(); + } + void CTblPPr::FromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes(oReader); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + PrepareAfterRead(); + } + std::wstring CTblPPr::ToString() const + { + std::wstring sResult; + + ComplexTypes_WriteAttribute( L"w:bottomFromText=\"", m_oBottomFromText ); + ComplexTypes_WriteAttribute( L"w:horzAnchor=\"", m_oHorzAnchor ); + ComplexTypes_WriteAttribute( L"w:leftFromText=\"", m_oLeftFromText ); + ComplexTypes_WriteAttribute( L"w:rightFromText=\"", m_oRightFromText ); + ComplexTypes_WriteAttribute( L"w:tblpX=\"", m_oTblpX ); + ComplexTypes_WriteAttribute( L"w:tblpXSpec=\"", m_oTblpXSpec ); + ComplexTypes_WriteAttribute( L"w:tblpY=\"", m_oTblpY ); + ComplexTypes_WriteAttribute( L"w:tblpYSpec=\"", m_oTblpYSpec ); + ComplexTypes_WriteAttribute( L"w:topFromText=\"", m_oTopFromText ); + ComplexTypes_WriteAttribute( L"w:vertAnchor=\"", m_oVertAnchor ); + + return sResult; + } + void CTblPPr::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, L"w:bottomFromText", m_oBottomFromText ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:horzAnchor", m_oHorzAnchor ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:leftFromText", m_oLeftFromText ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:rightFromText", m_oRightFromText ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:tblpX", m_oTblpX ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:tblpXSpec", m_oTblpXSpec ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:tblpY", m_oTblpY ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:tblpYSpec", m_oTblpYSpec ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:topFromText", m_oTopFromText ) + WritingElement_ReadAttributes_Read_else_if( oReader, L"w:vertAnchor", m_oVertAnchor ) + WritingElement_ReadAttributes_End( oReader ) + } + + } // Word +} // ComplexTypes + namespace OOX { namespace Logic { //-------------------------------------------------------------------------------- - // TblPrChange + // TblBorders + //-------------------------------------------------------------------------------- + CTblBorders::CTblBorders() + { + } + CTblBorders::~CTblBorders() + { + } + void CTblBorders::fromXML(XmlUtils::CXmlNode& oNode) + { + if ( L"w:tblBorders" != oNode.GetName() ) + return; + + XmlUtils::CXmlNode oChild; + + if ( oNode.GetNode( L"w:bottom", oChild ) ) + m_oBottom = oChild; + + if ( oNode.GetNode( L"w:end", oChild ) ) + m_oEnd = oChild; + + if ( oNode.GetNode( L"w:insideH", oChild ) ) + m_oInsideH = oChild; + + if ( oNode.GetNode( L"w:insideV", oChild ) ) + m_oInsideV = oChild; + + if ( oNode.GetNode( L"w:start", oChild ) ) + m_oStart = oChild; + + if ( oNode.GetNode( L"w:top", oChild ) ) + m_oTop = oChild; + + if ( !m_oEnd.IsInit() && oNode.GetNode( L"w:right", oChild ) ) + m_oEnd = oChild; + + if ( !m_oStart.IsInit() && oNode.GetNode( L"w:left", oChild ) ) + m_oStart = oChild; + } + void CTblBorders::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + + int nParentDepth = oReader.GetDepth(); + while( oReader.ReadNextSiblingNode( nParentDepth ) ) + { + std::wstring sName = oReader.GetName(); + if ( L"w:bottom" == sName ) + m_oBottom = oReader; + else if ( L"w:end" == sName ) + m_oEnd = oReader; + else if ( L"w:insideH" == sName ) + m_oInsideH = oReader; + else if ( L"w:insideV" == sName ) + m_oInsideV = oReader; + else if ( L"w:start" == sName ) + m_oStart = oReader; + else if ( L"w:top" == sName ) + m_oTop = oReader; + else if ( L"w:right" == sName ) + m_oEnd = oReader; + else if ( L"w:left" == sName ) + m_oStart = oReader; + } + } + std::wstring CTblBorders::toXML() const + { + std::wstring sResult = L""; + + if ( m_oBottom.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + if ( m_oEnd.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + if ( m_oInsideH.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + if ( m_oInsideV.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + if ( m_oStart.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + if ( m_oTop.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + sResult += L""; + + return sResult; + } + EElementType CTblBorders::getType() const + { + return et_w_tblBorders; + } + const CTblBorders CTblBorders::Merge(const CTblBorders& oPrev, const CTblBorders& oCurrent) + { + CTblBorders oProperties; + oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom ); + oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd ); + oProperties.m_oInsideH = Merge( oPrev.m_oInsideH, oCurrent.m_oInsideH ); + oProperties.m_oInsideV = Merge( oPrev.m_oInsideV, oCurrent.m_oInsideV ); + oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart ); + oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop ); + + return oProperties; + } + + //-------------------------------------------------------------------------------- + // TblCellMar + //-------------------------------------------------------------------------------- + CTblCellMar::CTblCellMar() + { + } + CTblCellMar::~CTblCellMar() + { + } + void CTblCellMar::fromXML(XmlUtils::CXmlNode& oNode) + { + if ( L"w:tblCellMar" != oNode.GetName() ) + return; + + XmlUtils::CXmlNode oChild; + + if ( oNode.GetNode( L"w:bottom", oChild ) ) + m_oBottom = oChild; + + if ( oNode.GetNode( L"w:end", oChild ) ) + m_oEnd = oChild; + + if ( oNode.GetNode( L"w:start", oChild ) ) + m_oStart = oChild; + + if ( oNode.GetNode( L"w:top", oChild ) ) + m_oTop = oChild; + + if ( !m_oEnd.IsInit() && oNode.GetNode( L"w:right", oChild ) ) + m_oEnd = oChild; + + if ( !m_oStart.IsInit() && oNode.GetNode( L"w:left", oChild ) ) + m_oStart = oChild; + } + void CTblCellMar::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + + int nParentDepth = oReader.GetDepth(); + while( oReader.ReadNextSiblingNode( nParentDepth ) ) + { + std::wstring sName = oReader.GetName(); + if ( L"w:bottom" == sName ) + m_oBottom = oReader; + else if ( L"w:end" == sName ) + m_oEnd = oReader; + else if ( L"w:start" == sName ) + m_oStart = oReader; + else if ( L"w:top" == sName ) + m_oTop = oReader; + else if ( L"w:right" == sName ) + m_oEnd = oReader; + else if ( L"w:left" == sName ) + m_oStart = oReader; + } + } + std::wstring CTblCellMar::toXML() const + { + std::wstring sResult = L""; + + if ( m_oBottom.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + if ( m_oEnd.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + if ( m_oStart.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + if ( m_oTop.IsInit() ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + sResult += L""; + + return sResult; + } + EElementType CTblCellMar::getType() const + { + return et_w_tblCellMar; + } + const CTblCellMar CTblCellMar::Merge(const CTblCellMar& oPrev, const CTblCellMar& oCurrent) + { + CTblCellMar oProperties; + oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom ); + oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd ); + oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart ); + oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop ); + + return oProperties; + } + + //-------------------------------------------------------------------------------- + // TblPrChange + //-------------------------------------------------------------------------------- CTblPrChange::CTblPrChange(OOX::Document *pMain) : WritingElement(pMain) { @@ -157,7 +1071,172 @@ namespace OOX } //-------------------------------------------------------------------------------- - // TrPrChange + // TableProperty + //-------------------------------------------------------------------------------- + + CTableProperty::CTableProperty(OOX::Document *pMain) + { + m_bTblPrChange = false; + } + CTableProperty::CTableProperty(XmlUtils::CXmlNode &oNode) : WritingElement(NULL) + { + m_bTblPrChange = false; + + fromXML( oNode ); + } + CTableProperty::CTableProperty(XmlUtils::CXmlLiteReader& oReader) : WritingElement(NULL) + { + m_bTblPrChange = false; + + fromXML( oReader ); + } + CTableProperty::~CTableProperty() + { + } + const CTableProperty& CTableProperty::operator=(const XmlUtils::CXmlNode &oNode) + { + fromXML( (XmlUtils::CXmlNode &)oNode ); + return *this; + } + const CTableProperty& CTableProperty::operator=(const XmlUtils::CXmlLiteReader& oReader) + { + fromXML( (XmlUtils::CXmlLiteReader&)oReader ); + return *this; + } + void CTableProperty::fromXML(XmlUtils::CXmlNode& oNode) + { + if ( L"w:tblPr" != oNode.GetName() ) + return; + + XmlUtils::CXmlNode oChild; + + WritingElement_ReadNode( oNode, oChild, L"w:bidiVisual", m_oBidiVisual ); + WritingElement_ReadNode( oNode, oChild, L"w:jc", m_oJc ); + WritingElement_ReadNode( oNode, oChild, L"w:shd", m_oShade ); + WritingElement_ReadNode( oNode, oChild, L"w:tblBorders", m_oTblBorders ); + WritingElement_ReadNode( oNode, oChild, L"w:tblCaption", m_oTblCaption ); + WritingElement_ReadNode( oNode, oChild, L"w:tblCellMar", m_oTblCellMar ); + WritingElement_ReadNode( oNode, oChild, L"w:tblCellSpacing", m_oTblCellSpacing ); + WritingElement_ReadNode( oNode, oChild, L"w:tblDescription", m_oTblDescription ); + WritingElement_ReadNode( oNode, oChild, L"w:tblInd", m_oTblInd ); + WritingElement_ReadNode( oNode, oChild, L"w:tblLayout", m_oTblLayout ); + WritingElement_ReadNode( oNode, oChild, L"w:tblLook", m_oTblLook ); + WritingElement_ReadNode( oNode, oChild, L"w:tblOverlap", m_oTblOverlap ); + WritingElement_ReadNode( oNode, oChild, L"w:tblpPr", m_oTblpPr ); + + if ( !m_bTblPrChange ) + WritingElement_ReadNode( oNode, oChild, L"w:tblPrChange", m_oTblPrChange ); + + WritingElement_ReadNode( oNode, oChild, L"w:tblStyle", m_oTblStyle ); + WritingElement_ReadNode( oNode, oChild, L"w:tblStyleColBandSize", m_oTblStyleColBandSize ); + WritingElement_ReadNode( oNode, oChild, L"w:tblStyleRowBandSize", m_oTblStyleRowBandSize ); + WritingElement_ReadNode( oNode, oChild, L"w:tblW", m_oTblW ); + } + void CTableProperty::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + + int nParentDepth = oReader.GetDepth(); + while( oReader.ReadNextSiblingNode( nParentDepth ) ) + { + std::wstring sName = oReader.GetName(); + + if ( L"w:bidiVisual" == sName ) m_oBidiVisual = oReader; + else if ( L"w:jc" == sName ) m_oJc = oReader; + else if ( L"w:shd" == sName ) m_oShade = oReader; + else if ( L"w:tblBorders" == sName ) m_oTblBorders = oReader; + else if ( L"w:tblCaption" == sName ) m_oTblCaption = oReader; + else if ( L"w:tblCellMar" == sName ) m_oTblCellMar = oReader; + else if ( L"w:tblCellSpacing" == sName ) m_oTblCellSpacing = oReader; + else if ( L"w:tblDescription" == sName ) m_oTblDescription = oReader; + else if ( L"w:tblInd" == sName ) m_oTblInd = oReader; + else if ( L"w:tblLayout" == sName ) m_oTblLayout = oReader; + else if ( L"w:tblLook" == sName ) m_oTblLook = oReader; + else if ( L"w:tblOverlap" == sName ) m_oTblOverlap = oReader; + else if ( L"w:tblpPr" == sName ) m_oTblpPr = oReader; + else if ( !m_bTblPrChange && L"w:tblPrChange" == sName ) m_oTblPrChange = oReader; + else if ( L"w:tblStyle" == sName ) m_oTblStyle = oReader; + else if ( L"w:tblStyleColBandSize" == sName ) m_oTblStyleColBandSize = oReader; + else if ( L"w:tblStyleRowBandSize" == sName ) m_oTblStyleRowBandSize = oReader; + else if ( L"w:tblW" == sName ) m_oTblW = oReader; + else if ( L"w:tblPr" == sName) + {//387.docx + fromXML(oReader); + } + } + } + std::wstring CTableProperty::toXML() const + { + std::wstring sResult = L""; + + WritingElement_WriteNode_1( L""; + + return sResult; + } + EElementType CTableProperty::getType() const + { + return et_w_tblPr; + } + const CTableProperty CTableProperty::Merge(const CTableProperty& oPrev, const CTableProperty& oCurrent) + { + CTableProperty oProperties; + oProperties.m_bTblPrChange = oPrev.m_bTblPrChange || oCurrent.m_bTblPrChange; + oProperties.m_oBidiVisual = Merge( oPrev.m_oBidiVisual, oCurrent.m_oBidiVisual ); + oProperties.m_oJc = Merge( oPrev.m_oJc, oCurrent.m_oJc ); + oProperties.m_oShade = Merge( oPrev.m_oShade, oCurrent.m_oShade ); + + if ( oCurrent.m_oTblBorders.IsInit() && oPrev.m_oTblBorders.IsInit() ) + oProperties.m_oTblBorders = OOX::Logic::CTblBorders::Merge(oPrev.m_oTblBorders.get(), oCurrent.m_oTblBorders.get()); + else + oProperties.m_oTblBorders = Merge( oPrev.m_oTblBorders, oCurrent.m_oTblBorders ); + + oProperties.m_oTblCaption = Merge( oPrev.m_oTblCaption, oCurrent.m_oTblCaption ); + + if ( oCurrent.m_oTblCellMar.IsInit() && oPrev.m_oTblCellMar.IsInit() ) + oProperties.m_oTblCellMar = OOX::Logic::CTblCellMar::Merge(oPrev.m_oTblCellMar.get(), oCurrent.m_oTblCellMar.get()); + else + oProperties.m_oTblCellMar = Merge( oPrev.m_oTblCellMar, oCurrent.m_oTblCellMar ); + + oProperties.m_oTblCellSpacing = Merge( oPrev.m_oTblCellSpacing, oCurrent.m_oTblCellSpacing ); + oProperties.m_oTblDescription = Merge( oPrev.m_oTblDescription, oCurrent.m_oTblDescription ); + oProperties.m_oTblInd = Merge( oPrev.m_oTblInd, oCurrent.m_oTblInd ); + oProperties.m_oTblLayout = Merge( oPrev.m_oTblLayout, oCurrent.m_oTblLayout ); + oProperties.m_oTblLook = Merge( oPrev.m_oTblLook, oCurrent.m_oTblLook ); + oProperties.m_oTblOverlap = Merge( oPrev.m_oTblOverlap, oCurrent.m_oTblOverlap ); + oProperties.m_oTblpPr = Merge( oPrev.m_oTblpPr, oCurrent.m_oTblpPr ); + oProperties.m_oTblPrChange = Merge( oPrev.m_oTblPrChange, oCurrent.m_oTblPrChange ); + oProperties.m_oTblStyle = Merge( oPrev.m_oTblStyle, oCurrent.m_oTblStyle ); + oProperties.m_oTblStyleColBandSize = Merge( oPrev.m_oTblStyleColBandSize, oCurrent.m_oTblStyleColBandSize ); + oProperties.m_oTblStyleRowBandSize = Merge( oPrev.m_oTblStyleRowBandSize, oCurrent.m_oTblStyleRowBandSize ); + oProperties.m_oTblW = Merge( oPrev.m_oTblW, oCurrent.m_oTblW ); + return oProperties; + } + + //-------------------------------------------------------------------------------- + // TrPrChange + //-------------------------------------------------------------------------------- CTrPrChange::CTrPrChange(OOX::Document *pMain) : WritingElement(pMain) { @@ -267,7 +1346,6 @@ namespace OOX { return et_w_trPrChange; } - void CTrPrChange::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { WritingElement_ReadAttributes_Start( oReader ) @@ -277,8 +1355,387 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if( oReader, _T("oouserid"), m_sUserId ) WritingElement_ReadAttributes_End( oReader ) } + //-------------------------------------------------------------------------------- - // TcPrChange + // TableRowProperties + + //-------------------------------------------------------------------------------- + CTableRowProperties::CTableRowProperties(OOX::Document *pMain) : WritingElement(pMain) + { + m_bTrPrChange = false; + } + CTableRowProperties::CTableRowProperties(XmlUtils::CXmlNode &oNode) : WritingElement(NULL) + { + m_bTrPrChange = false; + + fromXML( (XmlUtils::CXmlNode &)oNode ); + } + CTableRowProperties::CTableRowProperties(XmlUtils::CXmlLiteReader& oReader) : WritingElement(NULL) + { + m_bTrPrChange = false; + + fromXML( (XmlUtils::CXmlLiteReader&)oReader ); + } + CTableRowProperties::~CTableRowProperties() + { + } + const CTableRowProperties& CTableRowProperties::operator =(const XmlUtils::CXmlNode &oNode) + { + fromXML( (XmlUtils::CXmlNode &)oNode ); + return *this; + } + const CTableRowProperties& CTableRowProperties::operator =(const XmlUtils::CXmlLiteReader& oReader) + { + fromXML( (XmlUtils::CXmlLiteReader&)oReader ); + return *this; + } + void CTableRowProperties::fromXML(XmlUtils::CXmlNode& oNode) + { + if ( L"w:trPr" != oNode.GetName() ) + return; + + XmlUtils::CXmlNode oChild; + + WritingElement_ReadNode( oNode, oChild, L"w:cantSplit", m_oCantSplit ); + WritingElement_ReadNode( oNode, oChild, L"w:cnfStyle", m_oCnfStyle ); + WritingElement_ReadNode( oNode, oChild, L"w:del", m_oDel ); + WritingElement_ReadNode( oNode, oChild, L"w:divId", m_oDivId ); + WritingElement_ReadNode( oNode, oChild, L"w:gridAfter", m_oGridAfter ); + WritingElement_ReadNode( oNode, oChild, L"w:gridBefore", m_oGridBefore ); + WritingElement_ReadNode( oNode, oChild, L"w:hidden", m_oHidden ); + WritingElement_ReadNode( oNode, oChild, L"w:ins", m_oIns ); + WritingElement_ReadNode( oNode, oChild, L"w:jc", m_oJc ); + WritingElement_ReadNode( oNode, oChild, L"w:tblCellSpacing", m_oTblCellSpacing ); + WritingElement_ReadNode( oNode, oChild, L"w:tblHeader", m_oTblHeader ); + WritingElement_ReadNode( oNode, oChild, L"w:trHeight", m_oTblHeight ); + + if ( !m_bTrPrChange ) + WritingElement_ReadNode( oNode, oChild, L"w:trPrChange", m_oTrPrChange ); + + WritingElement_ReadNode( oNode, oChild, L"w:wAfter", m_oWAfter ); + WritingElement_ReadNode( oNode, oChild, L"w:wBefore", m_oWBefore ); + } + void CTableRowProperties::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + + int nParentDepth = oReader.GetDepth(); + while( oReader.ReadNextSiblingNode( nParentDepth ) ) + { + std::wstring sName = oReader.GetName(); + + if ( L"w:cantSplit" == sName ) m_oCantSplit = oReader; + else if ( L"w:cnfStyle" == sName ) m_oCnfStyle = oReader; + else if ( L"w:del" == sName ) m_oDel = oReader; + else if ( L"w:divId" == sName ) m_oDivId = oReader; + else if ( L"w:gridAfter" == sName ) m_oGridAfter = oReader; + else if ( L"w:gridBefore" == sName ) m_oGridBefore = oReader; + else if ( L"w:hidden" == sName ) m_oHidden = oReader; + else if ( L"w:ins" == sName ) m_oIns = oReader; + else if ( L"w:jc" == sName ) m_oJc = oReader; + else if ( L"w:tblCellSpacing" == sName ) m_oTblCellSpacing = oReader; + else if ( L"w:tblHeader" == sName ) m_oTblHeader = oReader; + else if ( L"w:trHeight" == sName ) m_oTblHeight = oReader; + else if ( !m_bTrPrChange && L"w:trPrChange" == sName ) m_oTrPrChange = oReader; + else if ( L"w:wAfter" == sName ) m_oWAfter = oReader; + else if ( L"w:wBefore" == sName ) m_oWBefore = oReader; + } + } + std::wstring CTableRowProperties::toXML() const + { + std::wstring sResult = L""; + + WritingElement_WriteNode_1( L""; + + return sResult; + } + EElementType CTableRowProperties::getType() const + { + return et_w_trPr; + } + const CTableRowProperties CTableRowProperties::Merge(const CTableRowProperties& oPrev, const CTableRowProperties& oCurrent) + { + CTableRowProperties oProperties; + + oProperties.m_bTrPrChange = oPrev.m_bTrPrChange || oCurrent.m_bTrPrChange; + oProperties.m_oCantSplit = Merge( oPrev.m_oCantSplit, oCurrent.m_oCantSplit ); + oProperties.m_oCnfStyle = Merge( oPrev.m_oCnfStyle, oCurrent.m_oCnfStyle ); + oProperties.m_oDel = Merge( oPrev.m_oDel, oCurrent.m_oDel ); + oProperties.m_oDivId = Merge( oPrev.m_oDivId, oCurrent.m_oDivId ); + oProperties.m_oGridAfter = Merge( oPrev.m_oGridAfter, oCurrent.m_oGridAfter ); + oProperties.m_oGridBefore = Merge( oPrev.m_oGridBefore, oCurrent.m_oGridBefore ); + oProperties.m_oHidden = Merge( oPrev.m_oHidden, oCurrent.m_oHidden ); + oProperties.m_oIns = Merge( oPrev.m_oIns, oCurrent.m_oIns ); + oProperties.m_oJc = Merge( oPrev.m_oJc, oCurrent.m_oJc ); + oProperties.m_oTblCellSpacing = Merge( oPrev.m_oTblCellSpacing, oCurrent.m_oTblCellSpacing ); + oProperties.m_oTblHeader = Merge( oPrev.m_oTblHeader, oCurrent.m_oTblHeader ); + oProperties.m_oTblHeight = Merge( oPrev.m_oTblHeight, oCurrent.m_oTblHeight ); + oProperties.m_oTrPrChange = Merge( oPrev.m_oTrPrChange, oCurrent.m_oTrPrChange ); + oProperties.m_oWAfter = Merge( oPrev.m_oWAfter, oCurrent.m_oWAfter ); + oProperties.m_oWBefore = Merge( oPrev.m_oWBefore, oCurrent.m_oWBefore ); + + return oProperties; + } + + //-------------------------------------------------------------------------------- + // Headers + //-------------------------------------------------------------------------------- + + CHeaders::CHeaders(OOX::Document *pMain) : WritingElement(pMain) + { + } + CHeaders::~CHeaders() + { + for ( unsigned int nIndex = 0; nIndex < m_arrHeaders.size(); nIndex++ ) + { + if ( m_arrHeaders[nIndex] ) delete m_arrHeaders[nIndex]; + m_arrHeaders[nIndex] = NULL; + } + m_arrHeaders.clear(); + } + void CHeaders::fromXML(XmlUtils::CXmlNode& oNode) + { + if ( L"w:headers" != oNode.GetName() ) + return; + + XmlUtils::CXmlNodes oHeaders; + + if ( oNode.GetNodes( L"w:header", oHeaders ) ) + { + XmlUtils::CXmlNode oHeader; + for ( int nIndex = 0; nIndex < oHeaders.GetCount(); nIndex++ ) + { + if ( oHeaders.GetAt( nIndex, oHeader ) ) + { + ComplexTypes::Word::String *oHead = new ComplexTypes::Word::String(oHeader); + if (oHead) m_arrHeaders.push_back( oHead ); + } + } + } + } + void CHeaders::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + + int nParentDepth = oReader.GetDepth(); + while( oReader.ReadNextSiblingNode( nParentDepth ) ) + { + std::wstring sName = oReader.GetName(); + + if ( L"w:header" == sName ) + { + ComplexTypes::Word::String *oHead = new ComplexTypes::Word::String(oReader); + if (oHead) m_arrHeaders.push_back( oHead ); + } + } + } + std::wstring CHeaders::toXML() const + { + std::wstring sResult = L""; + + for (unsigned int nIndex = 0; nIndex < m_arrHeaders.size(); nIndex++ ) + { + sResult += L"ToString(); + sResult += L"/>"; + } + + sResult += L""; + + return sResult; + } + EElementType CHeaders::getType() const + { + return et_w_headers; + } + + //-------------------------------------------------------------------------------- + // TcBorders + //-------------------------------------------------------------------------------- + + CTcBorders::CTcBorders() + { + } + CTcBorders::~CTcBorders() + { + } + void CTcBorders::fromXML(XmlUtils::CXmlNode& oNode) + { + if ( L"w:tcBorders" != oNode.GetName() ) + return; + + XmlUtils::CXmlNode oChild; + + WritingElement_ReadNode( oNode, oChild, L"w:bottom", m_oBottom ); + WritingElement_ReadNode( oNode, oChild, L"w:end", m_oEnd ); + WritingElement_ReadNode( oNode, oChild, L"w:insideH", m_oInsideH ); + WritingElement_ReadNode( oNode, oChild, L"w:insideV", m_oInsideV ); + WritingElement_ReadNode( oNode, oChild, L"w:start", m_oStart ); + WritingElement_ReadNode( oNode, oChild, L"w:tl2br", m_oTL2BR ); + WritingElement_ReadNode( oNode, oChild, L"w:top", m_oTop ); + WritingElement_ReadNode( oNode, oChild, L"w:tr2bl", m_oTR2BL ); + + if ( !m_oEnd.IsInit() ) + WritingElement_ReadNode( oNode, oChild, L"w:right", m_oEnd ); + + if ( !m_oStart.IsInit() ) + WritingElement_ReadNode( oNode, oChild, L"w:left", m_oStart ); + } + void CTcBorders::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + + int nParentDepth = oReader.GetDepth(); + while( oReader.ReadNextSiblingNode( nParentDepth ) ) + { + std::wstring sName = oReader.GetName(); + + if ( L"w:bottom" == sName ) m_oBottom = oReader; + else if ( L"w:end" == sName ) m_oEnd = oReader; + else if ( L"w:insideH" == sName ) m_oInsideH = oReader; + else if ( L"w:insideV" == sName ) m_oInsideV = oReader; + else if ( L"w:start" == sName ) m_oStart = oReader; + else if ( L"w:tl2br" == sName ) m_oTL2BR = oReader; + else if ( L"w:top" == sName ) m_oTop = oReader; + else if ( L"w:tr2bl" == sName ) m_oTR2BL = oReader; + else if ( !m_oEnd.IsInit() && L"w:right" == sName ) m_oEnd = oReader; + else if ( !m_oStart.IsInit() && L"w:left" == sName ) m_oStart = oReader; + } + } + std::wstring CTcBorders::toXML() const + { + std::wstring sResult = L""; + + WritingElement_WriteNode_1( L""; + + return sResult; + } + EElementType CTcBorders::getType() const + { + return et_w_tcBorders; + } + const CTcBorders CTcBorders::Merge(const CTcBorders& oPrev, const CTcBorders& oCurrent) + { + CTcBorders oProperties; + oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom ); + oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd ); + oProperties.m_oInsideH = Merge( oPrev.m_oInsideH, oCurrent.m_oInsideH ); + oProperties.m_oInsideV = Merge( oPrev.m_oInsideV, oCurrent.m_oInsideV ); + oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart ); + oProperties.m_oTL2BR = Merge( oPrev.m_oTL2BR, oCurrent.m_oTL2BR ); + oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop ); + oProperties.m_oTR2BL = Merge( oPrev.m_oTR2BL, oCurrent.m_oTR2BL ); + + return oProperties; + } + + //-------------------------------------------------------------------------------- + // TcMar + //-------------------------------------------------------------------------------- + + CTcMar::CTcMar() + { + } + CTcMar::~CTcMar() + { + } + void CTcMar::fromXML(XmlUtils::CXmlNode& oNode) + { + if ( L"w:tcMar" != oNode.GetName() ) + return; + + XmlUtils::CXmlNode oChild; + + WritingElement_ReadNode( oNode, oChild, L"w:bottom", m_oBottom ); + WritingElement_ReadNode( oNode, oChild, L"w:end", m_oEnd ); + WritingElement_ReadNode( oNode, oChild, L"w:start", m_oStart ); + WritingElement_ReadNode( oNode, oChild, L"w:top", m_oTop ); + + if ( !m_oEnd.IsInit() ) + WritingElement_ReadNode( oNode, oChild, L"w:right", m_oEnd ); + + if ( !m_oStart.IsInit() ) + WritingElement_ReadNode( oNode, oChild, L"w:left", m_oStart ); + } + void CTcMar::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + + int nParentDepth = oReader.GetDepth(); + while( oReader.ReadNextSiblingNode( nParentDepth ) ) + { + std::wstring sName = oReader.GetName(); + + if ( L"w:bottom" == sName ) m_oBottom = oReader; + else if ( L"w:end" == sName ) m_oEnd = oReader; + else if ( L"w:start" == sName ) m_oStart = oReader; + else if ( L"w:top" == sName ) m_oTop = oReader; + else if ( !m_oEnd.IsInit() && L"w:right" == sName ) m_oEnd = oReader; + else if ( !m_oStart.IsInit() && L"w:left" == sName ) m_oStart = oReader; + } + } + std::wstring CTcMar::toXML() const + { + std::wstring sResult = L""; + + WritingElement_WriteNode_1( L""; + + return sResult; + } + EElementType CTcMar::getType() const + { + return et_w_tcMar; + } + const CTcMar CTcMar::Merge(const CTcMar& oPrev, const CTcMar& oCurrent) + { + CTcMar oProperties; + oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom ); + oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd ); + oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart ); + oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop ); + + return oProperties; + } + + //-------------------------------------------------------------------------------- + // TcPrChange + //-------------------------------------------------------------------------------- CTcPrChange::CTcPrChange(OOX::Document *pMain) : WritingElement(pMain) { @@ -397,5 +1854,184 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if( oReader, _T("oouserid"), m_sUserId ) WritingElement_ReadAttributes_End( oReader ) } + + //-------------------------------------------------------------------------------- + // TableCellProperties + //-------------------------------------------------------------------------------- + CTableCellProperties::CTableCellProperties(OOX::Document *pMain) : WritingElement(pMain) + { + m_bTcPrChange = false; + } + CTableCellProperties::CTableCellProperties(XmlUtils::CXmlNode &oNode) : WritingElement(NULL) + { + m_bTcPrChange = false; + + fromXML( oNode ); + } + CTableCellProperties::CTableCellProperties(XmlUtils::CXmlLiteReader& oReader) : WritingElement(NULL) + { + m_bTcPrChange = false; + + fromXML( oReader ); + } + CTableCellProperties::~CTableCellProperties() + { + } + const CTableCellProperties& CTableCellProperties::operator =(const XmlUtils::CXmlNode &oNode) + { + fromXML( (XmlUtils::CXmlNode &)oNode ); + return *this; + } + const CTableCellProperties& CTableCellProperties::operator =(const XmlUtils::CXmlLiteReader& oReader) + { + fromXML( (XmlUtils::CXmlLiteReader&)oReader ); + return *this; + } + void CTableCellProperties::fromXML(XmlUtils::CXmlNode& oNode) + { + if ( L"w:tcPr" != oNode.GetName() ) + return; + + XmlUtils::CXmlNode oChild; + + WritingElement_ReadNode( oNode, oChild, L"w:cellDel", m_oCellDel ); + WritingElement_ReadNode( oNode, oChild, L"w:cellIns", m_oCellIns ); + WritingElement_ReadNode( oNode, oChild, L"w:cellMerge", m_oCellMerge ); + WritingElement_ReadNode( oNode, oChild, L"w:cnfStyle", m_oCnfStyle ); + WritingElement_ReadNode( oNode, oChild, L"w:gridSpan", m_oGridSpan ); + WritingElement_ReadNode( oNode, oChild, L"w:headers", m_oHeaders ); + WritingElement_ReadNode( oNode, oChild, L"w:hideMark", m_oHideMark ); + + // В списке аттрибутов написано "hMerge", а в примере "hmerge" + WritingElement_ReadNode( oNode, oChild, L"w:hmerge", m_oHMerge ); + if ( !m_oHMerge.IsInit() ) + WritingElement_ReadNode( oNode, oChild, L"w:hMerge", m_oHMerge ); + + WritingElement_ReadNode( oNode, oChild, L"w:noWrap", m_oNoWrap ); + WritingElement_ReadNode( oNode, oChild, L"w:shd", m_oShd ); + WritingElement_ReadNode( oNode, oChild, L"w:tcBorders", m_oTcBorders ); + WritingElement_ReadNode( oNode, oChild, L"w:tcFitText", m_oTcFitText ); + WritingElement_ReadNode( oNode, oChild, L"w:tcMar", m_oTcMar ); + + if ( !m_bTcPrChange ) + WritingElement_ReadNode( oNode, oChild, L"w:tcPrChange", m_oTcPrChange ); + + WritingElement_ReadNode( oNode, oChild, L"w:tcW", m_oTcW ); + WritingElement_ReadNode( oNode, oChild, L"w:textDirection", m_oTextDirection ); + WritingElement_ReadNode( oNode, oChild, L"w:vAlign", m_oVAlign ); + + // В списке аттрибутов написано "vMerge", а в примере "vmerge" + WritingElement_ReadNode( oNode, oChild, L"w:vmerge", m_oVMerge ); + if ( !m_oVMerge.IsInit() ) + WritingElement_ReadNode( oNode, oChild, L"w:vMerge", m_oVMerge ); + } + void CTableCellProperties::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + + int nParentDepth = oReader.GetDepth(); + while( oReader.ReadNextSiblingNode( nParentDepth ) ) + { + std::wstring sName = oReader.GetName(); + + if ( L"w:cellDel" == sName ) m_oCellDel = oReader; + else if ( L"w:cellIns" == sName ) m_oCellIns = oReader; + else if ( L"w:cellMerge" == sName ) m_oCellMerge = oReader; + else if ( L"w:cnfStyle" == sName ) m_oCnfStyle = oReader; + else if ( L"w:gridSpan" == sName ) m_oGridSpan = oReader; + else if ( L"w:headers" == sName ) m_oHeaders = oReader; + else if ( L"w:hideMark" == sName ) m_oHideMark = oReader; + else if ( L"w:noWrap" == sName ) m_oNoWrap = oReader; + else if ( L"w:shd" == sName ) m_oShd = oReader; + else if ( L"w:tcBorders" == sName ) m_oTcBorders = oReader; + else if ( L"w:tcFitText" == sName ) m_oTcFitText = oReader; + else if ( L"w:tcMar" == sName ) m_oTcMar = oReader; + else if ( !m_bTcPrChange && L"w:tcPrChange" == sName ) m_oTcPrChange = oReader; + else if ( L"w:tcW" == sName ) m_oTcW = oReader; + else if ( L"w:vAlign" == sName ) m_oVAlign = oReader; + + else if ( L"w:textDirection" == sName || L"w:textFlow" == sName) m_oTextDirection = oReader; + else if ( L"w:hMerge" == sName || L"w:hmerge" == sName) m_oHMerge = oReader; + else if ( L"w:vMerge" == sName || L"w:vmerge" == sName) m_oVMerge = oReader; + } + } + std::wstring CTableCellProperties::toXML() const + { + std::wstring sResult = L""; + + WritingElement_WriteNode_1(L""; + + return sResult; + } + EElementType CTableCellProperties::getType() const + { + return et_w_tcPr; + } + const CTableCellProperties CTableCellProperties::Merge(const CTableCellProperties& oPrev, const CTableCellProperties& oCurrent) + { + CTableCellProperties oProperties; + oProperties.m_bTcPrChange = oPrev.m_bTcPrChange || oCurrent.m_bTcPrChange; + oProperties.m_oCellDel = Merge( oPrev.m_oCellDel, oCurrent.m_oCellDel ); + oProperties.m_oCellIns = Merge( oPrev.m_oCellIns, oCurrent.m_oCellIns ); + oProperties.m_oCellMerge = Merge( oPrev.m_oCellMerge, oCurrent.m_oCellMerge ); + oProperties.m_oCnfStyle = Merge( oPrev.m_oCnfStyle, oCurrent.m_oCnfStyle ); + oProperties.m_oGridSpan = Merge( oPrev.m_oGridSpan, oCurrent.m_oGridSpan ); + oProperties.m_oHeaders = Merge( oPrev.m_oHeaders, oCurrent.m_oHeaders ); + oProperties.m_oHideMark = Merge( oPrev.m_oHideMark, oCurrent.m_oHideMark ); + oProperties.m_oHMerge = Merge( oPrev.m_oHMerge, oCurrent.m_oHMerge ); + oProperties.m_oNoWrap = Merge( oPrev.m_oNoWrap, oCurrent.m_oNoWrap ); + oProperties.m_oShd = Merge( oPrev.m_oShd, oCurrent.m_oShd ); + + if ( oCurrent.m_oTcBorders.IsInit() && oPrev.m_oTcBorders.IsInit() ) + oProperties.m_oTcBorders = OOX::Logic::CTcBorders::Merge(oPrev.m_oTcBorders.get(), oCurrent.m_oTcBorders.get()); + else + oProperties.m_oTcBorders = Merge( oPrev.m_oTcBorders, oCurrent.m_oTcBorders ); + + oProperties.m_oTcFitText = Merge( oPrev.m_oTcFitText, oCurrent.m_oTcFitText ); + + if ( oCurrent.m_oTcMar.IsInit() && oPrev.m_oTcMar.IsInit() ) + oProperties.m_oTcMar = OOX::Logic::CTcMar::Merge(oPrev.m_oTcMar.get(), oCurrent.m_oTcMar.get()); + else + oProperties.m_oTcMar = Merge( oPrev.m_oTcMar, oCurrent.m_oTcMar ); + + oProperties.m_oTcPrChange = Merge( oPrev.m_oTcPrChange, oCurrent.m_oTcPrChange ); + oProperties.m_oTcW = Merge( oPrev.m_oTcW, oCurrent.m_oTcW ); + oProperties.m_oTextDirection = Merge( oPrev.m_oTextDirection, oCurrent.m_oTextDirection ); + oProperties.m_oVAlign = Merge( oPrev.m_oVAlign, oCurrent.m_oVAlign ); + oProperties.m_oVMerge = Merge( oPrev.m_oVMerge, oCurrent.m_oVMerge ); + + return oProperties; + } + + } // namespace Logic } // namespace OOX diff --git a/OOXML/DocxFormat/Logic/TableProperty.h b/OOXML/DocxFormat/Logic/TableProperty.h index ff6ca5fe6c..70652246ad 100644 --- a/OOXML/DocxFormat/Logic/TableProperty.h +++ b/OOXML/DocxFormat/Logic/TableProperty.h @@ -49,51 +49,22 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CJcTable) - CJcTable() - { - } - virtual ~CJcTable() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CJcTable(); + virtual ~CJcTable(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } + virtual std::wstring ToString() const; - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oVal; }; + //-------------------------------------------------------------------------------- // TblLayoutType 17.4.54 (Part 1) //-------------------------------------------------------------------------------- @@ -101,51 +72,22 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CTblLayoutType) - CTblLayoutType() - { - } - virtual ~CTblLayoutType() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:type", m_oType ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CTblLayoutType(); + virtual ~CTblLayoutType(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( m_oType.IsInit() ) - { - sResult += L"w:type=\""; - sResult += m_oType->ToString(); - sResult += L"\" "; - } + virtual std::wstring ToString() const; - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:type", m_oType ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oType; }; + //-------------------------------------------------------------------------------- // TblLook 17.4.56 (Part 1) + 9.3.11 (Part 4) //-------------------------------------------------------------------------------- @@ -153,215 +95,29 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CTblLook) - CTblLook() - { - } - virtual ~CTblLook() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:firstColumn", m_oFirstColumn ); - XmlMacroReadAttributeBase( oNode, L"w:firstRow", m_oFirstRow ); - XmlMacroReadAttributeBase( oNode, L"w:lastColumn", m_oLastColumn ); - XmlMacroReadAttributeBase( oNode, L"w:lastRow", m_oLastRow ); - XmlMacroReadAttributeBase( oNode, L"w:noHBand", m_oNoHBand ); - XmlMacroReadAttributeBase( oNode, L"w:noVBand", m_oNoVBand ); - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CTblLook(); + virtual ~CTblLook(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( m_oFirstColumn.IsInit() ) - { - sResult += L"w:firstColumn=\""; - sResult += m_oFirstColumn->ToString(); - sResult += L"\" "; - } + virtual std::wstring ToString() const; - if ( m_oFirstRow.IsInit() ) - { - sResult += L"w:firstRow=\""; - sResult += m_oFirstRow->ToString(); - sResult += L"\" "; - } + const bool IsFirstRow() const; + const bool IsLastRow() const; + const bool IsFirstColumn() const; + const bool IsLastColumn () const; + const bool IsNoHBand () const; + const bool IsNoVBand () const; - if ( m_oLastColumn.IsInit() ) - { - sResult += L"w:lastColumn=\""; - sResult += m_oLastColumn->ToString(); - sResult += L"\" "; - } + const int GetValue() const; + void SetValue(int nVal); - if ( m_oLastRow.IsInit() ) - { - sResult += L"w:lastRow=\""; - sResult += m_oLastRow->ToString(); - sResult += L"\" "; - } - - if ( m_oNoHBand.IsInit() ) - { - sResult += L"w:noHBand=\""; - sResult += m_oNoHBand->ToString(); - sResult += L"\" "; - } - - if ( m_oNoVBand.IsInit() ) - { - sResult += L"w:noVBand=\""; - sResult += m_oNoVBand->ToString(); - sResult += L"\" "; - } - - ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); - - return sResult; - } - - const bool IsFirstRow() const - { - if ( m_oFirstRow.IsInit() ) - return ( SimpleTypes::onoffTrue == m_oFirstRow->GetValue() ); - - if ( m_oVal.IsInit() ) - return ( 0 != ( m_oVal->GetValue() & 0x0020 ) ); - - return false; - } - const bool IsLastRow() const - { - if ( m_oLastRow.IsInit() ) - return ( SimpleTypes::onoffTrue == m_oLastRow->GetValue() ); - - if ( m_oVal.IsInit() ) - return ( 0 != ( m_oVal->GetValue() & 0x0040 ) ); - - return false; - } - const bool IsFirstColumn() const - { - if ( m_oFirstColumn.IsInit() ) - return ( SimpleTypes::onoffTrue == m_oFirstColumn->GetValue() ); - - if ( m_oVal.IsInit() ) - return ( 0 != ( m_oVal->GetValue() & 0x0080 ) ); - - return false; - } - const bool IsLastColumn () const - { - if ( m_oLastColumn.IsInit() ) - return ( SimpleTypes::onoffTrue == m_oLastColumn->GetValue() ); - - if ( m_oVal.IsInit() ) - return ( 0 != ( m_oVal->GetValue() & 0x0100 ) ); - - return false; - } - const bool IsNoHBand () const - { - if ( m_oNoHBand.IsInit() ) - return ( SimpleTypes::onoffTrue == m_oNoHBand->GetValue() ); - - if ( m_oVal.IsInit() ) - return ( 0 != ( m_oVal->GetValue() & 0x0200 ) ); - - return false; - } - const bool IsNoVBand () const - { - if ( m_oNoVBand.IsInit() ) - return ( SimpleTypes::onoffTrue == m_oNoVBand->GetValue() ); - - if ( m_oVal.IsInit() ) - return ( 0 != ( m_oVal->GetValue() & 0x0400 ) ); - - return false; - } - const int GetValue() const - { - int nRes = 0; - if(m_oVal.IsInit()) - nRes = m_oVal->GetValue(); - else - { - if ( m_oNoVBand.IsInit() && SimpleTypes::onoffTrue == m_oNoVBand->GetValue()) - nRes |= 0x0400; - if ( m_oNoHBand.IsInit() && SimpleTypes::onoffTrue == m_oNoHBand->GetValue()) - nRes |= 0x0200; - if ( m_oLastColumn.IsInit() && SimpleTypes::onoffTrue == m_oLastColumn->GetValue()) - nRes |= 0x0100; - if ( m_oFirstColumn.IsInit() && SimpleTypes::onoffTrue == m_oFirstColumn->GetValue()) - nRes |= 0x0080; - if ( m_oLastRow.IsInit() && SimpleTypes::onoffTrue == m_oLastRow->GetValue()) - nRes |= 0x0040; - if ( m_oFirstRow.IsInit() && SimpleTypes::onoffTrue == m_oFirstRow->GetValue()) - nRes |= 0x0020; - } - return nRes; - } - void SetValue(int nVal) - { - m_oVal.Init(); - m_oVal->SetValue(nVal); - if ( 0 != (nVal & 0x0400)) - { - m_oNoVBand.Init(); - m_oNoVBand->FromBool(true); - } - if ( 0 != (nVal & 0x0200)) - { - m_oNoHBand.Init(); - m_oNoHBand->FromBool(true); - } - if ( 0 != (nVal & 0x0100)) - { - m_oLastColumn.Init(); - m_oLastColumn->FromBool(true); - } - if ( 0 != (nVal & 0x0080)) - { - m_oFirstColumn.Init(); - m_oFirstColumn->FromBool(true); - } - if ( 0 != (nVal & 0x0040)) - { - m_oLastRow.Init(); - m_oLastRow->FromBool(true); - } - if ( 0 != (nVal & 0x0020)) - { - m_oFirstRow.Init(); - m_oFirstRow->FromBool(true); - } - } private: + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:firstColumn", m_oFirstColumn ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:firstRow", m_oFirstRow ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastColumn", m_oLastColumn ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:lastRow", m_oLastRow ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:noHBand", m_oNoHBand ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:noVBand", m_oNoVBand ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } public: - nullable m_oFirstColumn; nullable m_oFirstRow; nullable m_oLastColumn; @@ -370,6 +126,7 @@ namespace ComplexTypes nullable m_oNoVBand; nullable m_oVal; }; + //-------------------------------------------------------------------------------- // TblOverlap 17.4.56 (Part 1) //-------------------------------------------------------------------------------- @@ -377,42 +134,19 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CTblOverlap) - CTblOverlap() - { - } - virtual ~CTblOverlap() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } - virtual std::wstring ToString() const - { - std::wstring sResult; + CTblOverlap(); + virtual ~CTblOverlap(); - if ( m_oVal.IsInit() ) - { - sResult += L"w:val=\""; - sResult += m_oVal->ToString(); - sResult += L"\" "; - } + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - return sResult; - } + virtual std::wstring ToString() const; public: - nullable m_oVal; }; + //-------------------------------------------------------------------------------- // TblPPr 17.4.58 (Part 1) //-------------------------------------------------------------------------------- @@ -420,167 +154,21 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CTblPPr) - CTblPPr() - { - } - virtual ~CTblPPr() - { - } - void PrepareAfterRead() - { - if(false == m_oHorzAnchor.IsInit()) - { - m_oHorzAnchor.Init(); - m_oHorzAnchor->SetValue(SimpleTypes::hanchorText); - } - if(false == m_oVertAnchor.IsInit()) - { - m_oVertAnchor.Init(); - m_oVertAnchor->SetValue(SimpleTypes::vanchorMargin); - } - if(false == m_oTblpXSpec.IsInit()) - { - if(false == m_oTblpX.IsInit()) - { - m_oTblpX.Init(); - m_oTblpX->FromTwips(0); - } - //Several values of sprmTDxaAbs have special meanings as specified by - //[ECMA-376] Part 4, Section 2.18.114. These values are specified as - //follows. - switch(m_oTblpX->ToTwips()) - { - case 0: - m_oTblpX.reset(NULL); - m_oTblpXSpec.Init(); - m_oTblpXSpec->SetValue(SimpleTypes::xalignLeft); - break; - case -4: - m_oTblpX.reset(NULL); - m_oTblpXSpec.Init(); - m_oTblpXSpec->SetValue(SimpleTypes::xalignCenter); - break; - case -8: - m_oTblpX.reset(NULL); - m_oTblpXSpec.Init(); - m_oTblpXSpec->SetValue(SimpleTypes::xalignRight); - break; - case -12: - m_oTblpX.reset(NULL); - m_oTblpXSpec.Init(); - m_oTblpXSpec->SetValue(SimpleTypes::xalignInside); - break; - case -16: - m_oTblpX.reset(NULL); - m_oTblpXSpec.Init(); - m_oTblpXSpec->SetValue(SimpleTypes::xalignOutside); - break; - } - } - if(false == m_oTblpYSpec.IsInit()) - { - if(false == m_oTblpY.IsInit()) - { - m_oTblpY.Init(); - m_oTblpY->FromTwips(0); - } - //The meanings that are provided correspond to - //values that are defined in [ECMA-376] Part 4, Section 2.18.115 ST_YAlign - //(Vertical Alignment Location). - switch(m_oTblpY->ToTwips()) - { - case 0: - m_oVertAnchor.Init(); - m_oVertAnchor->SetValue(SimpleTypes::vanchorText); - break; - case -4: - m_oTblpY.reset(NULL); - m_oTblpYSpec.Init(); - m_oTblpYSpec->SetValue(SimpleTypes::yalignTop); - break; - case -8: - m_oTblpY.reset(NULL); - m_oTblpYSpec.Init(); - m_oTblpYSpec->SetValue(SimpleTypes::yalignCenter); - break; - case -12: - m_oTblpY.reset(NULL); - m_oTblpYSpec.Init(); - m_oTblpYSpec->SetValue(SimpleTypes::yalignBottom); - break; - case -16: - m_oTblpY.reset(NULL); - m_oTblpYSpec.Init(); - m_oTblpYSpec->SetValue(SimpleTypes::yalignInside); - break; - case -20: - m_oTblpY.reset(NULL); - m_oTblpYSpec.Init(); - m_oTblpYSpec->SetValue(SimpleTypes::yalignOutside); - break; - } - } - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:bottomFromText", m_oBottomFromText ); - XmlMacroReadAttributeBase( oNode, L"w:horzAnchor", m_oHorzAnchor ); - XmlMacroReadAttributeBase( oNode, L"w:leftFromText", m_oLeftFromText ); - XmlMacroReadAttributeBase( oNode, L"w:rightFromText", m_oRightFromText ); - XmlMacroReadAttributeBase( oNode, L"w:tblpX", m_oTblpX ); - XmlMacroReadAttributeBase( oNode, L"w:tblpXSpec", m_oTblpXSpec ); - XmlMacroReadAttributeBase( oNode, L"w:tblpY", m_oTblpY ); - XmlMacroReadAttributeBase( oNode, L"w:tblpYSpec", m_oTblpYSpec ); - XmlMacroReadAttributeBase( oNode, L"w:topFromText", m_oTopFromText ); - XmlMacroReadAttributeBase( oNode, L"w:vertAnchor", m_oVertAnchor ); - PrepareAfterRead(); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - PrepareAfterRead(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + CTblPPr(); + virtual ~CTblPPr(); - ComplexTypes_WriteAttribute( L"w:bottomFromText=\"", m_oBottomFromText ); - ComplexTypes_WriteAttribute( L"w:horzAnchor=\"", m_oHorzAnchor ); - ComplexTypes_WriteAttribute( L"w:leftFromText=\"", m_oLeftFromText ); - ComplexTypes_WriteAttribute( L"w:rightFromText=\"", m_oRightFromText ); - ComplexTypes_WriteAttribute( L"w:tblpX=\"", m_oTblpX ); - ComplexTypes_WriteAttribute( L"w:tblpXSpec=\"", m_oTblpXSpec ); - ComplexTypes_WriteAttribute( L"w:tblpY=\"", m_oTblpY ); - ComplexTypes_WriteAttribute( L"w:tblpYSpec=\"", m_oTblpYSpec ); - ComplexTypes_WriteAttribute( L"w:topFromText=\"", m_oTopFromText ); - ComplexTypes_WriteAttribute( L"w:vertAnchor=\"", m_oVertAnchor ); + void PrepareAfterRead(); + + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); + + virtual std::wstring ToString() const; - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:bottomFromText", m_oBottomFromText ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:horzAnchor", m_oHorzAnchor ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:leftFromText", m_oLeftFromText ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:rightFromText", m_oRightFromText ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:tblpX", m_oTblpX ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:tblpXSpec", m_oTblpXSpec ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:tblpY", m_oTblpY ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:tblpYSpec", m_oTblpYSpec ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:topFromText", m_oTopFromText ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:vertAnchor", m_oVertAnchor ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oBottomFromText; nullable m_oHorzAnchor; nullable m_oLeftFromText; @@ -591,8 +179,8 @@ namespace ComplexTypes nullable m_oTblpYSpec; nullable m_oTopFromText; nullable m_oVertAnchor; - }; + } // Word } // ComplexTypes @@ -607,137 +195,18 @@ namespace OOX { public: WritingElement_AdditionConstructors(CTblBorders) - CTblBorders() - { - } - virtual ~CTblBorders() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - if ( L"w:tblBorders" != oNode.GetName() ) - return; - XmlUtils::CXmlNode oChild; + CTblBorders(); + virtual ~CTblBorders(); - if ( oNode.GetNode( L"w:bottom", oChild ) ) - m_oBottom = oChild; + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - if ( oNode.GetNode( L"w:end", oChild ) ) - m_oEnd = oChild; + virtual std::wstring toXML() const; + virtual EElementType getType() const; - if ( oNode.GetNode( L"w:insideH", oChild ) ) - m_oInsideH = oChild; + static const CTblBorders Merge(const CTblBorders& oPrev, const CTblBorders& oCurrent); - if ( oNode.GetNode( L"w:insideV", oChild ) ) - m_oInsideV = oChild; - - if ( oNode.GetNode( L"w:start", oChild ) ) - m_oStart = oChild; - - if ( oNode.GetNode( L"w:top", oChild ) ) - m_oTop = oChild; - - if ( !m_oEnd.IsInit() && oNode.GetNode( L"w:right", oChild ) ) - m_oEnd = oChild; - - if ( !m_oStart.IsInit() && oNode.GetNode( L"w:left", oChild ) ) - m_oStart = oChild; - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; - - int nParentDepth = oReader.GetDepth(); - while( oReader.ReadNextSiblingNode( nParentDepth ) ) - { - std::wstring sName = oReader.GetName(); - if ( L"w:bottom" == sName ) - m_oBottom = oReader; - else if ( L"w:end" == sName ) - m_oEnd = oReader; - else if ( L"w:insideH" == sName ) - m_oInsideH = oReader; - else if ( L"w:insideV" == sName ) - m_oInsideV = oReader; - else if ( L"w:start" == sName ) - m_oStart = oReader; - else if ( L"w:top" == sName ) - m_oTop = oReader; - else if ( L"w:right" == sName ) - m_oEnd = oReader; - else if ( L"w:left" == sName ) - m_oStart = oReader; - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = L""; - - if ( m_oBottom.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oEnd.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oInsideH.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oInsideV.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oStart.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oTop.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - sResult += L""; - - return sResult; - } - - virtual EElementType getType() const - { - return et_w_tblBorders; - } - static const CTblBorders Merge(const CTblBorders& oPrev, const CTblBorders& oCurrent) - { - CTblBorders oProperties; - oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom ); - oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd ); - oProperties.m_oInsideH = Merge( oPrev.m_oInsideH, oCurrent.m_oInsideH ); - oProperties.m_oInsideV = Merge( oPrev.m_oInsideV, oCurrent.m_oInsideV ); - oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart ); - oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop ); - - return oProperties; - } template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { @@ -750,8 +219,8 @@ namespace OOX return oResult; } - public: + public: nullable m_oBottom; nullable m_oEnd; nullable m_oInsideH; @@ -760,6 +229,7 @@ namespace OOX nullable m_oTop; }; + //-------------------------------------------------------------------------------- // TblCellMar 17.4.43 (Part 1) + 9.3.4 (Part 4) + 9.3.8 (Part 4) //-------------------------------------------------------------------------------- @@ -767,111 +237,18 @@ namespace OOX { public: WritingElement_AdditionConstructors(CTblCellMar) - CTblCellMar() - { - } - virtual ~CTblCellMar() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - if ( L"w:tblCellMar" != oNode.GetName() ) - return; - XmlUtils::CXmlNode oChild; + CTblCellMar(); + virtual ~CTblCellMar(); - if ( oNode.GetNode( L"w:bottom", oChild ) ) - m_oBottom = oChild; + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - if ( oNode.GetNode( L"w:end", oChild ) ) - m_oEnd = oChild; + virtual std::wstring toXML() const; + virtual EElementType getType() const; - if ( oNode.GetNode( L"w:start", oChild ) ) - m_oStart = oChild; + static const CTblCellMar Merge(const CTblCellMar& oPrev, const CTblCellMar& oCurrent); - if ( oNode.GetNode( L"w:top", oChild ) ) - m_oTop = oChild; - - if ( !m_oEnd.IsInit() && oNode.GetNode( L"w:right", oChild ) ) - m_oEnd = oChild; - - if ( !m_oStart.IsInit() && oNode.GetNode( L"w:left", oChild ) ) - m_oStart = oChild; - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; - - int nParentDepth = oReader.GetDepth(); - while( oReader.ReadNextSiblingNode( nParentDepth ) ) - { - std::wstring sName = oReader.GetName(); - if ( L"w:bottom" == sName ) - m_oBottom = oReader; - else if ( L"w:end" == sName ) - m_oEnd = oReader; - else if ( L"w:start" == sName ) - m_oStart = oReader; - else if ( L"w:top" == sName ) - m_oTop = oReader; - else if ( L"w:right" == sName ) - m_oEnd = oReader; - else if ( L"w:left" == sName ) - m_oStart = oReader; - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = L""; - - if ( m_oBottom.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oEnd.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oStart.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - if ( m_oTop.IsInit() ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - sResult += L""; - - return sResult; - } - - virtual EElementType getType() const - { - return et_w_tblCellMar; - } - static const CTblCellMar Merge(const CTblCellMar& oPrev, const CTblCellMar& oCurrent) - { - CTblCellMar oProperties; - oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom ); - oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd ); - oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart ); - oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop ); - - return oProperties; - } template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { @@ -890,12 +267,13 @@ namespace OOX nullable m_oEnd; nullable m_oStart; nullable m_oTop; - }; + //-------------------------------------------------------------------------------- // TblPrChange 17.13.5.34 (Part 1) //-------------------------------------------------------------------------------- class CTableProperty; + class CTblPrChange : public WritingElement { public: @@ -924,174 +302,30 @@ namespace OOX nullable m_pTblPr; }; + //-------------------------------------------------------------------------------- - // CTableProperty + // TableProperty //-------------------------------------------------------------------------------- class CTableProperty : public WritingElement { public: - CTableProperty(OOX::Document *pMain = NULL) - { - m_bTblPrChange = false; - } - CTableProperty(XmlUtils::CXmlNode &oNode) : WritingElement(NULL) - { - m_bTblPrChange = false; + CTableProperty(OOX::Document *pMain = NULL); + CTableProperty(XmlUtils::CXmlNode &oNode); + CTableProperty(XmlUtils::CXmlLiteReader& oReader); + virtual ~CTableProperty(); - fromXML( oNode ); - } - CTableProperty(XmlUtils::CXmlLiteReader& oReader) : WritingElement(NULL) - { - m_bTblPrChange = false; + const CTableProperty& operator=(const XmlUtils::CXmlNode &oNode); + const CTableProperty& operator=(const XmlUtils::CXmlLiteReader& oReader); - fromXML( oReader ); - } - virtual ~CTableProperty() - { - } - const CTableProperty& operator=(const XmlUtils::CXmlNode &oNode) - { - fromXML( (XmlUtils::CXmlNode &)oNode ); - return *this; - } - const CTableProperty& operator=(const XmlUtils::CXmlLiteReader& oReader) - { - fromXML( (XmlUtils::CXmlLiteReader&)oReader ); - return *this; - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - if ( L"w:tblPr" != oNode.GetName() ) - return; + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - XmlUtils::CXmlNode oChild; + virtual std::wstring toXML() const; + virtual EElementType getType() const; - WritingElement_ReadNode( oNode, oChild, L"w:bidiVisual", m_oBidiVisual ); - WritingElement_ReadNode( oNode, oChild, L"w:jc", m_oJc ); - WritingElement_ReadNode( oNode, oChild, L"w:shd", m_oShade ); - WritingElement_ReadNode( oNode, oChild, L"w:tblBorders", m_oTblBorders ); - WritingElement_ReadNode( oNode, oChild, L"w:tblCaption", m_oTblCaption ); - WritingElement_ReadNode( oNode, oChild, L"w:tblCellMar", m_oTblCellMar ); - WritingElement_ReadNode( oNode, oChild, L"w:tblCellSpacing", m_oTblCellSpacing ); - WritingElement_ReadNode( oNode, oChild, L"w:tblDescription", m_oTblDescription ); - WritingElement_ReadNode( oNode, oChild, L"w:tblInd", m_oTblInd ); - WritingElement_ReadNode( oNode, oChild, L"w:tblLayout", m_oTblLayout ); - WritingElement_ReadNode( oNode, oChild, L"w:tblLook", m_oTblLook ); - WritingElement_ReadNode( oNode, oChild, L"w:tblOverlap", m_oTblOverlap ); - WritingElement_ReadNode( oNode, oChild, L"w:tblpPr", m_oTblpPr ); + static const CTableProperty Merge(const CTableProperty& oPrev, const CTableProperty& oCurrent); - if ( !m_bTblPrChange ) - WritingElement_ReadNode( oNode, oChild, L"w:tblPrChange", m_oTblPrChange ); - - WritingElement_ReadNode( oNode, oChild, L"w:tblStyle", m_oTblStyle ); - WritingElement_ReadNode( oNode, oChild, L"w:tblStyleColBandSize", m_oTblStyleColBandSize ); - WritingElement_ReadNode( oNode, oChild, L"w:tblStyleRowBandSize", m_oTblStyleRowBandSize ); - WritingElement_ReadNode( oNode, oChild, L"w:tblW", m_oTblW ); - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; - - int nParentDepth = oReader.GetDepth(); - while( oReader.ReadNextSiblingNode( nParentDepth ) ) - { - std::wstring sName = oReader.GetName(); - - if ( L"w:bidiVisual" == sName ) m_oBidiVisual = oReader; - else if ( L"w:jc" == sName ) m_oJc = oReader; - else if ( L"w:shd" == sName ) m_oShade = oReader; - else if ( L"w:tblBorders" == sName ) m_oTblBorders = oReader; - else if ( L"w:tblCaption" == sName ) m_oTblCaption = oReader; - else if ( L"w:tblCellMar" == sName ) m_oTblCellMar = oReader; - else if ( L"w:tblCellSpacing" == sName ) m_oTblCellSpacing = oReader; - else if ( L"w:tblDescription" == sName ) m_oTblDescription = oReader; - else if ( L"w:tblInd" == sName ) m_oTblInd = oReader; - else if ( L"w:tblLayout" == sName ) m_oTblLayout = oReader; - else if ( L"w:tblLook" == sName ) m_oTblLook = oReader; - else if ( L"w:tblOverlap" == sName ) m_oTblOverlap = oReader; - else if ( L"w:tblpPr" == sName ) m_oTblpPr = oReader; - else if ( !m_bTblPrChange && L"w:tblPrChange" == sName ) m_oTblPrChange = oReader; - else if ( L"w:tblStyle" == sName ) m_oTblStyle = oReader; - else if ( L"w:tblStyleColBandSize" == sName ) m_oTblStyleColBandSize = oReader; - else if ( L"w:tblStyleRowBandSize" == sName ) m_oTblStyleRowBandSize = oReader; - else if ( L"w:tblW" == sName ) m_oTblW = oReader; - else if ( L"w:tblPr" == sName) - {//387.docx - fromXML(oReader); - } - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = L""; - - WritingElement_WriteNode_1( L""; - - return sResult; - } - - virtual EElementType getType() const - { - return et_w_tblPr; - } - static const CTableProperty Merge(const CTableProperty& oPrev, const CTableProperty& oCurrent) - { - CTableProperty oProperties; - oProperties.m_bTblPrChange = oPrev.m_bTblPrChange || oCurrent.m_bTblPrChange; - oProperties.m_oBidiVisual = Merge( oPrev.m_oBidiVisual, oCurrent.m_oBidiVisual ); - oProperties.m_oJc = Merge( oPrev.m_oJc, oCurrent.m_oJc ); - oProperties.m_oShade = Merge( oPrev.m_oShade, oCurrent.m_oShade ); - - if ( oCurrent.m_oTblBorders.IsInit() && oPrev.m_oTblBorders.IsInit() ) - oProperties.m_oTblBorders = OOX::Logic::CTblBorders::Merge(oPrev.m_oTblBorders.get(), oCurrent.m_oTblBorders.get()); - else - oProperties.m_oTblBorders = Merge( oPrev.m_oTblBorders, oCurrent.m_oTblBorders ); - - oProperties.m_oTblCaption = Merge( oPrev.m_oTblCaption, oCurrent.m_oTblCaption ); - - if ( oCurrent.m_oTblCellMar.IsInit() && oPrev.m_oTblCellMar.IsInit() ) - oProperties.m_oTblCellMar = OOX::Logic::CTblCellMar::Merge(oPrev.m_oTblCellMar.get(), oCurrent.m_oTblCellMar.get()); - else - oProperties.m_oTblCellMar = Merge( oPrev.m_oTblCellMar, oCurrent.m_oTblCellMar ); - - oProperties.m_oTblCellSpacing = Merge( oPrev.m_oTblCellSpacing, oCurrent.m_oTblCellSpacing ); - oProperties.m_oTblDescription = Merge( oPrev.m_oTblDescription, oCurrent.m_oTblDescription ); - oProperties.m_oTblInd = Merge( oPrev.m_oTblInd, oCurrent.m_oTblInd ); - oProperties.m_oTblLayout = Merge( oPrev.m_oTblLayout, oCurrent.m_oTblLayout ); - oProperties.m_oTblLook = Merge( oPrev.m_oTblLook, oCurrent.m_oTblLook ); - oProperties.m_oTblOverlap = Merge( oPrev.m_oTblOverlap, oCurrent.m_oTblOverlap ); - oProperties.m_oTblpPr = Merge( oPrev.m_oTblpPr, oCurrent.m_oTblpPr ); - oProperties.m_oTblPrChange = Merge( oPrev.m_oTblPrChange, oCurrent.m_oTblPrChange ); - oProperties.m_oTblStyle = Merge( oPrev.m_oTblStyle, oCurrent.m_oTblStyle ); - oProperties.m_oTblStyleColBandSize = Merge( oPrev.m_oTblStyleColBandSize, oCurrent.m_oTblStyleColBandSize ); - oProperties.m_oTblStyleRowBandSize = Merge( oPrev.m_oTblStyleRowBandSize, oCurrent.m_oTblStyleRowBandSize ); - oProperties.m_oTblW = Merge( oPrev.m_oTblW, oCurrent.m_oTblW ); - return oProperties; - } template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { @@ -1104,8 +338,8 @@ namespace OOX return oResult; } - public: + public: bool m_bTblPrChange; nullable m_oBidiVisual; @@ -1126,8 +360,8 @@ namespace OOX nullable m_oTblStyleColBandSize; nullable m_oTblStyleRowBandSize; nullable m_oTblW; - }; + } // namespace Logic } // namespace OOX @@ -1142,48 +376,19 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CHeight) - CHeight() - { - } - virtual ~CHeight() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:hRule", m_oHRule ); - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - XmlMacroReadAttributeBase(oNode, L"w:h-rule", m_oHRule); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CHeight(); + virtual ~CHeight(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - ComplexTypes_WriteAttribute( L"w:hRule=\"", m_oHRule ); - ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); + virtual std::wstring ToString() const; - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:hRule", m_oHRule ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_Read_else_if(oReader, L"w:h-rule", m_oHRule) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oHRule; nullable m_oVal; }; @@ -1199,6 +404,7 @@ namespace OOX // TrPrChange 17.13.5.37 (Part 1) //-------------------------------------------------------------------------------- class CTableRowProperties; + class CTrPrChange : public WritingElement { public: @@ -1208,15 +414,14 @@ namespace OOX virtual ~CTrPrChange(); const CTrPrChange& operator = (const XmlUtils::CXmlNode &oNode); const CTrPrChange& operator = (const XmlUtils::CXmlLiteReader& oReader); - public: + public: virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); virtual std::wstring toXML() const; virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: @@ -1230,153 +435,30 @@ namespace OOX // Childs nullable m_pTrPr; }; + //-------------------------------------------------------------------------------- - // CTableRowProperties + // TableRowProperties //-------------------------------------------------------------------------------- class CTableRowProperties : public WritingElement { public: - CTableRowProperties(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - m_bTrPrChange = false; - } - CTableRowProperties(XmlUtils::CXmlNode &oNode) : WritingElement(NULL) - { - m_bTrPrChange = false; + CTableRowProperties(OOX::Document *pMain = NULL); + CTableRowProperties(XmlUtils::CXmlNode &oNode); + CTableRowProperties(XmlUtils::CXmlLiteReader& oReader); + virtual ~CTableRowProperties(); - fromXML( (XmlUtils::CXmlNode &)oNode ); - } - CTableRowProperties(XmlUtils::CXmlLiteReader& oReader) : WritingElement(NULL) - { - m_bTrPrChange = false; - - fromXML( (XmlUtils::CXmlLiteReader&)oReader ); - } - virtual ~CTableRowProperties() - { - } - - const CTableRowProperties& operator =(const XmlUtils::CXmlNode &oNode) - { - fromXML( (XmlUtils::CXmlNode &)oNode ); - return *this; - } - const CTableRowProperties& operator =(const XmlUtils::CXmlLiteReader& oReader) - { - fromXML( (XmlUtils::CXmlLiteReader&)oReader ); - return *this; - } + const CTableRowProperties& operator =(const XmlUtils::CXmlNode &oNode); + const CTableRowProperties& operator =(const XmlUtils::CXmlLiteReader& oReader); public: + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - if ( L"w:trPr" != oNode.GetName() ) - return; + virtual std::wstring toXML() const; + virtual EElementType getType() const; - XmlUtils::CXmlNode oChild; + static const CTableRowProperties Merge(const CTableRowProperties& oPrev, const CTableRowProperties& oCurrent); - WritingElement_ReadNode( oNode, oChild, L"w:cantSplit", m_oCantSplit ); - WritingElement_ReadNode( oNode, oChild, L"w:cnfStyle", m_oCnfStyle ); - WritingElement_ReadNode( oNode, oChild, L"w:del", m_oDel ); - WritingElement_ReadNode( oNode, oChild, L"w:divId", m_oDivId ); - WritingElement_ReadNode( oNode, oChild, L"w:gridAfter", m_oGridAfter ); - WritingElement_ReadNode( oNode, oChild, L"w:gridBefore", m_oGridBefore ); - WritingElement_ReadNode( oNode, oChild, L"w:hidden", m_oHidden ); - WritingElement_ReadNode( oNode, oChild, L"w:ins", m_oIns ); - WritingElement_ReadNode( oNode, oChild, L"w:jc", m_oJc ); - WritingElement_ReadNode( oNode, oChild, L"w:tblCellSpacing", m_oTblCellSpacing ); - WritingElement_ReadNode( oNode, oChild, L"w:tblHeader", m_oTblHeader ); - WritingElement_ReadNode( oNode, oChild, L"w:trHeight", m_oTblHeight ); - - if ( !m_bTrPrChange ) - WritingElement_ReadNode( oNode, oChild, L"w:trPrChange", m_oTrPrChange ); - - WritingElement_ReadNode( oNode, oChild, L"w:wAfter", m_oWAfter ); - WritingElement_ReadNode( oNode, oChild, L"w:wBefore", m_oWBefore ); - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; - - int nParentDepth = oReader.GetDepth(); - while( oReader.ReadNextSiblingNode( nParentDepth ) ) - { - std::wstring sName = oReader.GetName(); - - if ( L"w:cantSplit" == sName ) m_oCantSplit = oReader; - else if ( L"w:cnfStyle" == sName ) m_oCnfStyle = oReader; - else if ( L"w:del" == sName ) m_oDel = oReader; - else if ( L"w:divId" == sName ) m_oDivId = oReader; - else if ( L"w:gridAfter" == sName ) m_oGridAfter = oReader; - else if ( L"w:gridBefore" == sName ) m_oGridBefore = oReader; - else if ( L"w:hidden" == sName ) m_oHidden = oReader; - else if ( L"w:ins" == sName ) m_oIns = oReader; - else if ( L"w:jc" == sName ) m_oJc = oReader; - else if ( L"w:tblCellSpacing" == sName ) m_oTblCellSpacing = oReader; - else if ( L"w:tblHeader" == sName ) m_oTblHeader = oReader; - else if ( L"w:trHeight" == sName ) m_oTblHeight = oReader; - else if ( !m_bTrPrChange && L"w:trPrChange" == sName ) m_oTrPrChange = oReader; - else if ( L"w:wAfter" == sName ) m_oWAfter = oReader; - else if ( L"w:wBefore" == sName ) m_oWBefore = oReader; - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = L""; - - WritingElement_WriteNode_1( L""; - - return sResult; - } - - virtual EElementType getType() const - { - return et_w_trPr; - } - static const CTableRowProperties Merge(const CTableRowProperties& oPrev, const CTableRowProperties& oCurrent) - { - CTableRowProperties oProperties; - - oProperties.m_bTrPrChange = oPrev.m_bTrPrChange || oCurrent.m_bTrPrChange; - oProperties.m_oCantSplit = Merge( oPrev.m_oCantSplit, oCurrent.m_oCantSplit ); - oProperties.m_oCnfStyle = Merge( oPrev.m_oCnfStyle, oCurrent.m_oCnfStyle ); - oProperties.m_oDel = Merge( oPrev.m_oDel, oCurrent.m_oDel ); - oProperties.m_oDivId = Merge( oPrev.m_oDivId, oCurrent.m_oDivId ); - oProperties.m_oGridAfter = Merge( oPrev.m_oGridAfter, oCurrent.m_oGridAfter ); - oProperties.m_oGridBefore = Merge( oPrev.m_oGridBefore, oCurrent.m_oGridBefore ); - oProperties.m_oHidden = Merge( oPrev.m_oHidden, oCurrent.m_oHidden ); - oProperties.m_oIns = Merge( oPrev.m_oIns, oCurrent.m_oIns ); - oProperties.m_oJc = Merge( oPrev.m_oJc, oCurrent.m_oJc ); - oProperties.m_oTblCellSpacing = Merge( oPrev.m_oTblCellSpacing, oCurrent.m_oTblCellSpacing ); - oProperties.m_oTblHeader = Merge( oPrev.m_oTblHeader, oCurrent.m_oTblHeader ); - oProperties.m_oTblHeight = Merge( oPrev.m_oTblHeight, oCurrent.m_oTblHeight ); - oProperties.m_oTrPrChange = Merge( oPrev.m_oTrPrChange, oCurrent.m_oTrPrChange ); - oProperties.m_oWAfter = Merge( oPrev.m_oWAfter, oCurrent.m_oWAfter ); - oProperties.m_oWBefore = Merge( oPrev.m_oWBefore, oCurrent.m_oWBefore ); - - return oProperties; - } template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { @@ -1389,8 +471,8 @@ namespace OOX return oResult; } - public: + public: bool m_bTrPrChange; nullable m_oCantSplit; @@ -1424,71 +506,19 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CCellMergeTrackChange) - CCellMergeTrackChange() - { - } - virtual ~CCellMergeTrackChange() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:author", m_sAuthor ); - XmlMacroReadAttributeBase( oNode, L"w:date", m_oDate ); - XmlMacroReadAttributeBase( oNode, L"w:id", m_oId ); - XmlMacroReadAttributeBase( oNode, L"w:vMerge", m_oVMerge ); - XmlMacroReadAttributeBase( oNode, L"w:vMergeOrig", m_oVMergeOrig ); - XmlMacroReadAttributeBase( oNode, L"oouserid", m_sUserId ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CCellMergeTrackChange(); + virtual ~CCellMergeTrackChange(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - if ( m_sAuthor.IsInit() ) - { - sResult += L"w:author=\""; - sResult += m_sAuthor.get2(); - sResult += L"\" "; - } + virtual std::wstring ToString() const; - ComplexTypes_WriteAttribute( L"w:date=\"", m_oDate ); - ComplexTypes_WriteAttribute( L"w:id=\"", m_oId ); - ComplexTypes_WriteAttribute( L"w:vMerge=\"", m_oVMerge ); - ComplexTypes_WriteAttribute( L"w:vMergeOrig=\"", m_oVMergeOrig ); - - if ( m_sUserId.IsInit() ) - { - sResult += L"oouserid=\""; - sResult += m_sUserId.get2(); - sResult += L"\" "; - } - - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, L"w:author", m_sAuthor ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:date", m_oDate ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:id", m_oId ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:vMerge", m_oVMerge ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"w:vMergeOrig", m_oVMergeOrig ) - WritingElement_ReadAttributes_Read_else_if( oReader, L"oouserid", m_sUserId ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_sAuthor; nullable m_oDate; nullable m_oId; @@ -1497,6 +527,7 @@ namespace ComplexTypes nullable m_sUserId; }; + //-------------------------------------------------------------------------------- // HMerge 17.4.22 (Part 1) //-------------------------------------------------------------------------------- @@ -1504,44 +535,19 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CHMerge) - CHMerge() - { - } - virtual ~CHMerge() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CHMerge(); + virtual ~CHMerge(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); + virtual std::wstring ToString() const; - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oVal; }; @@ -1553,46 +559,20 @@ namespace ComplexTypes { public: ComplexTypes_AdditionConstructors(CVMerge) - CVMerge() - { - } - virtual ~CVMerge() - { - } - virtual void FromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase( oNode, L"w:val", m_oVal ); - } - virtual void FromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); + CVMerge(); + virtual ~CVMerge(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring ToString() const - { - std::wstring sResult; + virtual void FromXML(XmlUtils::CXmlNode& oNode); + virtual void FromXML(XmlUtils::CXmlLiteReader& oReader); - ComplexTypes_WriteAttribute( L"w:val=\"", m_oVal ); + virtual std::wstring ToString() const; - return sResult; - } private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, L"w:val", m_oVal ) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_oVal; - }; } // Word @@ -1610,76 +590,15 @@ namespace OOX public: WritingElement_AdditionConstructors(CHeaders) - CHeaders(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - } - virtual ~CHeaders() - { - for ( unsigned int nIndex = 0; nIndex < m_arrHeaders.size(); nIndex++ ) - { - if ( m_arrHeaders[nIndex] ) delete m_arrHeaders[nIndex]; - m_arrHeaders[nIndex] = NULL; - } - m_arrHeaders.clear(); - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - if ( L"w:headers" != oNode.GetName() ) - return; + CHeaders(OOX::Document *pMain = NULL); + virtual ~CHeaders(); - XmlUtils::CXmlNodes oHeaders; + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - if ( oNode.GetNodes( L"w:header", oHeaders ) ) - { - XmlUtils::CXmlNode oHeader; - for ( int nIndex = 0; nIndex < oHeaders.GetCount(); nIndex++ ) - { - if ( oHeaders.GetAt( nIndex, oHeader ) ) - { - ComplexTypes::Word::String *oHead = new ComplexTypes::Word::String(oHeader); - if (oHead) m_arrHeaders.push_back( oHead ); - } - } - } - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; + virtual std::wstring toXML() const; + virtual EElementType getType() const; - int nParentDepth = oReader.GetDepth(); - while( oReader.ReadNextSiblingNode( nParentDepth ) ) - { - std::wstring sName = oReader.GetName(); - - if ( L"w:header" == sName ) - { - ComplexTypes::Word::String *oHead = new ComplexTypes::Word::String(oReader); - if (oHead) m_arrHeaders.push_back( oHead ); - } - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = L""; - - for (unsigned int nIndex = 0; nIndex < m_arrHeaders.size(); nIndex++ ) - { - sResult += L"ToString(); - sResult += L"/>"; - } - - sResult += L""; - - return sResult; - } - - virtual EElementType getType() const - { - return et_w_headers; - } std::vector m_arrHeaders; }; @@ -1690,94 +609,19 @@ namespace OOX { public: WritingElement_AdditionConstructors(CTcBorders) - CTcBorders() - { - } - virtual ~CTcBorders() - { - } + + CTcBorders(); + virtual ~CTcBorders(); public: - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - if ( L"w:tcBorders" != oNode.GetName() ) - return; + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - XmlUtils::CXmlNode oChild; + virtual std::wstring toXML() const; + virtual EElementType getType() const; - WritingElement_ReadNode( oNode, oChild, L"w:bottom", m_oBottom ); - WritingElement_ReadNode( oNode, oChild, L"w:end", m_oEnd ); - WritingElement_ReadNode( oNode, oChild, L"w:insideH", m_oInsideH ); - WritingElement_ReadNode( oNode, oChild, L"w:insideV", m_oInsideV ); - WritingElement_ReadNode( oNode, oChild, L"w:start", m_oStart ); - WritingElement_ReadNode( oNode, oChild, L"w:tl2br", m_oTL2BR ); - WritingElement_ReadNode( oNode, oChild, L"w:top", m_oTop ); - WritingElement_ReadNode( oNode, oChild, L"w:tr2bl", m_oTR2BL ); + static const CTcBorders Merge(const CTcBorders& oPrev, const CTcBorders& oCurrent); - if ( !m_oEnd.IsInit() ) - WritingElement_ReadNode( oNode, oChild, L"w:right", m_oEnd ); - - if ( !m_oStart.IsInit() ) - WritingElement_ReadNode( oNode, oChild, L"w:left", m_oStart ); - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; - - int nParentDepth = oReader.GetDepth(); - while( oReader.ReadNextSiblingNode( nParentDepth ) ) - { - std::wstring sName = oReader.GetName(); - - if ( L"w:bottom" == sName ) m_oBottom = oReader; - else if ( L"w:end" == sName ) m_oEnd = oReader; - else if ( L"w:insideH" == sName ) m_oInsideH = oReader; - else if ( L"w:insideV" == sName ) m_oInsideV = oReader; - else if ( L"w:start" == sName ) m_oStart = oReader; - else if ( L"w:tl2br" == sName ) m_oTL2BR = oReader; - else if ( L"w:top" == sName ) m_oTop = oReader; - else if ( L"w:tr2bl" == sName ) m_oTR2BL = oReader; - else if ( !m_oEnd.IsInit() && L"w:right" == sName ) m_oEnd = oReader; - else if ( !m_oStart.IsInit() && L"w:left" == sName ) m_oStart = oReader; - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = L""; - - WritingElement_WriteNode_1( L""; - - return sResult; - } - - virtual EElementType getType() const - { - return et_w_tcBorders; - } - static const CTcBorders Merge(const CTcBorders& oPrev, const CTcBorders& oCurrent) - { - CTcBorders oProperties; - oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom ); - oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd ); - oProperties.m_oInsideH = Merge( oPrev.m_oInsideH, oCurrent.m_oInsideH ); - oProperties.m_oInsideV = Merge( oPrev.m_oInsideV, oCurrent.m_oInsideV ); - oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart ); - oProperties.m_oTL2BR = Merge( oPrev.m_oTL2BR, oCurrent.m_oTL2BR ); - oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop ); - oProperties.m_oTR2BL = Merge( oPrev.m_oTR2BL, oCurrent.m_oTR2BL ); - - return oProperties; - } template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { @@ -1790,8 +634,8 @@ namespace OOX return oResult; } - public: + public: nullable m_oBottom; nullable m_oEnd; nullable m_oInsideH; @@ -1809,76 +653,18 @@ namespace OOX { public: WritingElement_AdditionConstructors(CTcMar) - CTcMar() - { - } - virtual ~CTcMar() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - if ( L"w:tcMar" != oNode.GetName() ) - return; - XmlUtils::CXmlNode oChild; + CTcMar(); + virtual ~CTcMar(); - WritingElement_ReadNode( oNode, oChild, L"w:bottom", m_oBottom ); - WritingElement_ReadNode( oNode, oChild, L"w:end", m_oEnd ); - WritingElement_ReadNode( oNode, oChild, L"w:start", m_oStart ); - WritingElement_ReadNode( oNode, oChild, L"w:top", m_oTop ); + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - if ( !m_oEnd.IsInit() ) - WritingElement_ReadNode( oNode, oChild, L"w:right", m_oEnd ); + virtual std::wstring toXML() const; + virtual EElementType getType() const; - if ( !m_oStart.IsInit() ) - WritingElement_ReadNode( oNode, oChild, L"w:left", m_oStart ); - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; + static const CTcMar Merge(const CTcMar& oPrev, const CTcMar& oCurrent); - int nParentDepth = oReader.GetDepth(); - while( oReader.ReadNextSiblingNode( nParentDepth ) ) - { - std::wstring sName = oReader.GetName(); - - if ( L"w:bottom" == sName ) m_oBottom = oReader; - else if ( L"w:end" == sName ) m_oEnd = oReader; - else if ( L"w:start" == sName ) m_oStart = oReader; - else if ( L"w:top" == sName ) m_oTop = oReader; - else if ( !m_oEnd.IsInit() && L"w:right" == sName ) m_oEnd = oReader; - else if ( !m_oStart.IsInit() && L"w:left" == sName ) m_oStart = oReader; - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = L""; - - WritingElement_WriteNode_1( L""; - - return sResult; - } - - virtual EElementType getType() const - { - return et_w_tcMar; - } - static const CTcMar Merge(const CTcMar& oPrev, const CTcMar& oCurrent) - { - CTcMar oProperties; - oProperties.m_oBottom = Merge( oPrev.m_oBottom, oCurrent.m_oBottom ); - oProperties.m_oEnd = Merge( oPrev.m_oEnd, oCurrent.m_oEnd ); - oProperties.m_oStart = Merge( oPrev.m_oStart, oCurrent.m_oStart ); - oProperties.m_oTop = Merge( oPrev.m_oTop, oCurrent.m_oTop ); - - return oProperties; - } template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { @@ -1902,6 +688,7 @@ namespace OOX // TblPrChange 17.13.5.34 (Part 1) //-------------------------------------------------------------------------------- class CTableCellProperties; + class CTcPrChange : public WritingElement { public: @@ -1909,6 +696,7 @@ namespace OOX CTcPrChange(XmlUtils::CXmlNode &oNode); CTcPrChange(XmlUtils::CXmlLiteReader& oReader); virtual ~CTcPrChange(); + const CTcPrChange& operator = (const XmlUtils::CXmlNode &oNode); const CTcPrChange& operator = (const XmlUtils::CXmlLiteReader& oReader); @@ -1918,11 +706,9 @@ namespace OOX virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - nullable m_sAuthor; nullable m_oDate; nullable m_oId; @@ -1930,187 +716,29 @@ namespace OOX nullable m_pTcPr; }; + //-------------------------------------------------------------------------------- - // CTableCellProperties + // TableCellProperties //-------------------------------------------------------------------------------- class CTableCellProperties : public WritingElement { public: - CTableCellProperties(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - m_bTcPrChange = false; - } - CTableCellProperties(XmlUtils::CXmlNode &oNode) : WritingElement(NULL) - { - m_bTcPrChange = false; + CTableCellProperties(OOX::Document *pMain = NULL); + CTableCellProperties(XmlUtils::CXmlNode &oNode); + CTableCellProperties(XmlUtils::CXmlLiteReader& oReader); + virtual ~CTableCellProperties(); - fromXML( oNode ); - } - CTableCellProperties(XmlUtils::CXmlLiteReader& oReader) : WritingElement(NULL) - { - m_bTcPrChange = false; + const CTableCellProperties& operator =(const XmlUtils::CXmlNode &oNode); + const CTableCellProperties& operator =(const XmlUtils::CXmlLiteReader& oReader); - fromXML( oReader ); - } - virtual ~CTableCellProperties() - { - } + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - const CTableCellProperties& operator =(const XmlUtils::CXmlNode &oNode) - { - fromXML( (XmlUtils::CXmlNode &)oNode ); - return *this; - } - const CTableCellProperties& operator =(const XmlUtils::CXmlLiteReader& oReader) - { - fromXML( (XmlUtils::CXmlLiteReader&)oReader ); - return *this; - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - if ( L"w:tcPr" != oNode.GetName() ) - return; + virtual std::wstring toXML() const; + virtual EElementType getType() const; - XmlUtils::CXmlNode oChild; + static const CTableCellProperties Merge(const CTableCellProperties& oPrev, const CTableCellProperties& oCurrent); - WritingElement_ReadNode( oNode, oChild, L"w:cellDel", m_oCellDel ); - WritingElement_ReadNode( oNode, oChild, L"w:cellIns", m_oCellIns ); - WritingElement_ReadNode( oNode, oChild, L"w:cellMerge", m_oCellMerge ); - WritingElement_ReadNode( oNode, oChild, L"w:cnfStyle", m_oCnfStyle ); - WritingElement_ReadNode( oNode, oChild, L"w:gridSpan", m_oGridSpan ); - WritingElement_ReadNode( oNode, oChild, L"w:headers", m_oHeaders ); - WritingElement_ReadNode( oNode, oChild, L"w:hideMark", m_oHideMark ); - - // В списке аттрибутов написано "hMerge", а в примере "hmerge" - WritingElement_ReadNode( oNode, oChild, L"w:hmerge", m_oHMerge ); - if ( !m_oHMerge.IsInit() ) - WritingElement_ReadNode( oNode, oChild, L"w:hMerge", m_oHMerge ); - - WritingElement_ReadNode( oNode, oChild, L"w:noWrap", m_oNoWrap ); - WritingElement_ReadNode( oNode, oChild, L"w:shd", m_oShd ); - WritingElement_ReadNode( oNode, oChild, L"w:tcBorders", m_oTcBorders ); - WritingElement_ReadNode( oNode, oChild, L"w:tcFitText", m_oTcFitText ); - WritingElement_ReadNode( oNode, oChild, L"w:tcMar", m_oTcMar ); - - if ( !m_bTcPrChange ) - WritingElement_ReadNode( oNode, oChild, L"w:tcPrChange", m_oTcPrChange ); - - WritingElement_ReadNode( oNode, oChild, L"w:tcW", m_oTcW ); - WritingElement_ReadNode( oNode, oChild, L"w:textDirection", m_oTextDirection ); - WritingElement_ReadNode( oNode, oChild, L"w:vAlign", m_oVAlign ); - - // В списке аттрибутов написано "vMerge", а в примере "vmerge" - WritingElement_ReadNode( oNode, oChild, L"w:vmerge", m_oVMerge ); - if ( !m_oVMerge.IsInit() ) - WritingElement_ReadNode( oNode, oChild, L"w:vMerge", m_oVMerge ); - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; - - int nParentDepth = oReader.GetDepth(); - while( oReader.ReadNextSiblingNode( nParentDepth ) ) - { - std::wstring sName = oReader.GetName(); - - if ( L"w:cellDel" == sName ) m_oCellDel = oReader; - else if ( L"w:cellIns" == sName ) m_oCellIns = oReader; - else if ( L"w:cellMerge" == sName ) m_oCellMerge = oReader; - else if ( L"w:cnfStyle" == sName ) m_oCnfStyle = oReader; - else if ( L"w:gridSpan" == sName ) m_oGridSpan = oReader; - else if ( L"w:headers" == sName ) m_oHeaders = oReader; - else if ( L"w:hideMark" == sName ) m_oHideMark = oReader; - else if ( L"w:noWrap" == sName ) m_oNoWrap = oReader; - else if ( L"w:shd" == sName ) m_oShd = oReader; - else if ( L"w:tcBorders" == sName ) m_oTcBorders = oReader; - else if ( L"w:tcFitText" == sName ) m_oTcFitText = oReader; - else if ( L"w:tcMar" == sName ) m_oTcMar = oReader; - else if ( !m_bTcPrChange && L"w:tcPrChange" == sName ) m_oTcPrChange = oReader; - else if ( L"w:tcW" == sName ) m_oTcW = oReader; - else if ( L"w:vAlign" == sName ) m_oVAlign = oReader; - - else if ( L"w:textDirection" == sName || L"w:textFlow" == sName) m_oTextDirection = oReader; - else if ( L"w:hMerge" == sName || L"w:hmerge" == sName) m_oHMerge = oReader; - else if ( L"w:vMerge" == sName || L"w:vmerge" == sName) m_oVMerge = oReader; - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = L""; - - WritingElement_WriteNode_1(L""; - - return sResult; - } - - virtual EElementType getType() const - { - return et_w_tcPr; - } - static const CTableCellProperties Merge(const CTableCellProperties& oPrev, const CTableCellProperties& oCurrent) - { - CTableCellProperties oProperties; - oProperties.m_bTcPrChange = oPrev.m_bTcPrChange || oCurrent.m_bTcPrChange; - oProperties.m_oCellDel = Merge( oPrev.m_oCellDel, oCurrent.m_oCellDel ); - oProperties.m_oCellIns = Merge( oPrev.m_oCellIns, oCurrent.m_oCellIns ); - oProperties.m_oCellMerge = Merge( oPrev.m_oCellMerge, oCurrent.m_oCellMerge ); - oProperties.m_oCnfStyle = Merge( oPrev.m_oCnfStyle, oCurrent.m_oCnfStyle ); - oProperties.m_oGridSpan = Merge( oPrev.m_oGridSpan, oCurrent.m_oGridSpan ); - oProperties.m_oHeaders = Merge( oPrev.m_oHeaders, oCurrent.m_oHeaders ); - oProperties.m_oHideMark = Merge( oPrev.m_oHideMark, oCurrent.m_oHideMark ); - oProperties.m_oHMerge = Merge( oPrev.m_oHMerge, oCurrent.m_oHMerge ); - oProperties.m_oNoWrap = Merge( oPrev.m_oNoWrap, oCurrent.m_oNoWrap ); - oProperties.m_oShd = Merge( oPrev.m_oShd, oCurrent.m_oShd ); - - if ( oCurrent.m_oTcBorders.IsInit() && oPrev.m_oTcBorders.IsInit() ) - oProperties.m_oTcBorders = OOX::Logic::CTcBorders::Merge(oPrev.m_oTcBorders.get(), oCurrent.m_oTcBorders.get()); - else - oProperties.m_oTcBorders = Merge( oPrev.m_oTcBorders, oCurrent.m_oTcBorders ); - - oProperties.m_oTcFitText = Merge( oPrev.m_oTcFitText, oCurrent.m_oTcFitText ); - - if ( oCurrent.m_oTcMar.IsInit() && oPrev.m_oTcMar.IsInit() ) - oProperties.m_oTcMar = OOX::Logic::CTcMar::Merge(oPrev.m_oTcMar.get(), oCurrent.m_oTcMar.get()); - else - oProperties.m_oTcMar = Merge( oPrev.m_oTcMar, oCurrent.m_oTcMar ); - - oProperties.m_oTcPrChange = Merge( oPrev.m_oTcPrChange, oCurrent.m_oTcPrChange ); - oProperties.m_oTcW = Merge( oPrev.m_oTcW, oCurrent.m_oTcW ); - oProperties.m_oTextDirection = Merge( oPrev.m_oTextDirection, oCurrent.m_oTextDirection ); - oProperties.m_oVAlign = Merge( oPrev.m_oVAlign, oCurrent.m_oVAlign ); - oProperties.m_oVMerge = Merge( oPrev.m_oVMerge, oCurrent.m_oVMerge ); - - return oProperties; - } template static nullable Merge(const nullable &oPrev, const nullable &oCurrent) { @@ -2123,6 +751,7 @@ namespace OOX return oResult; } + public: bool m_bTcPrChange; @@ -2147,6 +776,7 @@ namespace OOX nullable m_oVMerge; }; + } // namespace Logic } // namespace OOX diff --git a/OOXML/DocxFormat/Logic/Vml.cpp b/OOXML/DocxFormat/Logic/Vml.cpp index 168ebed57e..4f179113d2 100644 --- a/OOXML/DocxFormat/Logic/Vml.cpp +++ b/OOXML/DocxFormat/Logic/Vml.cpp @@ -52,6 +52,16 @@ namespace OOX { namespace Vml { + CVmlCommonElements::CVmlCommonElements(OOX::Document *pMain) : WritingElementWithChilds<>(pMain) + { + }; + CVmlCommonElements::~CVmlCommonElements(){} + void CVmlCommonElements::fromXML(XmlUtils::CXmlNode& oNode){} + void CVmlCommonElements::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes (oReader); + ReadElements (oReader); + } void CVmlCommonElements::CreateElement(XmlUtils::CXmlLiteReader& oReader) { OOX::Document* document = WritingElementWithChilds<>::m_pMainDocument; @@ -204,7 +214,6 @@ namespace OOX CreateElement(oReader); } } - void CVmlCommonElements::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { if ( oReader.GetAttributesCount() <= 0 ) @@ -416,7 +425,6 @@ namespace OOX if (false == m_oClipToWrap.IsInit()) m_oClipToWrap = parent->m_oClipToWrap; if (false == m_oClip.IsInit()) m_oClip = parent->m_oClip; } - std::wstring CVmlCommonElements::WriteAttributes() const { std::wstring sResult; @@ -524,9 +532,224 @@ namespace OOX { return L""; } + EElementType CVmlCommonElements::getType() const + { + return et_v_shape_elements; + } + + //-------------------------------------------------------------------------------- + // CArc 14.1.2.1 (Part4) + //-------------------------------------------------------------------------------- + CArc::CArc(OOX::Document *pMain) : CVmlCommonElements(pMain) + { + } + CArc::~CArc(){} + void CArc::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CArc::fromXML(XmlUtils::CXmlNode& oNode) + } + void CArc::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + + CVmlCommonElements::ReadAttributes( oReader ); + CVmlCommonElements::ReadElements( oReader ); + } + std::wstring CArc::toXML() const + { + std::wstring sResult = _T(""); + + sResult += CVmlCommonElements::WriteElements(); + + sResult += _T(""); + + return sResult; + } + EElementType CArc::getType() const + { + return OOX::et_v_arc; + } + void CArc::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + if ( oReader.GetAttributesCount() <= 0 ) + return; + + if ( !oReader.MoveToFirstAttribute() ) + return; + + std::wstring wsName = oReader.GetName(); + while( !wsName.empty() ) + { + wchar_t wsChar = wsName[0]; + switch ( wsChar ) + { + case 'e': + if ( _T("endangle") == wsName || _T("endAngle") == wsName ) m_oEndAngle = oReader.GetText(); + break; + + case 's': + if ( _T("startangle") == wsName || _T("startAngle") == wsName ) m_oStartAngle = oReader.GetText(); + break; + } + + if ( !oReader.MoveToNextAttribute() ) + break; + + wsName = oReader.GetName(); + } + oReader.MoveToElement(); + } + + //-------------------------------------------------------------------------------- + // CCurve 14.1.2.3 (Part4) + //-------------------------------------------------------------------------------- + CCurve::CCurve(OOX::Document *pMain) : CVmlCommonElements(pMain) + { + } + CCurve::~CCurve(){} + void CCurve::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CCurve::fromXML(XmlUtils::CXmlNode& oNode) + } + void CCurve::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + CVmlCommonElements::ReadAttributes( oReader ); + CVmlCommonElements::ReadElements( oReader ); + } + std::wstring CCurve::toXML() const + { + std::wstring sResult = _T(""); + + sResult += CVmlCommonElements::WriteElements(); + + sResult += _T(""); + + return sResult; + } + EElementType CCurve::getType() const + { + return OOX::et_v_curve; + } + void CCurve::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Читаем атрибуты + if ( oReader.GetAttributesCount() <= 0 ) + return; + + if ( !oReader.MoveToFirstAttribute() ) + return; + + std::wstring wsName = oReader.GetName(); + while( !wsName.empty() ) + { + wchar_t wsChar = wsName[0]; + switch ( wsChar ) + { + case 'c': + if ( _T("control1") == wsName ) m_oControl1 = oReader.GetText(); + else if ( _T("control2") == wsName ) m_oControl2 = oReader.GetText(); + break; + + case 'f': + if ( _T("from") == wsName ) m_oFrom = oReader.GetText(); + break; + + case 't': + if ( _T("to") == wsName ) m_oTo = oReader.GetText(); + break; + } + + if ( !oReader.MoveToNextAttribute() ) + break; + + wsName = oReader.GetName(); + } + oReader.MoveToElement(); + } + + //-------------------------------------------------------------------------------- + // CF 14.1.2.4 (Part4) + //-------------------------------------------------------------------------------- + CF::CF() + { + } + CF::~CF() + { + } + void CF::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CF::fromXML(XmlUtils::CXmlNode& oNode) + } + void CF::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CF::toXML() const + { + std::wstring sResult = _T(""); + return sResult; + } + EElementType CF::getType() const + { + return OOX::et_v_f; + } + void CF::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.GetAttributesCount() <= 0 ) + return; + + if ( !oReader.MoveToFirstAttribute() ) + return; + + std::wstring wsName = oReader.GetName(); + while( !wsName.empty() ) + { + wchar_t wsChar = wsName[0]; + switch ( wsChar ) + { + case 'e': + if ( _T("eqn") == wsName ) m_sEqn = oReader.GetText(); + break; + } + + if ( !oReader.MoveToNextAttribute() ) + break; + + wsName = oReader.GetName(); + } + oReader.MoveToElement(); + + // TO DO: Сделать парсер формул ( или использовать уже сделанный парсер в OfficeDrawing\Shapes) + } + //-------------------------------------------------------------------------------- // CGroup 14.1.2.6 (Part4) //-------------------------------------------------------------------------------- + CGroup::CGroup(OOX::Document *pMain) : CVmlCommonElements(pMain) + { + } + CGroup::~CGroup(){} + EElementType CGroup::getType() const + { + return OOX::et_v_group; + } void CGroup::fromXML(XmlUtils::CXmlNode& oNode) { } @@ -589,8 +812,6 @@ namespace OOX WritingElement_ReadAttributes_Read_else_if(oReader, L"w:editas", m_oEditAs) WritingElement_ReadAttributes_End(oReader) } - - std::wstring CGroup::toXML() const { std::wstring sResult = L""); + + sResult += CVmlCommonElements::WriteElements(); + + sResult += _T(""); + + return sResult; + } + EElementType CRect::getType() const + { + return OOX::et_v_rect; + } + + //-------------------------------------------------------------------------------- + // CRoundRect 14.1.2.17 (Part4) + //-------------------------------------------------------------------------------- + CRoundRect::CRoundRect(OOX::Document *pMain) : CVmlCommonElements(pMain) + { + } + CRoundRect::~CRoundRect(){} + void CRoundRect::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CRoundRect::fromXML(XmlUtils::CXmlNode& oNode) + } + void CRoundRect::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + CVmlCommonElements::ReadAttributes( oReader ); + CVmlCommonElements::ReadElements( oReader ); + } + std::wstring CRoundRect::toXML() const + { + std::wstring sResult = _T(""); + + return sResult; + } + EElementType CRoundRect::getType() const + { + return OOX::et_v_roundrect; + } + void CRoundRect::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Выставляем значения по умолчанию + m_oArcSize.SetPercentage( 20 ); + + // Читаем атрибуты + if ( oReader.GetAttributesCount() <= 0 ) + return; + + if ( !oReader.MoveToFirstAttribute() ) + return; + + std::wstring wsName = oReader.GetName(); + while( !wsName.empty() ) + { + wchar_t wsChar = wsName[0]; + switch ( wsChar ) + { + case 'a': + if ( _T("arcsize") == wsName ) m_oArcSize = oReader.GetText(); + break; + } + + if ( !oReader.MoveToNextAttribute() ) + break; + + wsName = oReader.GetName(); + } + oReader.MoveToElement(); + } + + //-------------------------------------------------------------------------------- + // CShadow 14.1.2.18 (Part4) + //-------------------------------------------------------------------------------- + CShadow::CShadow(OOX::Document *pMain) : WritingElement(pMain) + { + } + CShadow::~CShadow() + { + } + void CShadow::fromXML(XmlUtils::CXmlNode& oNode) + { + XmlMacroReadAttributeBase(oNode, L"on", m_oOn); + XmlMacroReadAttributeBase(oNode, L"id", m_oId); + XmlMacroReadAttributeBase(oNode, L"type", m_oType); + XmlMacroReadAttributeBase(oNode, L"color", m_oColor); + XmlMacroReadAttributeBase(oNode, L"opacity", m_oOpacity); + XmlMacroReadAttributeBase(oNode, L"offset", m_oOffset); + XmlMacroReadAttributeBase(oNode, L"origin", m_oOrigin); + XmlMacroReadAttributeBase(oNode, L"obscured", m_oObscured); + XmlMacroReadAttributeBase(oNode, L"color2", m_oColor2); + XmlMacroReadAttributeBase(oNode, L"offset2", m_oOffset2); + XmlMacroReadAttributeBase(oNode, L"matrix", m_oMatrix); + } + void CShadow::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CShadow::toXML() const + { + std::wstring sResult = _T("ToString() + _T("\" "); + + sResult += _T("offset=\"") + m_oOffset.ToString() + _T("\" "); + + if ( 203 != m_oColor2.Get_R() || 203 != m_oColor2.Get_G() || 203 != m_oColor2.Get_B() ) + sResult += _T("color2=\"") + m_oColor2.ToString() + _T("\" "); + + sResult += _T("offset2=\"") + m_oOffset2.ToString() + _T("\" "); + + if ( 0 != m_oOrigin.GetX() || 0 != m_oOrigin.GetY() ) + sResult += _T("origin=\"") + m_oOrigin.ToString() + _T("\" "); + + ComplexTypes_WriteAttribute ( _T("matrix=\""), m_oMatrix ); + + sResult += _T("/>"); + + return sResult; + } + EElementType CShadow::getType() const + { + return OOX::et_v_shadow; + } + void CShadow::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Выставляем значения по умолчанию + m_oColor.SetRGB( 128, 128, 128 ); + m_oColor2.SetRGB( 203, 203, 203 ); + m_oOffset.SetValue_Points( 2, 2 ); + m_oOffset2.SetValue_Points( -2, -2 ); + m_oOrigin.SetValue( 0, 0 ); + + if ( oReader.GetAttributesCount() <= 0 ) + return; + + if ( !oReader.MoveToFirstAttribute() ) + return; + + std::wstring wsName = oReader.GetName(); + while( !wsName.empty() ) + { + wchar_t wsChar = wsName[0]; + switch ( wsChar ) + { + case 'c': + if ( _T("color") == wsName ) m_oColor = oReader.GetText(); + else if ( _T("color2") == wsName ) m_oColor2 = oReader.GetText(); + break; + + case 'i': + if ( _T("id") == wsName ) m_oId = oReader.GetText(); + break; + + case 'm': + if ( _T("matrix") == wsName ) m_oMatrix = oReader.GetText(); + break; + + case 'o': + if ( _T("obscured") == wsName ) m_oObscured = oReader.GetText(); + else if ( _T("offset") == wsName ) m_oOffset = oReader.GetText(); + else if ( _T("offset2") == wsName ) m_oOffset2 = oReader.GetText(); + else if ( _T("on") == wsName ) m_oOn = oReader.GetText(); + else if ( _T("opacity") == wsName ) m_oOpacity = oReader.GetText(); + else if ( _T("origin") == wsName ) m_oOrigin = oReader.GetText(); + break; + + case 't': + if ( _T("type") == wsName ) m_oType = oReader.GetText(); + break; + } + + if ( !oReader.MoveToNextAttribute() ) + break; + + wsName = oReader.GetName(); + } + oReader.MoveToElement(); + } + //-------------------------------------------------------------------------------- // CShape 14.1.2.19 (Part4) //-------------------------------------------------------------------------------- + CShape::CShape(OOX::Document *pMain) : CVmlCommonElements(pMain) + { + } + CShape::~CShape(){} + void CShape::fromXML(XmlUtils::CXmlNode& oNode){} + void CShape::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + CVmlCommonElements::ReadAttributes( oReader ); + CVmlCommonElements::ReadElements( oReader ); + } + EElementType CShape::getType() const + { + return OOX::et_v_shape; + } + void CShape::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.GetAttributesCount() <= 0 ) + return; + + if ( !oReader.MoveToFirstAttribute() ) + return; + + std::wstring wsName = oReader.GetName(); + while( !wsName.empty() ) + { + wchar_t wsChar = wsName[0]; + switch ( wsChar ) + { + case 'a': + if ( _T("adj") == wsName ) m_sAdj = oReader.GetText(); + break; + case 'e': + if ( _T("equationxml") == wsName ) m_sEquationXML = oReader.GetText(); + break; + case 'o': + if ( _T("o:gfxdata") == wsName ) m_sGfxData = oReader.GetText(); + break; + case 'p': + if ( _T("path") == wsName ) m_oPath = oReader.GetText(); + break; + case 't': + if ( _T("type") == wsName ) m_sType = oReader.GetText(); + break; + } + + if ( !oReader.MoveToNextAttribute() ) + break; + + wsName = oReader.GetName(); + } + oReader.MoveToElement(); + + // TO DO: Сделать парсер Adj + } std::wstring CShape::toXML() const { std::wstring sResult = L"& aAnchor) const + { + aAnchor.clear(); + if(m_oAnchor.IsInit()) + { + std::vector arSplit; + boost::algorithm::split(arSplit, m_oAnchor.get(), boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on); + for (size_t i = 0 ; i < arSplit.size(); i++) + { + aAnchor.push_back(XmlUtils::GetInteger(arSplit[i])); + } + } + } + void CClientData::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_Read_if ( oReader, _T("ObjectType"), m_oObjectType ) + WritingElement_ReadAttributes_End( oReader ) + } void CClientData::fromXML(XmlUtils::CXmlNode& oNode) { // TO DO: Реализовать CShapeType::fromXML(XmlUtils::CXmlNode& oNode) @@ -997,6 +1625,24 @@ namespace OOX if (!pFormControlPr->m_oVerticalBar.IsInit()) pFormControlPr->m_oVerticalBar = m_oVScroll; if (!pFormControlPr->m_oPasswordEdit.IsInit()) pFormControlPr->m_oPasswordEdit = m_oSecretEdit; } + + //-------------------------------------------------------------------------------- + // CTextbox 14.1.2.22 (Part4) + //-------------------------------------------------------------------------------- + CTextbox::CTextbox(OOX::Document *pMain) : WritingElement(pMain) + { + } + CTextbox::~CTextbox() + { + } + void CTextbox::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CTextbox::fromXML(XmlUtils::CXmlNode& oNode) + } + EElementType CTextbox::getType() const + { + return OOX::et_v_textbox; + } void CTextbox::fromXML(XmlUtils::CXmlLiteReader& oReader) { ReadAttributes( oReader ); @@ -1092,6 +1738,132 @@ namespace OOX } oReader.MoveToElement(); } + + //-------------------------------------------------------------------------------- + // CTextPath 14.1.2.23 (Part4) + //-------------------------------------------------------------------------------- + CTextPath::CTextPath(OOX::Document *pMain) : WritingElement(pMain) + { + } + CTextPath::~CTextPath() + { + } + void CTextPath::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CTextPath::fromXML(XmlUtils::CXmlNode& oNode) + } + void CTextPath::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + + m_sStringOriginal = oReader.GetText2(); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + std::wstring CTextPath::toXML() const + { + std::wstring sResult = _T("GetValue()) ) + sResult += _T("on=\"true\" "); + + if ( (m_oFitShape.IsInit()) && ( SimpleTypes::booleanFalse != m_oFitShape->GetValue()) ) + sResult += _T("fitshape=\"true\" "); + + if ( (m_oFitPath.IsInit()) && ( SimpleTypes::booleanFalse != m_oFitPath->GetValue()) ) + sResult += _T("fitpath=\"true\" "); + + if ( (m_oTrim.IsInit()) && ( SimpleTypes::booleanFalse != m_oTrim->GetValue()) ) + sResult += _T("trim=\"true\" "); + + if ( (m_oXScale.IsInit()) && ( SimpleTypes::booleanFalse != m_oXScale->GetValue()) ) + sResult += _T("xscale=\"true\" "); + + ComplexTypes_WriteAttribute3( _T("string=\""), m_sString ); + + sResult += _T("/>"); + return sResult; + } + EElementType CTextPath::getType() const + { + return OOX::et_v_textpath; + } + void CTextPath::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.GetAttributesCount() <= 0 ) + return; + + if ( !oReader.MoveToFirstAttribute() ) + return; + + std::wstring wsName = oReader.GetName(); + while( !wsName.empty() ) + { + wchar_t wsChar = wsName[0]; + switch ( wsChar ) + { + case 'f': + if ( _T("fitpath") == wsName ) m_oFitPath = oReader.GetText(); + else if ( _T("fitshape") == wsName ) m_oFitShape = oReader.GetText(); + break; + case 'i': + if ( _T("id") == wsName ) m_oId = oReader.GetText(); + break; + case 'o': + if ( _T("on") == wsName ) m_oOn = oReader.GetText(); + break; + case 's': + if ( _T("string") == wsName ) m_sString = oReader.GetText(); + else if ( _T("style") == wsName ) m_oStyle = oReader.GetText(); + break; + case 't': + if ( _T("trim") == wsName ) m_oTrim = oReader.GetText(); + break; + case 'x': + if ( _T("xscale") == wsName ) m_oXScale = oReader.GetText(); + break; + } + + if ( !oReader.MoveToNextAttribute() ) + break; + + wsName = oReader.GetName(); + } + oReader.MoveToElement(); + } + + //-------------------------------------------------------------------------------- + // CFill 14.1.2.5 (Part4) + //-------------------------------------------------------------------------------- + CFill::CFill(OOX::Document *pMain) : WritingElement(pMain) + { + } + CFill::~CFill() + { + } + void CFill::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CFill::fromXML(XmlUtils::CXmlNode& oNode) + } + void CFill::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + + if ( oReader.IsEmptyNode() ) + return; + + int nCurDepth = oReader.GetDepth(); + while ( oReader.ReadNextSiblingNode( nCurDepth ) ) + { + std::wstring sName = oReader.GetName(); + if ( _T("o:fill") == sName ) + m_oFill = oReader; + } + } void CFill::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { std::wstring sColors; @@ -1177,9 +1949,6 @@ namespace OOX // TO DO: сделать парсер цветов CFill::m_arrColors } - - - std::wstring CFill::toXML() const { std::wstring sResult = L""); + + sResult += CVmlCommonElements::WriteElements(); + + sResult += _T(""); + + return sResult; + } + EElementType CBackground::getType() const + { + return OOX::et_v_background; + } + void CBackground::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + WritingElement_ReadAttributes_Start( oReader ) + WritingElement_ReadAttributes_ReadSingle( oReader, _T("o:targetscreensize"), m_oTargetScreenSize) + WritingElement_ReadAttributes_End( oReader ) + } + + //-------------------------------------------------------------------------------- + // CFormulas 14.1.2.6 (Part4) + //-------------------------------------------------------------------------------- + CFormulas::CFormulas(OOX::Document *pMain) : WritingElementWithChilds(pMain) + { + } + CFormulas::~CFormulas() + { + } + void CFormulas::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CFormulas::fromXML(XmlUtils::CXmlNode& oNode) + } + void CFormulas::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + + int nCurDepth = oReader.GetDepth(); + while ( oReader.ReadNextSiblingNode( nCurDepth ) ) + { + std::wstring sName = oReader.GetName(); + if ( _T("v:f") == sName ) + { + OOX::Vml::CF *oF = new OOX::Vml::CF(oReader); + if (oF) m_arrItems.push_back( oF ); + } + } + } + std::wstring CFormulas::toXML() const + { + std::wstring sResult = _T(""); + + for ( size_t i = 0; i < m_arrItems.size(); ++i) + { + if ( m_arrItems[i] ) + { + sResult += m_arrItems[i]->toXML(); + } + } + + sResult += _T(""); + + return sResult; + } + EElementType CFormulas::getType() const + { + return OOX::et_v_formulas; + } + + //-------------------------------------------------------------------------------- + // CStroke 14.1.2.21 (Part4) + //-------------------------------------------------------------------------------- + CStroke::CStroke(OOX::Document *pMain) : WritingElement(pMain) + { + } + CStroke::~CStroke() + { + } + void CStroke::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CStroke::fromXML(XmlUtils::CXmlNode& oNode) + } + void CStroke::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + + if ( oReader.IsEmptyNode() ) + return; + + int nCurDepth = oReader.GetDepth(); + while ( oReader.ReadNextSiblingNode( nCurDepth ) ) + { + std::wstring sName = oReader.GetName(); + + if ( _T("o:left") == sName ) + m_oLeft = oReader; + else if ( _T("o:top") == sName ) + m_oTop = oReader; + else if ( _T("o:right") == sName ) + m_oRight = oReader; + else if ( _T("o:bottom") == sName ) + m_oBottom = oReader; + else if ( _T("o:column") == sName ) + m_oColumn = oReader; + } + } + EElementType CStroke::getType() const + { + return OOX::et_v_stroke; + } void CStroke::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { if ( oReader.GetAttributesCount() <= 0 ) @@ -1328,7 +2240,6 @@ namespace OOX // TO DO: Сделать парсер формул ( или использовать уже сделанный парсер в OfficeDrawing\Shapes) } - std::wstring CStroke::toXML() const { std::wstring sResult = L"ToString() + L"\""; + + if ( m_pCropTop.IsInit()) + sResult += L" croptop=\"" + m_pCropTop->ToString() + L"\""; + + if ( m_pCropRight.IsInit()) + sResult += L"cropright=\"" + m_pCropRight->ToString() + L"\""; + + if ( m_pCropBottom.IsInit()) + sResult += L" cropbottom=\"" + m_pCropBottom->ToString() + L"\""; + + if ( m_pGain.IsInit() ) + sResult += L" gain=\"" + std::to_wstring(*m_pGain) + L"\""; + + if ( m_pBlackLevel.IsInit() ) + sResult += L" blacklevel=\"" + std::to_wstring(*m_pBlackLevel) + L"\""; + + if ( m_pGamma.IsInit()) + sResult += L" gamma=\"" + std::to_wstring(*m_pGamma) + L"\""; + + if ( m_pGrayscale.IsInit() && m_pGrayscale->GetBool()) + sResult += L" grayscale=\"t\""; + + if (m_pBiLevel.IsInit() && m_pBiLevel->GetBool() ) + sResult += L" bilevel=\"t\""; + + sResult += L">"; + + sResult += CVmlCommonElements::WriteElements(); + + sResult += L""; + + return sResult; + } + + //-------------------------------------------------------------------------------- + // CImageData 14.1.2.11 (Part4) + //-------------------------------------------------------------------------------- + CImageData::CImageData(OOX::Document *pMain) : WritingElement(pMain) + { + } + CImageData::~CImageData() + { + } + void CImageData::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CImageData::fromXML(XmlUtils::CXmlNode& oNode) + } + void CImageData::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + EElementType CImageData::getType() const + { + return OOX::et_v_imagedata; + } + void CImageData::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.GetAttributesCount() <= 0 ) + return; + + if ( !oReader.MoveToFirstAttribute() ) + return; + std::wstring wsName = oReader.GetName(); while( !wsName.empty() ) { @@ -1643,7 +2714,7 @@ namespace OOX wsName = oReader.GetName(); } oReader.MoveToElement(); - + CDocxFlat* docx_flat = dynamic_cast(m_pMainDocument); if (m_sSrc.IsInit()) { @@ -1667,7 +2738,6 @@ namespace OOX m_sSrc.reset(); } } - std::wstring CImageData::toXML() const { std::wstring sResult = L"ToString() + L"\""; - - if ( m_pCropTop.IsInit()) - sResult += L" croptop=\"" + m_pCropTop->ToString() + L"\""; - - if ( m_pCropRight.IsInit()) - sResult += L"cropright=\"" + m_pCropRight->ToString() + L"\""; - - if ( m_pCropBottom.IsInit()) - sResult += L" cropbottom=\"" + m_pCropBottom->ToString() + L"\""; - - if ( m_pGain.IsInit() ) - sResult += L" gain=\"" + std::to_wstring(*m_pGain) + L"\""; - - if ( m_pBlackLevel.IsInit() ) - sResult += L" blacklevel=\"" + std::to_wstring(*m_pBlackLevel) + L"\""; - - if ( m_pGamma.IsInit()) - sResult += L" gamma=\"" + std::to_wstring(*m_pGamma) + L"\""; - - if ( m_pGrayscale.IsInit() && m_pGrayscale->GetBool()) - sResult += L" grayscale=\"t\""; - - if (m_pBiLevel.IsInit() && m_pBiLevel->GetBool() ) - sResult += L" bilevel=\"t\""; - - sResult += L">"; + sResult += _T("from=\"") + m_oFrom.ToString() + _T("\" "); + sResult += _T("to=\"") + m_oTo.ToString() + _T("\">"); sResult += CVmlCommonElements::WriteElements(); - sResult += L""; + sResult += _T(""); return sResult; } + EElementType CLine::getType() const + { + return OOX::et_v_line; + } + void CLine::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) + { + // Выставляем значения по умолчанию + m_oFrom.SetValue( 0, 0 ); + m_oTo.SetValue( 10, 10 ); + + // Читаем атрибуты + if ( oReader.GetAttributesCount() <= 0 ) + return; + + if ( !oReader.MoveToFirstAttribute() ) + return; + + std::wstring wsName = oReader.GetName(); + while( !wsName.empty() ) + { + wchar_t wsChar = wsName[0]; + switch ( wsChar ) + { + case 'f': + if ( _T("from") == wsName ) m_oFrom = oReader.GetText(); + break; + + case 't': + if ( _T("to") == wsName ) m_oTo = oReader.GetText(); + break; + } + + if ( !oReader.MoveToNextAttribute() ) + break; + + wsName = oReader.GetName(); + } + oReader.MoveToElement(); + } + + //-------------------------------------------------------------------------------- + // COval 14.1.2.13 (Part4) + //-------------------------------------------------------------------------------- + + COval::COval(OOX::Document *pMain) : CVmlCommonElements(pMain) + { + } + COval::~COval(){} + void COval::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать COval::fromXML(XmlUtils::CXmlNode& oNode) + } + void COval::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + CVmlCommonElements::ReadAttributes( oReader ); + CVmlCommonElements::ReadElements( oReader ); + } + std::wstring COval::toXML() const + { + std::wstring sResult = _T(""); + + sResult += CVmlCommonElements::WriteElements(); + + sResult += _T(""); + + return sResult; + } + EElementType COval::getType() const + { + return OOX::et_v_oval; + } + + //-------------------------------------------------------------------------------- + // CH 14.1.2.8 (Part4) + //-------------------------------------------------------------------------------- + CH::CH() + { + } + CH::~CH() + { + } + void CH::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CH::fromXML(XmlUtils::CXmlNode& oNode) + } + void CH::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + ReadAttributes( oReader ); + + if ( !oReader.IsEmptyNode() ) + oReader.ReadTillEnd(); + } + EElementType CH::getType() const + { + return OOX::et_v_h; + } void CH::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) { if ( oReader.GetAttributesCount() <= 0 ) @@ -1858,7 +2972,6 @@ namespace OOX } oReader.MoveToElement(); } - std::wstring CH::toXML() const { std::wstring sResult = L"(pMain) + { + } + CHandles::~CHandles() + { + } + void CHandles::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CHandles::fromXML(XmlUtils::CXmlNode& oNode) + } + void CHandles::fromXML(XmlUtils::CXmlLiteReader& oReader) + { + if ( oReader.IsEmptyNode() ) + return; + int nCurDepth = oReader.GetDepth(); + while ( oReader.ReadNextSiblingNode( nCurDepth ) ) + { + std::wstring sName = oReader.GetName(); + if ( _T("v:h") == sName ) + { + OOX::Vml::CH *oH = new OOX::Vml::CH(oReader); + if (oH) m_arrItems.push_back( oH ); + } + } + } + std::wstring CHandles::toXML() const + { + std::wstring sResult = _T(""); + + for ( size_t i = 0; i < m_arrItems.size(); ++i) + { + if ( m_arrItems[i] ) + { + sResult += m_arrItems[i]->toXML(); + } + } + sResult += _T(""); + + return sResult; + } + EElementType CHandles::getType() const + { + return OOX::et_v_handles; + } } // Vml namespace VmlOffice { + CShapeDefaults::CShapeDefaults(OOX::Document *pMain) : WritingElement(pMain) + { + } + CShapeDefaults::~CShapeDefaults() + { + } + void CShapeDefaults::fromXML(XmlUtils::CXmlNode& oNode) + { + // TO DO: Реализовать CShapeDefaults::fromXML(XmlUtils::CXmlNode& oNode) + } void CShapeDefaults::fromXML(XmlUtils::CXmlLiteReader& oReader) { ReadAttributes( oReader ); @@ -1971,9 +3141,6 @@ namespace OOX } oReader.MoveToElement(); } - - - std::wstring CShapeDefaults::toXML() const { std::wstring sResult = L"(pMain) - { - } - - virtual ~CVmlCommonElements(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode){} - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes (oReader); - ReadElements (oReader); - } + CVmlCommonElements(OOX::Document *pMain = NULL); + virtual ~CVmlCommonElements(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return et_v_shape_elements; - } + virtual EElementType getType() const; + virtual void mergeFrom(CVmlCommonElements* parent); void CreateElement(XmlUtils::CXmlLiteReader& oReader); @@ -156,79 +149,24 @@ namespace OOX { public: WritingElement_AdditionConstructors(CArc) - CArc(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CArc(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CArc::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - sResult += CVmlCommonElements::WriteElements(); - - sResult += _T(""); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_arc; - } + virtual std::wstring toXML() const; + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar = wsName[0]; - switch ( wsChar ) - { - case 'e': - if ( _T("endangle") == wsName || _T("endAngle") == wsName ) m_oEndAngle = oReader.GetText(); - break; - - case 's': - if ( _T("startangle") == wsName || _T("startAngle") == wsName ) m_oStartAngle = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: SimpleTypes::CDecimalNumber m_oEndAngle = 90; SimpleTypes::CDecimalNumber m_oStartAngle; }; + //-------------------------------------------------------------------------------- // CCurve 14.1.2.3 (Part4) //-------------------------------------------------------------------------------- @@ -236,88 +174,26 @@ namespace OOX { public: WritingElement_AdditionConstructors(CCurve) - CCurve(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CCurve(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CCurve::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - sResult += CVmlCommonElements::WriteElements(); - - sResult += _T(""); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_curve; - } + virtual std::wstring toXML() const; + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Читаем атрибуты - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar = wsName[0]; - switch ( wsChar ) - { - case 'c': - if ( _T("control1") == wsName ) m_oControl1 = oReader.GetText(); - else if ( _T("control2") == wsName ) m_oControl2 = oReader.GetText(); - break; - - case 'f': - if ( _T("from") == wsName ) m_oFrom = oReader.GetText(); - break; - - case 't': - if ( _T("to") == wsName ) m_oTo = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: SimpleTypes::Vml::CVml_Vector2D_Units m_oFrom; SimpleTypes::Vml::CVml_Vector2D_Units m_oControl1; SimpleTypes::Vml::CVml_Vector2D_Units m_oControl2; SimpleTypes::Vml::CVml_Vector2D_Units m_oTo; - }; + //-------------------------------------------------------------------------------- // CF 14.1.2.4 (Part4) //-------------------------------------------------------------------------------- @@ -325,70 +201,24 @@ namespace OOX { public: WritingElement_AdditionConstructors(CF) - CF() - { - } - virtual ~CF() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CF::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_f; - } + CF(); + virtual ~CF(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + + virtual std::wstring toXML() const; + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar = wsName[0]; - switch ( wsChar ) - { - case 'e': - if ( _T("eqn") == wsName ) m_sEqn = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - - // TO DO: Сделать парсер формул ( или использовать уже сделанный парсер в OfficeDrawing\Shapes) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - // Attributes std::wstring m_sEqn; - }; + //-------------------------------------------------------------------------------- // CFill 14.1.2.5 (Part4) //-------------------------------------------------------------------------------- @@ -396,43 +226,20 @@ namespace OOX { public: WritingElement_AdditionConstructors(CFill) - CFill(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - } - virtual ~CFill() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CFill::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - if ( oReader.IsEmptyNode() ) - return; + CFill(OOX::Document *pMain = NULL); + virtual ~CFill(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - int nCurDepth = oReader.GetDepth(); - while ( oReader.ReadNextSiblingNode( nCurDepth ) ) - { - std::wstring sName = oReader.GetName(); - if ( _T("o:fill") == sName ) - m_oFill = oReader; - } - } virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_fill; - } + virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - typedef struct TIntermediateColor { double dValue; @@ -470,6 +277,7 @@ namespace OOX nullable m_oFill; }; + //-------------------------------------------------------------------------------- // CBackground 14.1.2.2 (Part4) //-------------------------------------------------------------------------------- @@ -477,60 +285,24 @@ namespace OOX { public: WritingElement_AdditionConstructors(CBackground) - CBackground(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CBackground() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CBackground::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); + CBackground(OOX::Document *pMain = NULL); + virtual ~CBackground(); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); - - sResult += CVmlCommonElements::WriteElements(); - - sResult += _T(""); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_background; - } + virtual std::wstring toXML() const; + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_ReadSingle( oReader, _T("o:targetscreensize"), m_oTargetScreenSize) - WritingElement_ReadAttributes_End( oReader ) - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - - // Attributes + // Attributes nullable m_oTargetScreenSize; - }; + //-------------------------------------------------------------------------------- // CFormulas 14.1.2.6 (Part4) //-------------------------------------------------------------------------------- @@ -538,59 +310,18 @@ namespace OOX { public: WritingElement_AdditionConstructors(CFormulas) - CFormulas(OOX::Document *pMain = NULL) : WritingElementWithChilds(pMain) - { - } - virtual ~CFormulas() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CFormulas::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; + CFormulas(OOX::Document *pMain = NULL); + virtual ~CFormulas(); - int nCurDepth = oReader.GetDepth(); - while ( oReader.ReadNextSiblingNode( nCurDepth ) ) - { - std::wstring sName = oReader.GetName(); - if ( _T("v:f") == sName ) - { - OOX::Vml::CF *oF = new OOX::Vml::CF(oReader); - if (oF) m_arrItems.push_back( oF ); - } - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); - - for ( size_t i = 0; i < m_arrItems.size(); ++i) - { - if ( m_arrItems[i] ) - { - sResult += m_arrItems[i]->toXML(); - } - } - - sResult += _T(""); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_formulas; - } + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; + virtual EElementType getType() const; public: - // Childs - }; //-------------------------------------------------------------------------------- @@ -600,37 +331,21 @@ namespace OOX { public: WritingElement_AdditionConstructors(CH) - CH() - { - } - virtual ~CH() - { - } + + CH(); + virtual ~CH(); public: + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CH::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_h; - } + virtual EElementType getType() const; private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - // Attributes SimpleTypes::CTrueFalse m_oInvX; SimpleTypes::CTrueFalse m_oInvY; @@ -642,6 +357,7 @@ namespace OOX SimpleTypes::Vml::CVml_Vector2D m_oXRange; SimpleTypes::Vml::CVml_Vector2D m_oYRange; }; + //-------------------------------------------------------------------------------- // CHandles 14.1.2.9 (Part4) //-------------------------------------------------------------------------------- @@ -649,58 +365,20 @@ namespace OOX { public: WritingElement_AdditionConstructors(CHandles) - CHandles(OOX::Document *pMain = NULL) : WritingElementWithChilds(pMain) - { - } - virtual ~CHandles() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CHandles::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.IsEmptyNode() ) - return; - int nCurDepth = oReader.GetDepth(); - while ( oReader.ReadNextSiblingNode( nCurDepth ) ) - { - std::wstring sName = oReader.GetName(); - if ( _T("v:h") == sName ) - { - OOX::Vml::CH *oH = new OOX::Vml::CH(oReader); - if (oH) m_arrItems.push_back( oH ); - } - } - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); + CHandles(OOX::Document *pMain = NULL); + virtual ~CHandles(); - for ( size_t i = 0; i < m_arrItems.size(); ++i) - { - if ( m_arrItems[i] ) - { - sResult += m_arrItems[i]->toXML(); - } - } - sResult += _T(""); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_handles; - } + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; + virtual EElementType getType() const; public: - // Childs - }; + //-------------------------------------------------------------------------------- // CImage 14.1.2.10 (Part4) //-------------------------------------------------------------------------------- @@ -708,28 +386,19 @@ namespace OOX { public: WritingElement_AdditionConstructors(CImage) - CImage(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CImage(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CImage::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); - } + + CImage(OOX::Document *pMain = NULL); + virtual ~CImage(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_image; - } + virtual EElementType getType() const; private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable_string m_pSrc; nullable m_pCropLeft; @@ -742,6 +411,7 @@ namespace OOX nullable m_pGrayscale; nullable m_pBiLevel; }; + //-------------------------------------------------------------------------------- // CImageData 14.1.2.11 (Part4) //-------------------------------------------------------------------------------- @@ -749,32 +419,19 @@ namespace OOX { public: WritingElement_AdditionConstructors(CImageData) - CImageData(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - } - virtual ~CImageData() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CImageData::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } + CImageData(OOX::Document *pMain = NULL); + virtual ~CImageData(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_imagedata; - } + virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); + public: nullable_string m_sAltHref; nullable m_oBiLevel; @@ -801,6 +458,7 @@ namespace OOX nullable_string m_sSrc; nullable_string m_sTitle; }; + //-------------------------------------------------------------------------------- // CLine 14.1.2.12 (Part4) //-------------------------------------------------------------------------------- @@ -808,86 +466,25 @@ namespace OOX { public: WritingElement_AdditionConstructors(CLine) - CLine(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CLine(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CLine::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); - - sResult += CVmlCommonElements::WriteElements(); - - sResult += _T(""); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_line; - } + virtual std::wstring toXML() const; + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Выставляем значения по умолчанию - m_oFrom.SetValue( 0, 0 ); - m_oTo.SetValue( 10, 10 ); - - // Читаем атрибуты - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar = wsName[0]; - switch ( wsChar ) - { - case 'f': - if ( _T("from") == wsName ) m_oFrom = oReader.GetText(); - break; - - case 't': - if ( _T("to") == wsName ) m_oTo = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - // Attributes SimpleTypes::Vml::CVml_Vector2D_Units m_oFrom; SimpleTypes::Vml::CVml_Vector2D_Units m_oTo; - }; + //-------------------------------------------------------------------------------- // COval 14.1.2.13 (Part4) //-------------------------------------------------------------------------------- @@ -895,40 +492,17 @@ namespace OOX { public: WritingElement_AdditionConstructors(COval) - COval(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~COval(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать COval::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); - - sResult += CVmlCommonElements::WriteElements(); - - sResult += _T(""); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_oval; - } + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; + virtual EElementType getType() const; }; + //-------------------------------------------------------------------------------- // CPath 14.1.2.14 (Part4) //-------------------------------------------------------------------------------- @@ -936,28 +510,15 @@ namespace OOX { public: WritingElement_AdditionConstructors(CPath) - CPath(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - } - virtual ~CPath() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CPath::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } + CPath(OOX::Document *pMain = NULL); + virtual ~CPath(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_path; - } + virtual EElementType getType() const; private: void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); @@ -979,6 +540,7 @@ namespace OOX nullable m_oTextPathOk; nullable m_oV; }; + //-------------------------------------------------------------------------------- // CPolyLine 14.1.2.15 (Part4) //-------------------------------------------------------------------------------- @@ -986,62 +548,24 @@ namespace OOX { public: WritingElement_AdditionConstructors(CPolyLine) - CPolyLine(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CPolyLine(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode){} - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); - } - virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_polyline; - } + + CPolyLine(OOX::Document *pMain = NULL); + virtual ~CPolyLine(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + + virtual std::wstring toXML() const; + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Выставляем значения по умолчанию - m_oPoints.SetDelimiter( ' ' ); - - // Читаем атрибуты - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar = wsName[0]; - switch ( wsChar ) - { - case 'p': - if ( _T("points") == wsName ) m_oPoints = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - // Attributes SimpleTypes::Vml::CVml_Polygon2D_Units m_oPoints; - }; + //-------------------------------------------------------------------------------- // CRect 14.1.2.16 (Part4) //-------------------------------------------------------------------------------- @@ -1049,40 +573,18 @@ namespace OOX { public: WritingElement_AdditionConstructors(CRect) - CRect(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CRect(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CRect::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); - - sResult += CVmlCommonElements::WriteElements(); - - sResult += _T(""); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_rect; - } + virtual std::wstring toXML() const; + virtual EElementType getType() const; }; + //-------------------------------------------------------------------------------- // CRoundRect 14.1.2.17 (Part4) //-------------------------------------------------------------------------------- @@ -1090,77 +592,23 @@ namespace OOX { public: WritingElement_AdditionConstructors(CRoundRect) - CRoundRect(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CRoundRect(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CRoundRect::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T(""); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_roundrect; - } + virtual std::wstring toXML() const; + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Выставляем значения по умолчанию - m_oArcSize.SetPercentage( 20 ); - - // Читаем атрибуты - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar = wsName[0]; - switch ( wsChar ) - { - case 'a': - if ( _T("arcsize") == wsName ) m_oArcSize = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: - SimpleTypes::Vml::CVml_1_65536_Or_Percentage m_oArcSize; - }; + //-------------------------------------------------------------------------------- // CShadow 14.1.2.18 (Part4) //-------------------------------------------------------------------------------- @@ -1168,132 +616,18 @@ namespace OOX { public: WritingElement_AdditionConstructors(CShadow) - CShadow(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - } - virtual ~CShadow() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - XmlMacroReadAttributeBase(oNode, L"on", m_oOn); - XmlMacroReadAttributeBase(oNode, L"id", m_oId); - XmlMacroReadAttributeBase(oNode, L"type", m_oType); - XmlMacroReadAttributeBase(oNode, L"color", m_oColor); - XmlMacroReadAttributeBase(oNode, L"opacity", m_oOpacity); - XmlMacroReadAttributeBase(oNode, L"offset", m_oOffset); - XmlMacroReadAttributeBase(oNode, L"origin", m_oOrigin); - XmlMacroReadAttributeBase(oNode, L"obscured", m_oObscured); - XmlMacroReadAttributeBase(oNode, L"color2", m_oColor2); - XmlMacroReadAttributeBase(oNode, L"offset2", m_oOffset2); - XmlMacroReadAttributeBase(oNode, L"matrix", m_oMatrix); - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T("ToString() + _T("\" "); - - sResult += _T("offset=\"") + m_oOffset.ToString() + _T("\" "); - - if ( 203 != m_oColor2.Get_R() || 203 != m_oColor2.Get_G() || 203 != m_oColor2.Get_B() ) - sResult += _T("color2=\"") + m_oColor2.ToString() + _T("\" "); - - sResult += _T("offset2=\"") + m_oOffset2.ToString() + _T("\" "); - - if ( 0 != m_oOrigin.GetX() || 0 != m_oOrigin.GetY() ) - sResult += _T("origin=\"") + m_oOrigin.ToString() + _T("\" "); - - ComplexTypes_WriteAttribute ( _T("matrix=\""), m_oMatrix ); - - sResult += _T("/>"); - - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_shadow; - } + virtual std::wstring toXML() const; + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - // Выставляем значения по умолчанию - m_oColor.SetRGB( 128, 128, 128 ); - m_oColor2.SetRGB( 203, 203, 203 ); - m_oOffset.SetValue_Points( 2, 2 ); - m_oOffset2.SetValue_Points( -2, -2 ); - m_oOrigin.SetValue( 0, 0 ); - - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar = wsName[0]; - switch ( wsChar ) - { - case 'c': - if ( _T("color") == wsName ) m_oColor = oReader.GetText(); - else if ( _T("color2") == wsName ) m_oColor2 = oReader.GetText(); - break; - - case 'i': - if ( _T("id") == wsName ) m_oId = oReader.GetText(); - break; - - case 'm': - if ( _T("matrix") == wsName ) m_oMatrix = oReader.GetText(); - break; - - case 'o': - if ( _T("obscured") == wsName ) m_oObscured = oReader.GetText(); - else if ( _T("offset") == wsName ) m_oOffset = oReader.GetText(); - else if ( _T("offset2") == wsName ) m_oOffset2 = oReader.GetText(); - else if ( _T("on") == wsName ) m_oOn = oReader.GetText(); - else if ( _T("opacity") == wsName ) m_oOpacity = oReader.GetText(); - else if ( _T("origin") == wsName ) m_oOrigin = oReader.GetText(); - break; - - case 't': - if ( _T("type") == wsName ) m_oType = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: SimpleTypes::CColorType m_oColor = SimpleTypes::colortypeRGB; @@ -1308,6 +642,7 @@ namespace OOX SimpleTypes::Vml::CVml_Vector2D_Percentage m_oOrigin; SimpleTypes::CShadowType m_oType; }; + //-------------------------------------------------------------------------------- // CShapeType 14.1.2.20 (Part4) //-------------------------------------------------------------------------------- @@ -1315,61 +650,18 @@ namespace OOX { public: WritingElement_AdditionConstructors(CShapeType) - CShapeType(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CShapeType() {} - virtual void fromXML(XmlUtils::CXmlNode& oNode) {} - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes(oReader); - CVmlCommonElements::ReadAttributes(oReader); - CVmlCommonElements::ReadElements(oReader); - } + + CShapeType(OOX::Document *pMain = NULL); + virtual ~CShapeType(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_shapetype; - } + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - if (oReader.GetAttributesCount() <= 0) - return; - if (!oReader.MoveToFirstAttribute()) - return; - - std::wstring wsName = oReader.GetName(); - while (!wsName.empty()) - { - wchar_t wsChar = wsName[0]; - switch (wsChar) - { - case 'o': - if (_T("o:master") == wsName) m_oMaster = oReader.GetText(); - break; - case 'p': - if (_T("path") == wsName) m_oPath = oReader.GetText(); - break; - case 'a': - if (_T("adj") == wsName) m_sAdj = oReader.GetText(); - break; - case 't': - if (_T("type") == wsName) m_sType = oReader.GetText(); // для некоторых багнутых файлов - break; - } - - if (!oReader.MoveToNextAttribute()) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - - // TO DO: Сделать парсер Adj - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: nullable_string m_sType; @@ -1377,6 +669,7 @@ namespace OOX nullable m_oPath; nullable_bool m_oMaster; }; + //-------------------------------------------------------------------------------- // CShape 14.1.2.19 (Part4) //-------------------------------------------------------------------------------- @@ -1384,67 +677,20 @@ namespace OOX { public: WritingElement_AdditionConstructors(CShape) - CShape(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CShape(){} - virtual void fromXML(XmlUtils::CXmlNode& oNode){} - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - CVmlCommonElements::ReadAttributes( oReader ); - CVmlCommonElements::ReadElements( oReader ); - } + CShape(OOX::Document *pMain = NULL); + virtual ~CShape(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_shape; - } + virtual EElementType getType() const; void mergeFrom(CShapeType* shape_type); + private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar = wsName[0]; - switch ( wsChar ) - { - case 'a': - if ( _T("adj") == wsName ) m_sAdj = oReader.GetText(); - break; - case 'e': - if ( _T("equationxml") == wsName ) m_sEquationXML = oReader.GetText(); - break; - case 'o': - if ( _T("o:gfxdata") == wsName ) m_sGfxData = oReader.GetText(); - break; - case 'p': - if ( _T("path") == wsName ) m_oPath = oReader.GetText(); - break; - case 't': - if ( _T("type") == wsName ) m_sType = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - - // TO DO: Сделать парсер Adj - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: nullable_string m_sType; @@ -1453,44 +699,27 @@ namespace OOX nullable_string m_sGfxData; nullable_string m_sEquationXML; }; + class CClientData : public WritingElement { public: WritingElement_AdditionConstructors(CClientData) - CClientData(OOX::Document *pMain = NULL) : WritingElement(pMain) {} - virtual ~CClientData() {} + + CClientData(OOX::Document *pMain = NULL); + virtual ~CClientData(); virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_ClientData; - } - - void getAnchorArray(std::vector& aAnchor) const - { - aAnchor.clear(); - if(m_oAnchor.IsInit()) - { - std::vector arSplit; - boost::algorithm::split(arSplit, m_oAnchor.get(), boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on); - for (size_t i = 0 ; i < arSplit.size(); i++) - { - aAnchor.push_back(XmlUtils::GetInteger(arSplit[i])); - } - } - } + virtual EElementType getType() const; + + void getAnchorArray(std::vector& aAnchor) const; + bool toCellAnchor(OOX::Spreadsheet::CCellAnchor* pCellAnchor); void toFormControlPr(OOX::Spreadsheet::CFormControlPr* pFormControlPr); - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - WritingElement_ReadAttributes_Start( oReader ) - WritingElement_ReadAttributes_Read_if ( oReader, _T("ObjectType"), m_oObjectType ) - WritingElement_ReadAttributes_End( oReader ) - } - + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); nullable m_oObjectType; @@ -1564,6 +793,7 @@ namespace OOX //x:ValidIds //x:VTEdit }; + //-------------------------------------------------------------------------------- // CStroke 14.1.2.21 (Part4) //-------------------------------------------------------------------------------- @@ -1571,48 +801,17 @@ namespace OOX { public: WritingElement_AdditionConstructors(CStroke) - CStroke(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - } - virtual ~CStroke() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CStroke::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - if ( oReader.IsEmptyNode() ) - return; + CStroke(OOX::Document *pMain = NULL); + virtual ~CStroke(); - int nCurDepth = oReader.GetDepth(); - while ( oReader.ReadNextSiblingNode( nCurDepth ) ) - { - std::wstring sName = oReader.GetName(); + virtual void fromXML(XmlUtils::CXmlNode& oNode); + virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); - if ( _T("o:left") == sName ) - m_oLeft = oReader; - else if ( _T("o:top") == sName ) - m_oTop = oReader; - else if ( _T("o:right") == sName ) - m_oRight = oReader; - else if ( _T("o:bottom") == sName ) - m_oBottom = oReader; - else if ( _T("o:column") == sName ) - m_oColumn = oReader; - } - } virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_stroke; - } + virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: @@ -1652,6 +851,7 @@ namespace OOX nullable m_oBottom; nullable m_oColumn; }; + //-------------------------------------------------------------------------------- // CTextbox 14.1.2.22 (Part4) //-------------------------------------------------------------------------------- @@ -1659,25 +859,17 @@ namespace OOX { public: WritingElement_AdditionConstructors(CTextbox) - CTextbox(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - } - virtual ~CTextbox() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CTextbox::fromXML(XmlUtils::CXmlNode& oNode) - } + + CTextbox(OOX::Document *pMain = NULL); + virtual ~CTextbox(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_textbox; - } + virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: @@ -1690,6 +882,7 @@ namespace OOX nullable m_oTxtbxContent; nullable_string m_oText; //m_arDivs; }; + //-------------------------------------------------------------------------------- // CTextPath 14.1.2.23 (Part4) //-------------------------------------------------------------------------------- @@ -1697,102 +890,18 @@ namespace OOX { public: WritingElement_AdditionConstructors(CTextPath) - CTextPath(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - } - virtual ~CTextPath() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CTextPath::fromXML(XmlUtils::CXmlNode& oNode) - } - virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) - { - ReadAttributes( oReader ); - m_sStringOriginal = oReader.GetText2(); + CTextPath(OOX::Document *pMain = NULL); + virtual ~CTextPath(); - if ( !oReader.IsEmptyNode() ) - oReader.ReadTillEnd(); - } - virtual std::wstring toXML() const - { - std::wstring sResult = _T("GetValue()) ) - sResult += _T("on=\"true\" "); - - if ( (m_oFitShape.IsInit()) && ( SimpleTypes::booleanFalse != m_oFitShape->GetValue()) ) - sResult += _T("fitshape=\"true\" "); - - if ( (m_oFitPath.IsInit()) && ( SimpleTypes::booleanFalse != m_oFitPath->GetValue()) ) - sResult += _T("fitpath=\"true\" "); - - if ( (m_oTrim.IsInit()) && ( SimpleTypes::booleanFalse != m_oTrim->GetValue()) ) - sResult += _T("trim=\"true\" "); - - if ( (m_oXScale.IsInit()) && ( SimpleTypes::booleanFalse != m_oXScale->GetValue()) ) - sResult += _T("xscale=\"true\" "); - - ComplexTypes_WriteAttribute3( _T("string=\""), m_sString ); - - sResult += _T("/>"); - return sResult; - } - virtual EElementType getType() const - { - return OOX::et_v_textpath; - } + virtual std::wstring toXML() const; + virtual EElementType getType() const; private: - - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) - { - if ( oReader.GetAttributesCount() <= 0 ) - return; - - if ( !oReader.MoveToFirstAttribute() ) - return; - - std::wstring wsName = oReader.GetName(); - while( !wsName.empty() ) - { - wchar_t wsChar = wsName[0]; - switch ( wsChar ) - { - case 'f': - if ( _T("fitpath") == wsName ) m_oFitPath = oReader.GetText(); - else if ( _T("fitshape") == wsName ) m_oFitShape = oReader.GetText(); - break; - case 'i': - if ( _T("id") == wsName ) m_oId = oReader.GetText(); - break; - case 'o': - if ( _T("on") == wsName ) m_oOn = oReader.GetText(); - break; - case 's': - if ( _T("string") == wsName ) m_sString = oReader.GetText(); - else if ( _T("style") == wsName ) m_oStyle = oReader.GetText(); - break; - case 't': - if ( _T("trim") == wsName ) m_oTrim = oReader.GetText(); - break; - case 'x': - if ( _T("xscale") == wsName ) m_oXScale = oReader.GetText(); - break; - } - - if ( !oReader.MoveToNextAttribute() ) - break; - - wsName = oReader.GetName(); - } - oReader.MoveToElement(); - } + void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: nullable m_oFitPath; @@ -1806,6 +915,7 @@ namespace OOX nullable_string m_sStringOriginal; }; + //-------------------------------------------------------------------------------- // CGroup 14.1.2.7 (Part4) //-------------------------------------------------------------------------------- @@ -1814,23 +924,19 @@ namespace OOX public: WritingElement_AdditionConstructors(CGroup); - CGroup(OOX::Document *pMain = NULL) : CVmlCommonElements(pMain) - { - } - virtual ~CGroup(){} + CGroup(OOX::Document *pMain = NULL); + virtual ~CGroup(); + virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_v_group; - } + virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); - public: + public: std::vector m_arrShapeTypes; std::vector m_arrElements; @@ -1838,6 +944,7 @@ namespace OOX nullable m_oTableLimits; SimpleTypes::Vml::CVml_TableProperties m_oTableProperties; }; + } // namespace Vml } // namespace OOX @@ -1852,25 +959,17 @@ namespace OOX { public: WritingElement_AdditionConstructors(CShapeDefaults) - CShapeDefaults(OOX::Document *pMain = NULL) : WritingElement(pMain) - { - } - virtual ~CShapeDefaults() - { - } - virtual void fromXML(XmlUtils::CXmlNode& oNode) - { - // TO DO: Реализовать CShapeDefaults::fromXML(XmlUtils::CXmlNode& oNode) - } + + CShapeDefaults(OOX::Document *pMain = NULL); + virtual ~CShapeDefaults(); + + virtual void fromXML(XmlUtils::CXmlNode& oNode); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); + virtual std::wstring toXML() const; - virtual EElementType getType() const - { - return OOX::et_o_shapedefaults; - } + virtual EElementType getType() const; private: - void ReadAttributes(XmlUtils::CXmlLiteReader& oReader); public: @@ -1895,5 +994,6 @@ namespace OOX nullable m_oColorMru; nullable m_oColorMenu; }; + } // VmlOffice } // namespace OOX