Commit 62d48608 authored by ElenaSubbotina's avatar ElenaSubbotina

pptx - extending reading xml

parent 21666ee3
......@@ -43,9 +43,60 @@ namespace PPTX
class Backdrop : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Backdrop)
WritingElement_AdditionConstructors(Backdrop)
PPTX_LOGIC_BASE2(Backdrop)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_backdrop;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
nullable_int x, y, z;
if (strName == L"a:anchor")
{
ReadAttributes(oReader, x, y, z);
anchorX = x.get_value_or(0);
anchorY = y.get_value_or(0);
anchorZ = z.get_value_or(0);
}
else if (strName == L"a:norm")
{
ReadAttributes(oReader, x, y, z);
normX = x.get_value_or(0);
normY = y.get_value_or(0);
normZ = z.get_value_or(0);
}
else if (strName == L"a:up")
{
ReadAttributes(oReader, x, y, z);
upX = x.get_value_or(0);
upY = y.get_value_or(0);
upZ = z.get_value_or(0);
}
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader, nullable_int & x, nullable_int & y, nullable_int & z )
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("x"), x)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("y"), y)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("z"), z)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dx"), x)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dy"), y)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("dz"), z)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
XmlUtils::CXmlNode oNodeA = node.ReadNode(_T("a:anchor"));
......
......@@ -44,9 +44,27 @@ namespace PPTX
class Bevel : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Bevel)
WritingElement_AdditionConstructors(Bevel)
PPTX_LOGIC_BASE2(Bevel)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_bevel;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_name = XmlUtils::GetNameNoNS(oReader.GetName());
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w"), w)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("h"), h)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("prst"), prst)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = XmlUtils::GetNameNoNS(node.GetName());
......
......@@ -43,7 +43,8 @@ namespace PPTX
class BuAutoNum : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuAutoNum)
WritingElement_AdditionConstructors(BuAutoNum)
PPTX_LOGIC_BASE2(BuAutoNum)
BuAutoNum& operator=(const BuAutoNum& oSrc)
{
......@@ -55,8 +56,14 @@ namespace PPTX
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_buChar;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"type", type);
......@@ -64,7 +71,15 @@ namespace PPTX
Normalize();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"startAt", startAt)
WritingElement_ReadAttributes_Read_else_if( oReader, L"type", type)
WritingElement_ReadAttributes_End ( oReader )
Normalize();
}
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
......
......@@ -43,7 +43,8 @@ namespace PPTX
class BuBlip : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuBlip)
WritingElement_AdditionConstructors(BuBlip)
PPTX_LOGIC_BASE2(BuBlip)
BuBlip& operator=(const BuBlip& oSrc)
{
......@@ -54,7 +55,28 @@ namespace PPTX
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"blip")
{
blip = oReader;
break;
}
}
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_buBlip;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
blip = node.ReadNodeNoNS(_T("blip"));
......
......@@ -42,7 +42,8 @@ namespace PPTX
class BuChar : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuChar)
WritingElement_AdditionConstructors(BuChar)
PPTX_LOGIC_BASE2(BuChar)
BuChar& operator=(const BuChar& oSrc)
{
......@@ -52,13 +53,27 @@ namespace PPTX
Char = oSrc.Char;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_buAutoNum;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, L"char", Char)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Char = node.GetAttribute(_T("char"));
}
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
......
......@@ -43,7 +43,32 @@ namespace PPTX
class BuClr : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuClr)
WritingElement_AdditionConstructors(BuClr)
PPTX_LOGIC_BASE2(BuClr)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
}
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_buClr;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
BuClr& operator=(const BuClr& oSrc)
{
......@@ -59,7 +84,6 @@ namespace PPTX
virtual DWORD GetBGRA()const{return Color.GetBGRA();};
virtual DWORD GetABGR()const{return Color.GetABGR();};
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Color.GetColorFrom(node);
......
......@@ -42,7 +42,8 @@ namespace PPTX
class BuClrTx : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuClrTx)
WritingElement_AdditionConstructors(BuClrTx)
PPTX_LOGIC_BASE2(BuClrTx)
BuClrTx& operator=(const BuClrTx& oSrc)
{
......@@ -51,8 +52,29 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_buClrTx;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
......
......@@ -42,7 +42,8 @@ namespace PPTX
class BuFontTx : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuFontTx)
WritingElement_AdditionConstructors(BuFontTx)
PPTX_LOGIC_BASE2(BuFontTx)
BuFontTx& operator=(const BuFontTx& oSrc)
{
......@@ -50,8 +51,31 @@ namespace PPTX
parentElement = oSrc.parentElement;
return *this;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
}
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_buFontTx;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
......
......@@ -42,7 +42,8 @@ namespace PPTX
class BuNone : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuNone)
WritingElement_AdditionConstructors(BuNone)
PPTX_LOGIC_BASE2(BuNone)
BuNone& operator=(const BuNone& oSrc)
{
......@@ -51,8 +52,13 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_buNone;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
......
......@@ -42,7 +42,8 @@ namespace PPTX
class BuSzPct : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuSzPct)
WritingElement_AdditionConstructors(BuSzPct)
PPTX_LOGIC_BASE2(BuSzPct)
BuSzPct& operator=(const BuSzPct& oSrc)
{
......@@ -52,8 +53,22 @@ namespace PPTX
val = oSrc.val;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_buSzPct;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
public:
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
val = node.ReadAttributeInt(_T("val"));
......@@ -79,19 +94,24 @@ namespace PPTX
pWriter->StartRecord(BULLET_TYPE_SIZE_PCT);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt1(0, val);
pWriter->WriteInt1(0, val.get_value_or(0));
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->EndRecord();
}
public:
int val;
nullable_int val;
protected:
virtual void FillParentPointersForChilds(){};
AVSINLINE void Normalize()
{
normalize_value(val, 25000, 400000);
if (val.IsInit())
{
int tmp = *val;
normalize_value(tmp, 25000, 400000);
val = tmp;
}
}
};
} // namespace Logic
......
......@@ -42,7 +42,8 @@ namespace PPTX
class BuSzPts : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuSzPts)
WritingElement_AdditionConstructors(BuSzPts)
PPTX_LOGIC_BASE2(BuSzPts)
BuSzPts& operator=(const BuSzPts& oSrc)
{
......@@ -52,8 +53,20 @@ namespace PPTX
val = oSrc.val;
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_buSzPts;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
val = node.ReadAttributeInt(_T("val"));
......@@ -79,18 +92,23 @@ namespace PPTX
pWriter->StartRecord(BULLET_TYPE_SIZE_PTS);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt1(0, val);
pWriter->WriteInt1(0, val.get_value_or(0));
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->EndRecord();
}
public:
int val;
nullable_int val;
protected:
virtual void FillParentPointersForChilds(){};
AVSINLINE void Normalize()
{
normalize_value(val, 100, 400000);
if (val.IsInit())
{
int tmp = *val;
normalize_value(tmp, 100, 400000);
val = tmp;
}
}
};
} // namespace Logic
......
......@@ -42,7 +42,8 @@ namespace PPTX
class BuSzTx : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BuSzTx)
WritingElement_AdditionConstructors(BuSzTx)
PPTX_LOGIC_BASE2(BuSzTx)
BuSzTx& operator=(const BuSzTx& oSrc)
{
......@@ -51,8 +52,13 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_buSzTx;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
......
......@@ -46,7 +46,8 @@ namespace PPTX
class Bullet : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Bullet)
WritingElement_AdditionConstructors(Bullet)
PPTX_LOGIC_BASE2(Bullet)
Bullet& operator=(const Bullet& oSrc)
{
......@@ -57,8 +58,27 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType () const
{
if (m_Bullet.IsInit())
return m_Bullet->getType();
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
public:
if (strName == _T("buNone"))
m_Bullet.reset(new Logic::BuNone(oReader));
else if (strName == _T("buChar"))
m_Bullet.reset(new Logic::BuChar(oReader));
else if (strName == _T("buAutoNum"))
m_Bullet.reset(new Logic::BuAutoNum(oReader));
else if (strName == _T("buBlip"))
m_Bullet.reset(new Logic::BuBlip(oReader));
else
m_Bullet.reset();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
std::wstring strName = XmlUtils::GetNameNoNS(node.GetName());
......@@ -71,7 +91,8 @@ namespace PPTX
m_Bullet.reset(new Logic::BuAutoNum(node));
else if (strName == _T("buBlip"))
m_Bullet.reset(new Logic::BuBlip(node));
else m_Bullet.reset();
else
m_Bullet.reset();
}
virtual void ReadBulletFrom(XmlUtils::CXmlNode& element)
......@@ -85,7 +106,8 @@ namespace PPTX
m_Bullet.reset(new Logic::BuAutoNum(oNode));
else if (element.GetNode(_T("a:buBlip"), oNode))
m_Bullet.reset(new Logic::BuBlip(oNode));
else m_Bullet.reset();
else
m_Bullet.reset();
}
virtual bool is_init()const{return (m_Bullet.IsInit());};
......
......@@ -44,7 +44,8 @@ namespace PPTX
class BulletColor : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BulletColor)
WritingElement_AdditionConstructors(BulletColor)
PPTX_LOGIC_BASE2(BulletColor)
BulletColor& operator=(const BulletColor& oColor)
{
......@@ -55,8 +56,23 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType() const
{
if (m_Color.IsInit())
return m_Color->getType();
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring strName = oReader.GetName();
public:
if (strName == _T("a:buClrTx"))
m_Color.reset(new Logic::BuClrTx(oReader));
else if (strName == _T("a:buClr"))
m_Color.reset(new Logic::BuClr(oReader));
else
m_Color.reset();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
std::wstring strName = node.GetName();
......@@ -65,7 +81,8 @@ namespace PPTX
m_Color.reset(new Logic::BuClrTx(node));
else if (strName == _T("a:buClr"))
m_Color.reset(new Logic::BuClr(node));
else m_Color.reset();
else
m_Color.reset();
}
void ReadBulletColorFrom(XmlUtils::CXmlNode& element)
......@@ -75,7 +92,8 @@ namespace PPTX
m_Color.reset(new Logic::BuClrTx(oNode));
else if (element.GetNode(_T("a:buClr"), oNode))
m_Color.reset(new Logic::BuClr(oNode));
else m_Color.reset();
else
m_Color.reset();
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
......
......@@ -45,7 +45,8 @@ namespace PPTX
class BulletSize : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BulletSize)
WritingElement_AdditionConstructors(BulletSize)
PPTX_LOGIC_BASE2(BulletSize)
BulletSize& operator=(const BulletSize& oSrc)
{
......@@ -56,8 +57,26 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType () const
{
if (m_Size.IsInit())
return m_Size->getType();
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring strName = oReader.GetName();
if (strName == _T("a:buSzTx"))
m_Size.reset(new Logic::BuSzTx(oReader));
else if (strName == _T("a:buSzPct"))
m_Size.reset(new Logic::BuSzPct(oReader));
else if (strName == _T("a:buSzPts"))
m_Size.reset(new Logic::BuSzPts(oReader));
else
m_Size.reset();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
std::wstring strName = node.GetName();
......@@ -68,7 +87,8 @@ namespace PPTX
m_Size.reset(new Logic::BuSzPct(node));
else if (strName == _T("a:buSzPts"))
m_Size.reset(new Logic::BuSzPts(node));
else m_Size.reset();
else
m_Size.reset();
}
virtual void ReadBulletSizeFrom(XmlUtils::CXmlNode& element)
......@@ -80,7 +100,8 @@ namespace PPTX
m_Size.reset(new Logic::BuSzPct(oNode));
else if(element.GetNode(_T("a:buSzPts"), oNode))
m_Size.reset(new Logic::BuSzPts(oNode));
else m_Size.reset();
else
m_Size.reset();
}
virtual bool is_init()const{return (m_Size.IsInit());};
virtual bool has_spec_size()const{return ((is_init()) && (!is<BuSzTx>()));};
......
......@@ -44,7 +44,8 @@ namespace PPTX
class BulletTypeface : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BulletTypeface)
WritingElement_AdditionConstructors(BulletTypeface)
PPTX_LOGIC_BASE2(BulletTypeface)
BulletTypeface& operator=(const BulletTypeface& oSrc)
{
......@@ -55,8 +56,22 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType () const
{
if (m_Typeface.IsInit())
return m_Typeface->getType();
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring strName = oReader.GetName();
if (strName == _T("a:buFontTx"))
m_Typeface.reset(new Logic::BuFontTx(oReader));
else if (strName == _T("a:buFont"))
m_Typeface.reset(new Logic::TextFont(oReader));
else
m_Typeface.reset();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
std::wstring strName = node.GetName();
......@@ -65,7 +80,8 @@ namespace PPTX
m_Typeface.reset(new Logic::BuFontTx(node));
else if (strName == _T("a:buFont"))
m_Typeface.reset(new Logic::TextFont(node));
else m_Typeface.reset();
else
m_Typeface.reset();
}
virtual void ReadBulletTypefaceFrom(XmlUtils::CXmlNode& element)
......
......@@ -45,9 +45,41 @@ namespace PPTX
class Camera : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Camera)
WritingElement_AdditionConstructors(Camera)
PPTX_LOGIC_BASE2(Camera)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_camera;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:rot")
{
rot = oReader;
break;
}
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("prst"), prst)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("fov"), fov)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("zoom"), zoom)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
prst = node.GetAttribute(_T("prst"));
......
......@@ -42,8 +42,40 @@ namespace PPTX
class ColorModifier : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(ColorModifier)
public:
WritingElement_AdditionConstructors(ColorModifier)
PPTX_LOGIC_BASE2(ColorModifier)
virtual OOX::EElementType getType() const
{
return OOX::et_a_prstClr;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
name = oReader.GetName();
ReadAttributes( oReader );
if (XmlUtils::GetNameNoNS(name) == _T("alpha"))
{
ReadAttributes2( oReader );
}
}
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader)
{
nullable_string sTmp;
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), sTmp)
WritingElement_ReadAttributes_End( oReader )
if (val.is_init() && sTmp.is_init() && sTmp->find(wchar_t('%')) != -1)
*val = (*val) * 1000;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
name = node.GetName();
......
......@@ -43,9 +43,36 @@ namespace PPTX
class PrstClr : public ColorBase
{
public:
PPTX_LOGIC_BASE(PrstClr)
WritingElement_AdditionConstructors(PrstClr)
PPTX_LOGIC_BASE2(PrstClr)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_prstClr;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
ColorModifier m;
Modifiers.push_back(m);
Modifiers.back().fromXML(oReader);
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
val = node.GetAttribute(_T("val"));
......
......@@ -49,6 +49,23 @@ namespace PPTX
Modifiers.clear();
node.LoadArray(_T("*"), Modifiers);
}
void SchemeClr::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
ColorModifier m;
Modifiers.push_back(m);
Modifiers.back().fromXML(oReader);
}
}
std::wstring SchemeClr::toXML() const
{
......
......@@ -44,12 +44,24 @@ namespace PPTX
class SchemeClr : public ColorBase
{
public:
PPTX_LOGIC_BASE(SchemeClr)
WritingElement_AdditionConstructors(SchemeClr)
PPTX_LOGIC_BASE2(SchemeClr)
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
virtual OOX::EElementType getType() const
{
return OOX::et_a_schemeClr;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
std::wstring sNodeNamespace;
......
......@@ -43,9 +43,47 @@ namespace PPTX
class SrgbClr : public ColorBase
{
public:
PPTX_LOGIC_BASE(SrgbClr)
WritingElement_AdditionConstructors(SrgbClr)
PPTX_LOGIC_BASE2(SrgbClr)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_srgbClr;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring val;
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
if (6 == val.length())
{
red = HexString2Int(val.substr(0, 2));
green = HexString2Int(val.substr(2, 2));
blue = HexString2Int(val.substr(4, 2));
}
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
ColorModifier m;
Modifiers.push_back(m);
Modifiers.back().fromXML(oReader);
}
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
std::wstring val = node.GetAttribute(_T("val"));
......
......@@ -44,7 +44,8 @@ namespace PPTX
class SysClr : public ColorBase
{
public:
PPTX_LOGIC_BASE(SysClr)
WritingElement_AdditionConstructors(SysClr)
PPTX_LOGIC_BASE2(SysClr)
virtual DWORD GetRGBA(DWORD RGBA) const
{
......@@ -146,7 +147,33 @@ namespace PPTX
Modifiers.clear();
node.LoadArray(_T("*"), Modifiers);
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_sysClr;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
ColorModifier m;
Modifiers.push_back(m);
Modifiers.back().fromXML(oReader);
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End( oReader )
}
virtual std::wstring toXML() const
{
......
......@@ -35,7 +35,24 @@ namespace PPTX
{
namespace Logic
{
void EffectDag::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
Effects.clear();
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
UniEffect uni;
Effects.push_back(uni);
Effects.back().fromXML(oReader);
}
}
void EffectDag::fromXML(XmlUtils::CXmlNode& node)
{
m_name = node.GetName();
......
......@@ -45,8 +45,8 @@ namespace PPTX
class EffectDag : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(EffectDag)
WritingElement_AdditionConstructors(EffectDag)
PPTX_LOGIC_BASE2(EffectDag)
EffectDag& operator=(const EffectDag& oSrc)
{
......@@ -59,10 +59,21 @@ namespace PPTX
m_name = oSrc.m_name;
return *this;
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_effectDag;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
public:
virtual void fromXML(XmlUtils::CXmlNode& node);
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, L"name", name)
WritingElement_ReadAttributes_Read_else_if( oReader, L"type", type)
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
......
......@@ -35,8 +35,6 @@ namespace PPTX
{
namespace Logic
{
void EffectLst::fromXML(XmlUtils::CXmlNode& node)
{
blur = node.ReadNode(_T("a:blur"));
......@@ -50,7 +48,37 @@ namespace PPTX
FillParentPointersForChilds();
}
void EffectLst::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:blur")
blur = oReader;
if (strName == L"a:fillOverlay")
fillOverlay = oReader;
if (strName == L"a:glow")
glow = oReader;
if (strName == L"a:innerShdw")
innerShdw = oReader;
if (strName == L"a:outerShdw")
outerShdw = oReader;
if (strName == L"a:prstShdw")
prstShdw = oReader;
if (strName == L"a:reflection")
reflection = oReader;
if (strName == L"a:softEdge")
softEdge = oReader;
}
}
std::wstring EffectLst::toXML() const
{
std::wstring str = _T("<a:effectLst>");
......
......@@ -47,16 +47,26 @@ namespace PPTX
{
namespace Logic
{
class EffectLst : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(EffectLst)
WritingElement_AdditionConstructors(EffectLst)
PPTX_LOGIC_BASE2(EffectLst)
EffectLst& operator=(const EffectLst& oSrc);
public:
virtual OOX::EElementType getType () const
{
return OOX::et_a_effectLst;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
......
......@@ -44,7 +44,8 @@ namespace PPTX
class EffectProperties : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(EffectProperties)
WritingElement_AdditionConstructors(EffectProperties)
PPTX_LOGIC_BASE2(EffectProperties)
EffectProperties& operator=(const EffectProperties& oSrc)
{
......@@ -54,7 +55,23 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType () const
{
if (List.IsInit())
return List->getType();
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring strName = oReader.GetName();
if (strName == _T("effectLst"))
List.reset(new Logic::EffectLst(oReader));
else if(strName == _T("effectDag"))
List.reset(new Logic::EffectDag(oReader));
else
List.reset();
}
virtual bool is_init() const {return (List.IsInit());};
......
......@@ -44,7 +44,24 @@ namespace PPTX
FillParentPointersForChilds();
}
void EffectStyle::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:scene3d")
scene3d = oReader;
else if (strName == L"a:sp3d")
sp3d = oReader;
else
EffectList.fromXML(oReader);
}
FillParentPointersForChilds();
}
std::wstring EffectStyle::toXML() const
{
......
......@@ -46,7 +46,8 @@ namespace PPTX
class EffectStyle : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(EffectStyle)
WritingElement_AdditionConstructors(EffectStyle)
PPTX_LOGIC_BASE2(EffectStyle)
EffectStyle& operator=(const EffectStyle& oSrc)
{
......@@ -58,8 +59,11 @@ namespace PPTX
sp3d = oSrc.sp3d;
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_effectStyle;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
......
......@@ -43,7 +43,8 @@ namespace PPTX
class AlphaBiLevel : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(AlphaBiLevel)
WritingElement_AdditionConstructors(AlphaBiLevel)
PPTX_LOGIC_BASE2(AlphaBiLevel)
AlphaBiLevel& operator=(const AlphaBiLevel& oSrc)
{
......@@ -54,7 +55,22 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_alphaBiLevel;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("thresh"), thresh)
WritingElement_ReadAttributes_End( oReader )
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"thresh", thresh);
......
......@@ -43,7 +43,8 @@ namespace PPTX
class AlphaCeiling : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(AlphaCeiling)
WritingElement_AdditionConstructors(AlphaCeiling)
PPTX_LOGIC_BASE2(AlphaCeiling)
AlphaCeiling& operator=(const AlphaCeiling& oSrc)
{
......@@ -59,7 +60,13 @@ namespace PPTX
pWriter->EndRecord();
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_alphaCeiling;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
......
......@@ -43,7 +43,8 @@ namespace PPTX
class AlphaFloor : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(AlphaFloor)
WritingElement_AdditionConstructors(AlphaFloor)
PPTX_LOGIC_BASE2(AlphaFloor)
AlphaFloor& operator=(const AlphaFloor& oSrc)
{
......@@ -52,12 +53,16 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_alphaFloor;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("<a:alphaFloor/>");
......
......@@ -44,7 +44,8 @@ namespace PPTX
class AlphaInv : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(AlphaInv)
WritingElement_AdditionConstructors(AlphaInv)
PPTX_LOGIC_BASE2(AlphaInv)
AlphaInv& operator=(const AlphaInv& oSrc)
{
......@@ -55,7 +56,23 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_alphaInv;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
Color.fromXML(oReader);
}
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Color.GetColorFrom(node);
......
......@@ -44,7 +44,8 @@ namespace PPTX
class AlphaMod : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(AlphaMod)
WritingElement_AdditionConstructors(AlphaMod)
PPTX_LOGIC_BASE2(AlphaMod)
AlphaMod& operator=(const AlphaMod& oSrc)
{
......@@ -54,8 +55,28 @@ namespace PPTX
cont = oSrc.cont;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_alphaMod;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:cont")
{
cont = oReader;
break;
}
}
FillParentPointersForChilds();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
cont = node.ReadNode(_T("a:cont"));
......
......@@ -43,8 +43,8 @@ namespace PPTX
class AlphaModFix : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(AlphaModFix)
WritingElement_AdditionConstructors(AlphaModFix)
PPTX_LOGIC_BASE2(AlphaModFix)
AlphaModFix& operator=(const AlphaModFix& oSrc)
{
......@@ -54,8 +54,22 @@ namespace PPTX
amt = oSrc.amt;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_alphaModFix;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("amt"), amt)
WritingElement_ReadAttributes_End( oReader )
public:
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"amt", amt);
......
......@@ -44,7 +44,8 @@ namespace PPTX
{
public:
PPTX_LOGIC_BASE(AlphaOutset)
WritingElement_AdditionConstructors(AlphaOutset)
PPTX_LOGIC_BASE2(AlphaOutset)
AlphaOutset& operator=(const AlphaOutset& oSrc)
{
......@@ -54,8 +55,20 @@ namespace PPTX
rad = oSrc.rad;
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_alphaOutset;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"rad", rad);
......
......@@ -43,7 +43,8 @@ namespace PPTX
class AlphaRepl : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(AlphaRepl)
WritingElement_AdditionConstructors(AlphaRepl)
PPTX_LOGIC_BASE2(AlphaRepl)
AlphaRepl& operator=(const AlphaRepl& oSrc)
{
......@@ -53,8 +54,22 @@ namespace PPTX
a = oSrc.a;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_alphaRepl;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("a"), a)
WritingElement_ReadAttributes_End( oReader )
public:
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"a", a);
......
......@@ -44,7 +44,8 @@ namespace PPTX
{
public:
PPTX_LOGIC_BASE(BiLevel)
WritingElement_AdditionConstructors(BiLevel)
PPTX_LOGIC_BASE2(BiLevel)
BiLevel& operator=(const BiLevel& oSrc)
{
......@@ -54,8 +55,22 @@ namespace PPTX
thresh = oSrc.thresh;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_biLevel;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thresh"), thresh)
WritingElement_ReadAttributes_End( oReader )
public:
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"thresh", thresh);
......
......@@ -45,8 +45,8 @@ namespace PPTX
class Blend : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Blend)
WritingElement_AdditionConstructors(Blend)
PPTX_LOGIC_BASE2(Blend)
Blend& operator=(const Blend& oSrc)
{
......@@ -57,8 +57,32 @@ namespace PPTX
blend = oSrc.blend;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_blend;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
public:
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:cont")
cont = oReader;
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("blend"), blend)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
cont = node.ReadNode(_T("a:cont"));
......
......@@ -43,7 +43,8 @@ namespace PPTX
{
public:
PPTX_LOGIC_BASE(Blur)
WritingElement_AdditionConstructors(Blur)
PPTX_LOGIC_BASE2(Blur)
Blur& operator=(const Blur& oSrc)
{
......@@ -55,7 +56,21 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_blur;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("grow"), grow)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"rad", rad);
......
......@@ -44,7 +44,8 @@ namespace PPTX
class ClrChange : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(ClrChange)
WritingElement_AdditionConstructors(ClrChange)
PPTX_LOGIC_BASE2(ClrChange)
ClrChange& operator=(const ClrChange& oSrc)
{
......@@ -56,8 +57,35 @@ namespace PPTX
useA = oSrc.useA;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_clrChange;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:clrTo")
ClrTo.fromXML(oReader);
else if (strName == L"a:clrFrom")
ClrFrom.fromXML(oReader);
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("useA"), useA)
WritingElement_ReadAttributes_End( oReader )
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
XmlUtils::CXmlNode node1 = node.ReadNode(_T("a:clrFrom"));
......
......@@ -45,7 +45,8 @@ namespace PPTX
{
public:
PPTX_LOGIC_BASE(ClrRepl)
WritingElement_AdditionConstructors(ClrRepl)
PPTX_LOGIC_BASE2(ClrRepl)
ClrRepl& operator=(const ClrRepl& oSrc)
{
......@@ -55,8 +56,24 @@ namespace PPTX
Color = oSrc.Color;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_clrRepl;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
public:
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
Color.fromXML(oReader);
}
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Color.GetColorFrom(node);
......
......@@ -43,7 +43,8 @@ namespace PPTX
class Duotone : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Duotone)
WritingElement_AdditionConstructors(Duotone)
PPTX_LOGIC_BASE2(Duotone)
Duotone& operator=(const Duotone& oSrc)
{
......@@ -53,15 +54,32 @@ namespace PPTX
Colors = oSrc.Colors;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_duotone;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
public:
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
UniColor col;
Colors.push_back(col);
Colors.back().fromXML(oReader);
}
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Colors.clear();
node.LoadArray(_T("*"), Colors);
FillParentPointersForChilds();
}
virtual std::wstring toXML() const
{
XmlUtils::CNodeValue oValue;
......
......@@ -44,7 +44,8 @@ namespace PPTX
{
public:
PPTX_LOGIC_BASE(EffectElement)
WritingElement_AdditionConstructors(EffectElement)
PPTX_LOGIC_BASE2(EffectElement)
EffectElement& operator=(const EffectElement& oSrc)
{
......@@ -54,8 +55,21 @@ namespace PPTX
ref = oSrc.ref;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_effect;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("ref"), ref)
WritingElement_ReadAttributes_End( oReader )
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"ref", ref);
......
......@@ -44,7 +44,8 @@ namespace PPTX
{
public:
PPTX_LOGIC_BASE(FillEffect)
WritingElement_AdditionConstructors(FillEffect)
PPTX_LOGIC_BASE2(FillEffect)
FillEffect& operator=(const FillEffect& oSrc)
{
......@@ -54,8 +55,24 @@ namespace PPTX
Fill = oSrc.Fill;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_fill;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
public:
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
Fill.fromXML(oReader);
}
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Fill.GetFillFrom(node);
......
......@@ -46,7 +46,8 @@ namespace PPTX
{
public:
PPTX_LOGIC_BASE(FillOverlay)
WritingElement_AdditionConstructors(FillOverlay)
PPTX_LOGIC_BASE2(FillOverlay)
FillOverlay& operator=(const FillOverlay& oSrc)
{
......@@ -58,7 +59,32 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_fillOverlay;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
Fill.fromXML(oReader);
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("blend"), blend)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Fill.GetFillFrom(node);
......
......@@ -40,11 +40,11 @@ namespace PPTX
{
namespace Logic
{
class Glow : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Glow)
WritingElement_AdditionConstructors(Glow)
PPTX_LOGIC_BASE2(Glow)
Glow& operator=(const Glow& oSrc)
{
......@@ -55,14 +55,40 @@ namespace PPTX
rad = oSrc.rad;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_clrRepl;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
Color.fromXML(oReader);
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rad"), rad)
WritingElement_ReadAttributes_End( oReader )
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Color.GetColorFrom(node);
node.ReadAttributeBase(L"rad", rad);
FillParentPointersForChilds();
FillParentPointersForChilds();
Normalize();
}
......
......@@ -43,7 +43,8 @@ namespace PPTX
class Grayscl : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Grayscl)
WritingElement_AdditionConstructors(Grayscl)
PPTX_LOGIC_BASE2(Grayscl)
Grayscl& operator=(const Grayscl& oSrc)
{
......@@ -52,8 +53,13 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_grayscl;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
......
......@@ -43,7 +43,8 @@ namespace PPTX
class HslEffect : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(HslEffect)
WritingElement_AdditionConstructors(HslEffect)
PPTX_LOGIC_BASE2(HslEffect)
HslEffect& operator=(const HslEffect& oSrc)
{
......@@ -55,8 +56,24 @@ namespace PPTX
sat = oSrc.sat;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_hsl;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("hue"), hue)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sat"), sat)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lum"), lum)
WritingElement_ReadAttributes_End( oReader )
public:
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"hue", hue);
......
......@@ -44,7 +44,8 @@ namespace PPTX
class InnerShdw : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(InnerShdw)
WritingElement_AdditionConstructors(InnerShdw)
PPTX_LOGIC_BASE2(InnerShdw)
InnerShdw& operator=(const InnerShdw& oSrc)
{
......@@ -57,8 +58,36 @@ namespace PPTX
dist = oSrc.dist;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_innerShdw;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
Color.fromXML(oReader);
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("blurRad"), blurRad)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dir"), dir)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dist"), dist)
WritingElement_ReadAttributes_End( oReader )
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Color.GetColorFrom(node);
......@@ -66,8 +95,8 @@ namespace PPTX
node.ReadAttributeBase(L"dir", dir);
node.ReadAttributeBase(L"dist", dist);
FillParentPointersForChilds();
Normalize();
FillParentPointersForChilds();
}
virtual std::wstring toXML() const
......
......@@ -43,7 +43,8 @@ namespace PPTX
class LumEffect : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(LumEffect)
WritingElement_AdditionConstructors(LumEffect)
PPTX_LOGIC_BASE2(LumEffect)
LumEffect& operator=(const LumEffect& oSrc)
{
......@@ -54,8 +55,21 @@ namespace PPTX
contrast = oSrc.contrast;
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_lum;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("bright"), bright)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("contrast"), contrast)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"bright", bright);
......
......@@ -45,7 +45,8 @@ namespace PPTX
class OuterShdw : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(OuterShdw)
WritingElement_AdditionConstructors(OuterShdw)
PPTX_LOGIC_BASE2(OuterShdw)
OuterShdw& operator=(const OuterShdw& oSrc)
{
......@@ -66,8 +67,42 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_innerShdw;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
Color.fromXML(oReader);
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("blurRad"), blurRad)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dir"), dir)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dist"), dist)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("algnt"), algn)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kx"), kx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ky"), ky)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rotWithShape"), rotWithShape)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sx"), sx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sy"), sy)
WritingElement_ReadAttributes_End( oReader )
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Color.GetColorFrom(node);
......
......@@ -45,7 +45,8 @@ namespace PPTX
class PrstShdw : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(PrstShdw)
WritingElement_AdditionConstructors(PrstShdw)
PPTX_LOGIC_BASE2(PrstShdw)
PrstShdw& operator=(const PrstShdw& oSrc)
{
......@@ -60,8 +61,37 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_prstShdw;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
Color.fromXML(oReader);
}
Normalize();
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("prst"), prst)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dir"), dir)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dist"), dist)
WritingElement_ReadAttributes_End( oReader )
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Color.GetColorFrom(node);
......
......@@ -44,7 +44,8 @@ namespace PPTX
class Reflection : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Reflection)
WritingElement_AdditionConstructors(Reflection)
PPTX_LOGIC_BASE2(Reflection)
Reflection& operator=(const Reflection& oSrc)
{
......@@ -68,8 +69,35 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_reflection;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("blurRad"), blurRad)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dir"), dir)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("fadeDir"), fadeDir)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dist"), dist)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("algnt"), algn)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kx"), kx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ky"), ky)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rotWithShape"), rotWithShape)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sx"), sx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sy"), sy)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("stA"), stA)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("endA"), endA)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("stPos"), stPos)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("endPos"), endPos)
WritingElement_ReadAttributes_End( oReader )
public:
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"algn", algn);
......
......@@ -43,7 +43,8 @@ namespace PPTX
class RelOff : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(RelOff)
WritingElement_AdditionConstructors(RelOff)
PPTX_LOGIC_BASE2(RelOff)
RelOff& operator=(const RelOff& oSrc)
{
......@@ -54,8 +55,21 @@ namespace PPTX
ty = oSrc.ty;
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_relOff;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("tx"), tx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ty"), ty)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"tx", tx);
......
......@@ -43,7 +43,8 @@ namespace PPTX
class SoftEdge : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(SoftEdge)
WritingElement_AdditionConstructors(SoftEdge)
PPTX_LOGIC_BASE2(SoftEdge)
SoftEdge& operator=(const SoftEdge& oSrc)
{
......@@ -53,8 +54,20 @@ namespace PPTX
rad = oSrc.rad;
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_softEdge;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("rad"), rad)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"rad", rad);
......
......@@ -43,7 +43,8 @@ namespace PPTX
class TintEffect : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(TintEffect)
WritingElement_AdditionConstructors(TintEffect)
PPTX_LOGIC_BASE2(TintEffect)
TintEffect& operator=(const TintEffect& oSrc)
{
......@@ -54,8 +55,23 @@ namespace PPTX
hue = oSrc.hue;
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_tint;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("amt"), amt)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("hue"), hue)
WritingElement_ReadAttributes_End( oReader )
public:
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"amt", amt);
......
......@@ -43,7 +43,8 @@ namespace PPTX
class XfrmEffect : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(XfrmEffect)
WritingElement_AdditionConstructors(XfrmEffect)
PPTX_LOGIC_BASE2(XfrmEffect)
XfrmEffect& operator=(const XfrmEffect& oSrc)
{
......@@ -59,8 +60,27 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_xfrm;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("kx"), kx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ky"), ky)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sx"), sx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sy"), sy)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx"), tx)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ty"), ty)
WritingElement_ReadAttributes_End( oReader )
public:
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"kx", kx);
......
......@@ -41,6 +41,26 @@ namespace PPTX
{
namespace Logic
{
void Blip::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
Effects.clear();
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = oReader.GetName();
UniEffect uni;
Effects.push_back(uni);
Effects.back().fromXML(oReader);
}
FillParentPointersForChilds();
}
void Blip::fromXML(XmlUtils::CXmlNode& node)
{
m_namespace = XmlUtils::GetNamespace(node.GetName());
......
......@@ -45,7 +45,8 @@ namespace PPTX
class Blip : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Blip)
WritingElement_AdditionConstructors(Blip)
PPTX_LOGIC_BASE2(Blip)
Blip& operator=(const Blip& oSrc)
{
......@@ -66,8 +67,19 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_blip;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:embed"), embed)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("r:link"), link )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cstate"), cstate )
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
......
......@@ -49,7 +49,8 @@ namespace PPTX
class BlipFill : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(BlipFill)
WritingElement_AdditionConstructors(BlipFill)
PPTX_LOGIC_BASE2(BlipFill)
BlipFill& operator=(const BlipFill& oSrc)
{
......@@ -67,8 +68,50 @@ namespace PPTX
m_namespace = oSrc.m_namespace;
return *this;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (_T("blip") == strName)
{
if (!blip.IsInit())
blip = oReader;
}
else if (_T("srcRect") == strName)
{
if (!srcRect.IsInit())
srcRect = oReader;
}
else if (_T("tile") == strName)
{
if (!tile.IsInit())
tile = oReader;
}
else if (_T("stretch") == strName)
{
if (!stretch.IsInit())
stretch = oReader;
}
}
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_blipFill;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("dpi"), dpi)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rotWithShape"), rotWithShape )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_namespace = XmlUtils::GetNamespace(node.GetName());
......
......@@ -48,7 +48,8 @@ namespace PPTX
class GradFill : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(GradFill)
WritingElement_AdditionConstructors(GradFill)
PPTX_LOGIC_BASE2(GradFill)
GradFill& operator=(const GradFill& oSrc)
{
......@@ -67,8 +68,47 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_gradFill;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("path") == strName)
path = oReader;
else if (_T("lin") == strName)
lin = oReader;
else if (_T("tileRect") == strName)
tileRect = oReader;
else if (_T("gsLst") == strName)
{
int nCurDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth1 ) )
{
std::wstring sName1 = XmlUtils::GetNameNoNS(oReader.GetName());
Gs g; GsLst.push_back(g);
GsLst.back().fromXML(oReader);
}
}
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rotWithShape"), rotWithShape )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("flip"), flip )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_namespace = XmlUtils::GetNamespace(node.GetName());
......
......@@ -43,7 +43,8 @@ namespace PPTX
class NoFill : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(NoFill)
WritingElement_AdditionConstructors(NoFill)
PPTX_LOGIC_BASE2(NoFill)
NoFill& operator=(const NoFill& oSrc)
{
......@@ -53,8 +54,19 @@ namespace PPTX
m_namespace = oSrc.m_namespace;
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_noFill;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_namespace = XmlUtils::GetNamespace(node.GetName());
......@@ -87,7 +99,8 @@ namespace PPTX
class GrpFill : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(GrpFill)
WritingElement_AdditionConstructors(GrpFill)
PPTX_LOGIC_BASE2(GrpFill)
GrpFill& operator=(const GrpFill& oSrc)
{
......@@ -97,8 +110,19 @@ namespace PPTX
m_namespace = oSrc.m_namespace;
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_grpFill;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_namespace = XmlUtils::GetNamespace(node.GetName());
......
......@@ -41,11 +41,11 @@ namespace PPTX
{
namespace Logic
{
class PattFill : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(PattFill)
WritingElement_AdditionConstructors(PattFill)
PPTX_LOGIC_BASE2(PattFill)
PattFill& operator=(const PattFill& oSrc)
{
......@@ -59,8 +59,34 @@ namespace PPTX
return *this;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
if (sName == L"a:fgClr")
fgClr.fromXML(oReader);
if (sName == L"a:bgClr")
bgClr.fromXML(oReader);
}
FillParentPointersForChilds();
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_pattFill;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("prst"), prst )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_namespace = XmlUtils::GetNamespace(node.GetName());
......
......@@ -44,7 +44,8 @@ namespace PPTX
class SolidFill : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(SolidFill)
WritingElement_AdditionConstructors(SolidFill)
PPTX_LOGIC_BASE2(SolidFill)
SolidFill& operator=(const SolidFill& oSrc)
{
......@@ -56,8 +57,27 @@ namespace PPTX
return *this;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
Color.fromXML(oReader);
}
FillParentPointersForChilds();
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_solidFill;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_namespace = XmlUtils::GetNamespace(node.GetName());
......
......@@ -44,7 +44,8 @@ namespace PPTX
class Stretch : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Stretch)
WritingElement_AdditionConstructors(Stretch)
PPTX_LOGIC_BASE2(Stretch)
Stretch& operator=(const Stretch& oSrc)
{
......@@ -54,8 +55,19 @@ namespace PPTX
fillRect = oSrc.fillRect;
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_stretch;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
if (_T("fillRect") == XmlUtils::GetNameNoNS(oReader.GetName()))
fillRect = oReader;
}
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
XmlUtils::CXmlNodes oNodes;
......
......@@ -45,7 +45,8 @@ namespace PPTX
class Tile : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Tile)
WritingElement_AdditionConstructors(Tile)
PPTX_LOGIC_BASE2(Tile)
Tile& operator=(const Tile& oSrc)
{
......@@ -62,7 +63,25 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_tile;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("algn"), algn )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("flip"), flip )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sx"), sx )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sy"), sy )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tx"), tx )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ty"), ty )
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"algn", algn);
......
......@@ -43,7 +43,8 @@ namespace PPTX
class Gs : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Gs)
WritingElement_AdditionConstructors(Gs)
PPTX_LOGIC_BASE2(Gs)
Gs& operator=(const Gs& oSrc)
{
......@@ -55,8 +56,33 @@ namespace PPTX
return *this;
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_gs;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
color.fromXML(oReader);
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
nullable_int tmp;
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("pos"), tmp)
WritingElement_ReadAttributes_End ( oReader )
pos = tmp.get_value_or(0);
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
pos = node.ReadAttributeInt(L"pos");
......
......@@ -45,9 +45,45 @@ namespace PPTX
class Hyperlink : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Hyperlink)
WritingElement_AdditionConstructors(Hyperlink)
PPTX_LOGIC_BASE2(Hyperlink)
public:
virtual OOX::EElementType getType () const
{
return OOX::et_a_hyperlink;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
if (sName == L"snd")
{
snd = oReader;
break;
}
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), id )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("invalidUrl"), invalidUrl )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("action"), action )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tgtFrame"), tgtFrame )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("tooltip"), tooltip )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("history"), history)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("highlightClick"), highlightClick )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("endSnd"), endSnd )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = XmlUtils::GetNameNoNS(node.GetName());
......
......@@ -46,16 +46,46 @@ namespace PPTX
class LightRig : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(LightRig)
WritingElement_AdditionConstructors(LightRig)
PPTX_LOGIC_BASE2(LightRig)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_lightRig;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:rot")
{
rot = oReader;
break;
}
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("dir"), dir)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("rig"), rig)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
dir = node.GetAttribute(_T("dir"));
rig = node.GetAttribute(_T("rig"));
std::wstring sRotNodeName = _T("a:rot");
rot = node.ReadNode(sRotNodeName);
rot = node.ReadNode(L"a:rot");
FillParentPointersForChilds();
}
virtual std::wstring toXML() const
......
......@@ -43,9 +43,26 @@ namespace PPTX
class Lin : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Lin)
WritingElement_AdditionConstructors(Lin)
PPTX_LOGIC_BASE2(Lin)
public:
virtual OOX::EElementType getType () const
{
return OOX::et_a_lin;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("ang"), ang)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("scaled"), scaled)
WritingElement_ReadAttributes_End ( oReader )
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"ang", ang);
......
......@@ -44,9 +44,26 @@ namespace PPTX
class LineEnd : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(LineEnd)
WritingElement_AdditionConstructors(LineEnd)
PPTX_LOGIC_BASE2(LineEnd)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_buSzPts;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start_No_NS( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w"), w )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("type"), type )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("len"), len )
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = node.GetName();
......
......@@ -44,11 +44,47 @@ namespace PPTX
class LineJoin : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(LineJoin)
WritingElement_AdditionConstructors(LineJoin)
PPTX_LOGIC_BASE2(LineJoin)
virtual bool is_init()const{return (type==JoinEmpty);};
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring name = oReader.GetName();
type = JoinEmpty;
if (name == _T("round"))
type = JoinRound;
else if (name == _T("bevel"))
type = JoinBevel;
else if (name == _T("miter"))
{
type = JoinMiter;
ReadAttributes(oReader);
}
Normalize();
}
virtual OOX::EElementType getType () const
{
if(type == JoinRound)
return OOX::et_a_round;
else if(type == JoinBevel)
return OOX::et_a_bevel;
else if(type == JoinMiter)
return OOX::et_a_miter;
else
return OOX::et_Unknown;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("lim"), lim )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void GetJoinFrom(XmlUtils::CXmlNode& element)
{
type = JoinEmpty;
......
......@@ -49,9 +49,57 @@ namespace PPTX
class Ln : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Ln)
WritingElement_AdditionConstructors(Ln)
PPTX_LOGIC_BASE2(Ln)
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
//m_eDashType = OOX::Drawing::linedashtypeUnknown;
std::wstring sName = oReader.GetName();
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
sName = oReader.GetName();
if (_T("a:bevel") == sName ||
_T("a:miter") == sName ||
_T("a:round") == sName )
{
Join.fromXML(oReader);
}
else if ( _T("a:tailEnd") == sName )
tailEnd = oReader;
else if ( _T("a:headEnd") == sName )
headEnd = oReader;
else if ( _T("a:gradFill") == sName ||
_T("a:noFill") == sName ||
_T("a:pattFill") == sName ||
_T("a:solidFill") == sName )
{
Fill.fromXML(oReader);
}
else if ( _T("a:custDash") == sName )
{
//custDash = oReader;
//m_eDashType = OOX::Drawing::linedashtypeCustom;
}
else if ( _T("a:prstDash") == sName )
{
prstDash = oReader;
//m_eDashType = OOX::Drawing::linedashtypePreset;
}
//else if ( _T("a:extLst") == sName )
// extLst = oReader;
}
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = _T("a:ln");
......@@ -67,10 +115,20 @@ namespace PPTX
headEnd = node.ReadNodeNoNS(_T("headEnd"));
tailEnd = node.ReadNodeNoNS(_T("tailEnd"));
Normalize();
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("algn"), algn )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cap"), cap )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cmpd"), cmpd )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w"), w )
WritingElement_ReadAttributes_End( oReader )
Normalize();
}
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
......@@ -272,6 +330,8 @@ namespace PPTX
}
public:
// OOX::Drawing::ELineDashType m_eDashType; // Тип штриха
UniFill Fill;
nullable<PrstDash> prstDash;
//custDash (Custom Dash) ยง20.1.8.21
......@@ -279,6 +339,8 @@ namespace PPTX
nullable<LineEnd> headEnd;
nullable<LineEnd> tailEnd;
// nullable<ExtLst> extLst;
nullable_limit<Limit::PenAlign> algn;
nullable_limit<Limit::LineCap> cap;
nullable_limit<Limit::CompoundLine> cmpd;
......
......@@ -43,7 +43,8 @@ namespace PPTX
class WavAudioFile : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(WavAudioFile)
WritingElement_AdditionConstructors(WavAudioFile)
PPTX_LOGIC_BASE2(WavAudioFile)
WavAudioFile& operator=(const WavAudioFile& oSrc)
{
......@@ -55,7 +56,22 @@ namespace PPTX
m_name = oSrc.m_name;
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_snd; //todooo расширить ...
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_name = XmlUtils::GetNameNoNS(oReader.GetName());
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:embed"), embed )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("name"), name )
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = XmlUtils::GetNameNoNS(node.GetName());
......
......@@ -45,7 +45,8 @@ namespace PPTX
class Paragraph : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Paragraph)
WritingElement_AdditionConstructors(Paragraph)
PPTX_LOGIC_BASE2(Paragraph)
Paragraph& operator=(const Paragraph& oSrc)
{
......@@ -56,7 +57,9 @@ namespace PPTX
endParaRPr = oSrc.endParaRPr;
for (size_t i=0 ; i < oSrc.RunElems.size(); i++)
{
RunElems.push_back(oSrc.RunElems[i]);
}
return *this;
}
......@@ -109,7 +112,64 @@ namespace PPTX
FillParentPointersForChilds();
}
virtual void fromXML2(XmlUtils::CXmlLiteReader& oReader, bool bClear)
{
if (bClear)
{
RunElems.clear();
}
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring strName = oReader.GetName();
WritingElement *pItem = NULL;
if (_T("pPr") == strName)
pPr = oReader;
else if (_T("endParaRPr") == strName)
endParaRPr = oReader;
else if ((_T("r") == strName) || (_T("fld") == strName) || (_T("br") == strName) || (_T("m") == strName))
RunElems.push_back(RunElem(oReader));
else if (_T("AlternateContent") == strName)
{
int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
{
std::wstring strName1 = oReader.GetName();
if (_T("mc:Choice") == strName1)
{//GetAttributeIfExist(L"Requires", sRequires) && L"a14" == sRequires)
fromXML2(oReader, false);
break;
}
else if (_T("mc:Fallback") == strName1)
{
fromXML2(oReader, false);
}
}
}
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
fromXML2(oReader, true);
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_p;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
fromXML2(node, true);
......@@ -338,9 +398,10 @@ namespace PPTX
{
std::wstring result = _T("");
size_t count = RunElems.size();
for (size_t i = 0; i < count; ++i)
for (size_t i = 0; i < RunElems.size(); ++i)
{
result += RunElems[i].GetText();
}
result = result + _T("\n");
return result;
......
......@@ -45,9 +45,36 @@ namespace PPTX
class Path : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Path)
WritingElement_AdditionConstructors(Path)
PPTX_LOGIC_BASE2(Path)
public:
virtual OOX::EElementType getType () const
{
return OOX::et_a_path;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("fillToRect") == strName)
rect = oReader;
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("path"), path )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"path", path);
......
......@@ -44,9 +44,23 @@ namespace PPTX
class PrstDash : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(PrstDash)
WritingElement_AdditionConstructors(PrstDash)
PPTX_LOGIC_BASE2(PrstDash)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_prstDash;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), val )
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"val", val);
......
......@@ -43,9 +43,26 @@ namespace PPTX
class Rect : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Rect)
WritingElement_AdditionConstructors(Rect)
PPTX_LOGIC_BASE2(Rect)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_rect;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("t"), t )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("l"), l )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("r"), r )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("b"), b )
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = node.GetName();
......
......@@ -43,9 +43,32 @@ namespace PPTX
class Rot : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Rot)
WritingElement_AdditionConstructors(Rot)
PPTX_LOGIC_BASE2(Rot)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_rot;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
nullable_int lat_, lon_, rev_;
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("lat"), lat_)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("lon"), lon_)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("rev"), rev_)
WritingElement_ReadAttributes_End( oReader )
lat = lat_.get_value_or(0);
lon = lon_.get_value_or(0);
rev = rev_.get_value_or(0);
Normalize();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
lat = node.ReadAttributeInt(L"lat");
......
......@@ -47,9 +47,32 @@ namespace PPTX
class RunElem : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(RunElem)
WritingElement_AdditionConstructors(RunElem)
RunElem() {}
virtual OOX::EElementType getType () const
{
if (Elem.IsInit())
return Elem->getType();
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring name = oReader.GetName();
if(name == _T("r"))
Elem.reset(new Logic::Run(oReader));
else if(name == _T("fld"))
Elem.reset(new Logic::Fld(oReader));
else if(name == _T("br"))
Elem.reset(new Logic::Br(oReader));
else if(name == _T("m"))
Elem.reset(new Logic::MathParaWrapper(oReader));
else
Elem.reset();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
std::wstring name = XmlUtils::GetNameNoNS(node.GetName());
......@@ -62,7 +85,8 @@ namespace PPTX
Elem.reset(new Logic::Br(node));
else if(name == _T("m"))
Elem.reset(new Logic::MathParaWrapper(node));
else Elem.reset();
else
Elem.reset();
}
virtual std::wstring toXML() const
{
......
......@@ -47,12 +47,107 @@ namespace PPTX
{
namespace Logic
{
class RunProperties : public WrapperWritingElement
class Rtl : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(RunProperties)
WritingElement_AdditionConstructors(Rtl)
PPTX_LOGIC_BASE2(Rtl)
virtual OOX::EElementType getType () const
{
return OOX::et_a_rtl;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
}
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
return XmlUtils::CreateNode(L"a:rtl", oAttr);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // start attributes
pReader->Seek(_end_rec);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->WriteString(L"<a:rtl/>");
}
protected:
virtual void FillParentPointersForChilds(){};
};
class RunProperties : public WrapperWritingElement
{
public:
WritingElement_AdditionConstructors(RunProperties)
PPTX_LOGIC_BASE2(RunProperties)
virtual OOX::EElementType getType () const
{
return OOX::et_a_rPr;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = oReader.GetName();
if (L"a:blipFill" == sName ||
L"a:gradFill" == sName ||
L"a:grpFill" == sName ||
L"a:noFill" == sName ||
L"a:pattFill" == sName ||
L"a:solidFill" == sName )
{
Fill.fromXML(oReader);
}
else if ( _T("a:ln") == sName )
ln = oReader;
else if ( _T("a:cs") == sName )
cs = oReader;
else if ( _T("a:ea") == sName )
ea = oReader;
else if ( _T("a:latin") == sName )
latin = oReader;
else if ( _T("a:sym") == sName )
sym = oReader;
else if ( _T("a:hlinkClick") == sName )
hlinkClick = oReader;
else if ( _T("a:rtl") == sName )
rtl = oReader;
else if ( L"a:effectDag" == sName ||
L"a:effectLst" == sName ||
L"a:extLst" == sName )
{
EffectList.fromXML(oReader);
}
}
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = node.GetName();
......@@ -102,6 +197,8 @@ namespace PPTX
hlinkClick = oNode;
else if (_T("hlinkMouseOver") == strName)
hlinkMouseOver = oNode;
else if (_T("rtl") == strName)
rtl = oNode;
}
}
......@@ -112,6 +209,25 @@ namespace PPTX
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("b"), b)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("i"), i)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sz"), sz)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("u"), u)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("baseline"), baseline)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("spc"), spc)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lang"), lang)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kumimoji"), kumimoji)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dirty"), dirty)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("normalizeH"), normalizeH)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("noProof"), noProof)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("smtClean"), smtClean)
WritingElement_ReadAttributes_End ( oReader )
Normalize();
}
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
......@@ -145,6 +261,7 @@ namespace PPTX
oValue.WriteNullable(sym);
oValue.WriteNullable(hlinkClick);
oValue.WriteNullable(hlinkMouseOver);
oValue.WriteNullable(rtl);
return XmlUtils::CreateNode(m_name, oAttr, oValue);
}
......@@ -186,6 +303,7 @@ namespace PPTX
pWriter->Write(sym);
pWriter->Write(hlinkClick);
pWriter->Write(hlinkMouseOver);
pWriter->Write(rtl);
pWriter->EndNode(m_name);
}
......@@ -275,6 +393,7 @@ namespace PPTX
pWriter->WriteRecord2(7, hlinkClick);
pWriter->WriteRecord2(8, hlinkMouseOver);
pWriter->WriteRecord2(9, rtl);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
......@@ -482,7 +601,7 @@ namespace PPTX
nullable<TextFont> sym;
nullable<Hyperlink> hlinkClick;
nullable<Hyperlink> hlinkMouseOver;
//rtl (Right to Left Run) §21.1.2.2.8
nullable<Rtl> rtl;
// Attributes
nullable_string altLang;
......@@ -504,8 +623,6 @@ namespace PPTX
nullable_limit<Limit::TextStrike> strike;
nullable_int sz;
nullable_limit<Limit::TextUnderline> u;
//private:
public:
std::wstring m_name;
protected:
virtual void FillParentPointersForChilds()
......
......@@ -43,7 +43,8 @@ namespace PPTX
class Br : public RunBase
{
public:
PPTX_LOGIC_BASE(Br)
WritingElement_AdditionConstructors(Br)
PPTX_LOGIC_BASE2(Br)
Br& operator=(const Br& oSrc)
{
......@@ -55,15 +56,27 @@ namespace PPTX
}
virtual OOX::EElementType getType () const
{
return OOX::et_p_br;
return OOX::et_a_br;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
rPr = node.ReadNode(_T("a:rPr"));
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = oReader.GetName();
if ( _T("a:rPr") == sName )
rPr = oReader;
}
}
virtual std::wstring toXML() const
{
XmlUtils::CNodeValue oValue;
......@@ -92,7 +105,7 @@ namespace PPTX
}
virtual std::wstring GetText()const{return _T("\n");};
public:
nullable<RunProperties> rPr;
protected:
virtual void FillParentPointersForChilds()
......
......@@ -44,7 +44,8 @@ namespace PPTX
class Fld : public RunBase
{
public:
PPTX_LOGIC_BASE(Fld)
WritingElement_AdditionConstructors(Fld)
PPTX_LOGIC_BASE2(Fld)
Fld& operator=(const Fld& oSrc)
{
......@@ -61,9 +62,45 @@ namespace PPTX
}
virtual OOX::EElementType getType () const
{
return OOX::et_p_fld;
return OOX::et_a_fld;
}
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("rPr") == strName)
{
if (!rPr.IsInit())
rPr = oReader;
}
else if (_T("pPr") == strName)
{
if (!pPr.IsInit())
pPr = oReader;
}
else if (_T("t") == strName)
{
if (!text.IsInit())
text = oReader.GetText2();
}
}
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("id"), id)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("type"), type )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
id = node.GetAttribute(_T("id"));
......
......@@ -48,6 +48,19 @@ namespace PPTX
m_oMath = oSrc.m_oMath;
return *this;
}
void MathParaWrapper::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring name = oReader.GetName();
if(L"oMathPara" == name)
{
m_oMathPara = oReader;
}
else if(L"oMath" == name)
{
m_oMath = oReader;
}
}
void MathParaWrapper::fromXML(XmlUtils::CXmlNode& node)
{
std::wstring sBegin(_T("<root xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:p=\"urn:schemas-microsoft-com:office:powerpoint\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:x=\"urn:schemas-microsoft-com:office:excel\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\" xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\">"));
......
......@@ -50,8 +50,9 @@ namespace PPTX
class MathParaWrapper : public RunBase
{
public:
PPTX_LOGIC_BASE(MathParaWrapper)
WritingElement_AdditionConstructors(MathParaWrapper)
MathParaWrapper() {}
MathParaWrapper& operator=(const MathParaWrapper& oSrc);
virtual OOX::EElementType getType () const
......@@ -59,6 +60,7 @@ namespace PPTX
return OOX::et_p_MathPara;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
......
......@@ -43,7 +43,8 @@ namespace PPTX
class Run : public RunBase
{
public:
PPTX_LOGIC_BASE(Run)
WritingElement_AdditionConstructors(Run)
PPTX_LOGIC_BASE2(Run)
Run& operator=(const Run& oSrc)
{
......@@ -57,9 +58,29 @@ namespace PPTX
}
virtual OOX::EElementType getType () const
{
return OOX::et_p_r;
return OOX::et_a_r;
}
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"a:rPr" == sName )
{
rPr = oReader ;
}
else if ( L"a:t" == sName )
{
if (!text.IsInit())
text = oReader.GetText2();
}
}
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
XmlUtils::CXmlNodes oNodes;
......
......@@ -46,17 +46,37 @@ namespace PPTX
class Scene3d : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Scene3d)
WritingElement_AdditionConstructors(Scene3d)
PPTX_LOGIC_BASE2(Scene3d)
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_scene3d;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = oReader.GetName();
if (strName == L"a:camera")
camera = oReader;
if (strName == L"a:lightRig")
lightRig = oReader;
if (strName == L"a:backdrop")
backdrop = oReader;
}
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
std::wstring sCameraNodeName = _T("a:camera");
std::wstring sLightRigNodeName = _T("a:lightRig");
std::wstring sBackdropNodeName = _T("a:backdrop");
camera = node.ReadNode(sCameraNodeName);
lightRig = node.ReadNode(sLightRigNodeName);
backdrop = node.ReadNode(sBackdropNodeName);
camera = node.ReadNode(L"a:camera");
lightRig = node.ReadNode(L"a:lightRig");
backdrop = node.ReadNode(L"a:backdrop");
FillParentPointersForChilds();
}
......
......@@ -46,7 +46,8 @@ namespace PPTX
class Sp3d : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Sp3d)
WritingElement_AdditionConstructors(Sp3d)
PPTX_LOGIC_BASE2(Sp3d)
Sp3d& operator=(const Sp3d& oSrc)
{
......@@ -66,7 +67,33 @@ namespace PPTX
return *this;
}
public:
virtual OOX::EElementType getType() const
{
return OOX::et_a_prstClr;
}
void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (_T("bevelT") == strName)
bevelT = oReader;
else if (_T("bevelB") == strName)
bevelB = oReader;
else if (_T("extrusionClr") == strName)
extrusionClr.fromXML(oReader);
else if (_T("contourClr") == strName)
contourClr.fromXML(oReader);
}
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"contourW", contourW);
......@@ -98,7 +125,15 @@ namespace PPTX
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("contourW"), contourW)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("extrusionH"), extrusionH)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("prstMaterial"), prstMaterial)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("z"), z)
WritingElement_ReadAttributes_End( oReader )
}
virtual std::wstring toXML() const
{
......
......@@ -43,9 +43,31 @@ namespace PPTX
class Tab : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Tab)
WritingElement_AdditionConstructors(Tab)
PPTX_LOGIC_BASE2(Tab)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
public:
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
}
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_tab;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_End ( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"pos", pos);
......
......@@ -44,14 +44,14 @@ namespace PPTX
public:
enum eFit {FitEmpty = 0, FitNo = 1, FitSpAuto = 2, FitNormAuto = 3};
TextFit(){
WritingElement_AdditionConstructors(TextFit)
TextFit()
{
type = FitEmpty;
}
PPTX_LOGIC_BASE2(TextFit)
virtual bool is_init(){return (type != FitEmpty);};
public:
void GetTextFitFrom(XmlUtils::CXmlNode& element)
{
type = FitEmpty;
......@@ -101,6 +101,26 @@ namespace PPTX
}
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_textFit;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
}
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
type = FitEmpty;
......
......@@ -39,41 +39,129 @@ namespace PPTX
{
namespace Logic
{
class TextFont : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(TextFont)
WritingElement_AdditionConstructors(TextFont)
PPTX_LOGIC_BASE2(TextFont)
public:
virtual OOX::EElementType getType () const
{
return m_eType;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_eType = OOX::et_Unknown;
m_name = node.GetName();
if ( _T("a:cs") == m_name )
m_eType = OOX::et_a_cs;
else if ( _T("a:ea") == m_name )
m_eType = OOX::et_a_ea;
else if ( _T("a:latin") == m_name )
m_eType = OOX::et_a_latin;
else if ( _T("a:sym") == m_name )
m_eType = OOX::et_a_sym;
node.ReadAttributeBase(L"charset", charset);
node.ReadAttributeBase(L"panose", panose);
node.ReadAttributeBase(L"pitchFamily", pitchFamily);
typeface = node.GetAttribute(_T("typeface"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = OOX::et_Unknown;
m_name = oReader.GetName();
if ( _T("a:cs") == m_name )
m_eType = OOX::et_a_cs;
else if ( _T("a:ea") == m_name )
m_eType = OOX::et_a_ea;
else if ( _T("a:latin") == m_name )
m_eType = OOX::et_a_latin;
else if ( _T("a:sym") == m_name )
m_eType = OOX::et_a_sym;
else
return;
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring toXML() const
{
std::wstring name = m_name;
if (name.empty())
{
switch ( m_eType )
{
case OOX::et_a_cs: name = _T("a:cs"); break;
case OOX::et_a_ea: name = _T("a:ea"); break;
case OOX::et_a_latin: name = _T("a:latin"); break;
case OOX::et_a_sym: name = _T("a:sym"); break;
default: return _T("");
}
}
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("typeface"), typeface);
oAttr.Write(_T("pitchFamily"), pitchFamily);
oAttr.Write(_T("charset"), charset);
oAttr.Write(_T("panose"), panose);
return XmlUtils::CreateNode(m_name, oAttr);
return XmlUtils::CreateNode(name, oAttr);
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
if ( oReader.GetAttributesCount() <= 0 )
return;
if ( !oReader.MoveToFirstAttribute() )
return;
std::wstring wsName = oReader.GetName();
while( !wsName.empty() )
{
wchar_t wsChar0 = wsName[0];
switch ( wsChar0 )
{
case 'c':
if ( _T("charset") == wsName ) charset = oReader.GetText();
break;
case 'p':
if ( _T("panose") == wsName ) panose = oReader.GetText();
else if ( _T("pitchFamily") == wsName ) pitchFamily = oReader.GetText();
break;
case 't':
if ( _T("typeface") == wsName ) typeface = oReader.GetText();
break;
}
if ( !oReader.MoveToNextAttribute() )
break;
wsName = oReader.GetName();
}
oReader.MoveToElement();
}
void Merge(nullable<TextFont>& font)const
{
if(!font.is_init())
font = TextFont();
if(charset.is_init()) font->charset = *charset;
if(panose.is_init()) font->panose = *panose;
if(pitchFamily.is_init()) font->pitchFamily = *pitchFamily;
font->typeface = typeface;
}
......@@ -155,9 +243,9 @@ namespace PPTX
nullable_string panose;
nullable_string pitchFamily;
std::wstring typeface;
//private:
public:
std::wstring m_name;
OOX::EElementType m_eType;
protected:
virtual void FillParentPointersForChilds(){};
};
......
......@@ -52,7 +52,8 @@ namespace PPTX
class TextParagraphPr : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(TextParagraphPr)
WritingElement_AdditionConstructors(TextParagraphPr)
PPTX_LOGIC_BASE2(TextParagraphPr)
TextParagraphPr& operator=(const TextParagraphPr& oSrc)
{
......@@ -88,7 +89,45 @@ namespace PPTX
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = oReader.GetName();
if ( _T("a:lnSpc") == sName )
lnSpc = oReader;
else if ( _T("a:defRPr") == sName )
defRPr = oReader;
else if ( _T("a:spcAft") == sName )
spcAft = oReader;
else if ( _T("a:spcBef") == sName )
spcBef = oReader;
//else if ( _T("a:extLst") == sName )
// extLst = oReader;
else if ( _T("a:buBlip") == sName || _T("a:buChar") == sName || _T("a:buAutoNum") == sName || sName == _T("buNone"))
ParagraphBullet.fromXML(oReader);
else if ( _T("a:buClr") == sName || sName == _T("a:buClrTx"))
buColor.fromXML(oReader);
else if ( _T("a:buFont") == sName || _T("a:buFontTx") == sName )
buTypeface.fromXML( oReader);
else if ( _T("a:buSzTx") == sName || sName == _T("a:buSzPct") || sName == _T("a:buSzPts"))
buSize.fromXML(oReader);
}
}
virtual OOX::EElementType getType() const
{
return OOX::et_a_pPr;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = node.GetName();
......@@ -139,6 +178,19 @@ namespace PPTX
FillParentPointersForChilds();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("rtl"), rtl)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lvl"), lvl)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("algn"), algn)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("fontAlgn"),fontAlgn)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("marL"), marR)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("marR"), marL)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("indent"), indent)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("defTabSz"),defTabSz)
WritingElement_ReadAttributes_End ( oReader )
}
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
......
......@@ -43,9 +43,45 @@ namespace PPTX
class TextSpacing : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(TextSpacing)
WritingElement_AdditionConstructors(TextSpacing)
PPTX_LOGIC_BASE2(TextSpacing)
virtual OOX::EElementType getType () const
{
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_name = oReader.GetName();
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
std::wstring sName = oReader.GetName();
nullable_int val;
if (sName == L"a:spcPct")
{
ReadAttributes(oReader, val);
spcPct = val;
}
if (sName == L"a:spcPts")
{
ReadAttributes(oReader, val);
spcPts = val;
}
}
Normalize();
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader, nullable_int & val)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
WritingElement_ReadAttributes_End ( oReader )
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = node.GetName();
......
......@@ -64,8 +64,32 @@ namespace PPTX
fromXML(node);
return *this;
}
void UniColor::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring name = XmlUtils::GetNameNoNS(oReader.GetName());
if (name == _T("srgbClr"))
Color.reset(new Logic::SrgbClr(oReader));
else if (name == _T("scrgbClr"))
{
Logic::SrgbClr* pSrgbClr = new Logic::SrgbClr(oReader);
pSrgbClr->fromXML(oReader);
Color.reset(pSrgbClr);
}
else if (name == _T("prstClr"))
Color.reset(new Logic::PrstClr(oReader));
else if (name == _T("schemeClr"))
Color.reset(new Logic::SchemeClr(oReader));
else if (name == _T("sysClr"))
Color.reset(new Logic::SysClr(oReader));
else Color.reset();
}
OOX::EElementType UniColor::getType () const
{
if (Color.IsInit())
return Color->getType();
return OOX::et_Unknown;
}
void UniColor::fromXML(XmlUtils::CXmlNode& node)
{
std::wstring name = XmlUtils::GetNameNoNS(node.GetName());
......
......@@ -48,8 +48,11 @@ namespace PPTX
explicit UniColor(XmlUtils::CXmlNode& node);
const UniColor& operator =(XmlUtils::CXmlNode& node);
public:
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual OOX::EElementType getType () const;
virtual void GetColorFrom(XmlUtils::CXmlNode& element);
virtual bool is_init()const{return (Color.IsInit());};
......
......@@ -86,7 +86,108 @@ namespace PPTX
fromXML(node);
return *this;
}
void UniEffect::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring name = oReader.GetName();
switch ((int)name[0])
{
case 'a':
{
if (name == _T("alphaCeiling")) { Effect.reset(new Logic::AlphaCeiling(oReader)); break; } //1
if (name == _T("alphaFloor")) { Effect.reset(new Logic::AlphaFloor(oReader)); break; } //2
if (name == _T("alphaRepl")) { Effect.reset(new Logic::AlphaRepl(oReader)); break; } //3
if (name == _T("alphaOutset")) { Effect.reset(new Logic::AlphaOutset(oReader)); break; } //4
if (name == _T("alphaModFix")) { Effect.reset(new Logic::AlphaModFix(oReader)); break; } //5
if (name == _T("alphaBiLevel")) { Effect.reset(new Logic::AlphaBiLevel(oReader)); break; } //6
if (name == _T("alphaInv")) { Effect.reset(new Logic::AlphaInv(oReader)); break; } //7
if (name == _T("alphaMod")) { Effect.reset(new Logic::AlphaMod(oReader)); break; } //8
break;
}
case 'b':
{
if (name == _T("blur")) { Effect.reset(new Logic::Blur(oReader)); break; } //9
if (name == _T("biLevel")) { Effect.reset(new Logic::BiLevel(oReader)); break; } //10
if (name == _T("blend")) { Effect.reset(new Logic::Blend(oReader)); break; } //11
break;
}
case 'c':
{
if (name == _T("cont")) { Effect.reset(new Logic::EffectDag(oReader)); break; } //12
if (name == _T("clrRepl")) { Effect.reset(new Logic::ClrRepl(oReader)); break; } //13
if (name == _T("clrChange")){ Effect.reset(new Logic::ClrChange(oReader)); break; } //14
break;
}
case 'd':
{
if (name == _T("duotone")) { Effect.reset(new Logic::Duotone(oReader)); break; } //15
break;
}
case 'e':
{
if (name == _T("effect")) { Effect.reset(new Logic::EffectElement(oReader)); break; } //16
break;
}
case 'f':
{
if (name == _T("fillOverlay")){ Effect.reset(new Logic::FillOverlay(oReader)); break; } //17
if (name == _T("fill")) { Effect.reset(new Logic::FillEffect(oReader)); break; } //18
break;
}
case 'g':
{
if (name == _T("glow")) { Effect.reset(new Logic::Glow(oReader)); break; } //19
if (name == _T("grayscl")) { Effect.reset(new Logic::Grayscl(oReader)); break; } //20
break;
}
case 'h':
{
if (name == _T("hsl")) { Effect.reset(new Logic::HslEffect(oReader)); break; } //21
break;
}
case 'i':
{
if (name == _T("innerShdw")){ Effect.reset(new Logic::InnerShdw(oReader)); break; } //22
break;
}
case 'l':
{
if (name == _T("lum")) { Effect.reset(new Logic::LumEffect(oReader)); break; } //23
break;
}
case 'o':
{
if (name == _T("outerShdw")){ Effect.reset(new Logic::OuterShdw(oReader)); break; } //24
break;
}
case 'p':
{
if (name == _T("prstShdw")){ Effect.reset(new Logic::PrstShdw(oReader)); break; } //25
break;
}
case 'r':
{
if (name == _T("reflection")) { Effect.reset(new Logic::Reflection(oReader)); break; } //26
if (name == _T("relOff")) { Effect.reset(new Logic::RelOff(oReader)); break; } //27
break;
}
case 's':
{
if (name == _T("softEdge")) { Effect.reset(new Logic::SoftEdge(oReader)); break; } //28
break;
}
case 't':
{
if (name == _T("tint")) { Effect.reset(new Logic::TintEffect(oReader)); break; } //29
break;
}
case 'x':
{
if (name == _T("xfrm")) { Effect.reset(new Logic::XfrmEffect(oReader)); break; } //30
break;
}
}
}
void UniEffect::fromXML(XmlUtils::CXmlNode& node)
{
std::wstring name = XmlUtils::GetNameNoNS(node.GetName());
......
......@@ -47,7 +47,14 @@ namespace PPTX
explicit UniEffect(XmlUtils::CXmlNode& node);
const UniEffect& operator =(XmlUtils::CXmlNode& node);
public:
virtual OOX::EElementType getType () const
{
if (Effect.is_init())
return Effect->getType();
else return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void GetEffectFrom(XmlUtils::CXmlNode& element);
virtual bool is_init()const{return (Effect.IsInit());};
......
......@@ -48,8 +48,50 @@ namespace PPTX
class UniFill : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(UniFill)
public:
WritingElement_AdditionConstructors(UniFill)
PPTX_LOGIC_BASE2(UniFill)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring name = oReader.GetName();
if (name == _T("a:blipFill"))
{
m_type = blipFill;
Fill.reset(new Logic::BlipFill(oReader));
}
else if(name == _T("a:noFill"))
{
m_type = noFill;
Fill.reset(new Logic::NoFill(oReader));
}
else if(name == _T("a:solidFill"))
{
m_type = solidFill;
Fill.reset(new Logic::SolidFill(oReader));
}
else if(name == _T("a:gradFill"))
{
m_type = gradFill;
Fill.reset(new Logic::GradFill(oReader));
}
else if(name == _T("a:pattFill"))
{
m_type = pattFill;
Fill.reset(new Logic::PattFill(oReader));
}
else if(name == _T("a:grpFill"))
{
m_type = grpFill;
Fill.reset(new Logic::GrpFill(oReader));
}
else
{
m_type = notInit;
Fill.reset();
}
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
std::wstring name = XmlUtils::GetNameNoNS(node.GetName());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment