This commit is contained in:
ElenaSubbotina
2025-04-15 14:42:26 +03:00
parent 809effa5df
commit bd7914e7c7
14 changed files with 375 additions and 221 deletions

View File

@ -39,8 +39,34 @@ namespace PPTX
void BgPr::fromXML(XmlUtils::CXmlNode& node) void BgPr::fromXML(XmlUtils::CXmlNode& node)
{ {
XmlMacroReadAttributeBase(node, L"shadeToTitle", shadeToTitle); XmlMacroReadAttributeBase(node, L"shadeToTitle", shadeToTitle);
Fill.GetFillFrom(node);
EffectList.GetEffectListFrom(node); std::vector<XmlUtils::CXmlNode> oNodes;
if (node.GetNodes(L"*", oNodes))
{
size_t nCount = oNodes.size();
for (size_t i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode& oNode = oNodes[i];
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (L"blipFill" == strName ||
L"gradFill" == strName ||
L"grpFill" == strName ||
L"noFill" == strName ||
L"pattFill" == strName ||
L"solidFill" == strName)
{
Fill.fromXML(oNode);
}
else if (L"effectDag" == strName ||
L"effectLst" == strName)
{
EffectList.fromXML(oNode);
}
}
}
FillParentPointersForChilds(); FillParentPointersForChilds();
} }

View File

@ -50,8 +50,6 @@ namespace PPTX
} }
void EffectLst::fromXML(XmlUtils::CXmlLiteReader& oReader) void EffectLst::fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() ) if ( oReader.IsEmptyNode() )
return; return;
@ -197,7 +195,19 @@ namespace PPTX
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
EffectLst& EffectLst::operator=(const EffectLst& oSrc)
{
blur = oSrc.blur;
fillOverlay = oSrc.fillOverlay;
glow = oSrc.glow;
innerShdw = oSrc.innerShdw;
outerShdw = oSrc.outerShdw;
prstShdw = oSrc.prstShdw;
reflection = oSrc.reflection;
softEdge = oSrc.softEdge;
return *this;
}
void EffectLst::Merge(EffectLst& effectLst) const void EffectLst::Merge(EffectLst& effectLst) const
{ {
if (blur.IsInit()) if (blur.IsInit())

View File

@ -30,8 +30,6 @@
* *
*/ */
#pragma once #pragma once
#ifndef PPTX_LOGIC_EFFECTLST_INCLUDE_H_
#define PPTX_LOGIC_EFFECTLST_INCLUDE_H_
#include "./../WrapperWritingElement.h" #include "./../WrapperWritingElement.h"
#include "Effects/Blur.h" #include "Effects/Blur.h"
@ -61,10 +59,6 @@ namespace PPTX
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
}
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
@ -90,5 +84,3 @@ namespace PPTX
}; };
} // namespace Logic } // namespace Logic
} // namespace PPTX } // namespace PPTX
#endif // PPTX_LOGIC_EFFECTLST_INCLUDE_H_

View File

@ -35,6 +35,52 @@ namespace PPTX
{ {
namespace Logic namespace Logic
{ {
EffectProperties& EffectProperties::operator=(const EffectProperties& oSrc)
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
List.reset();
if (oSrc.List.IsInit())
{
if (oSrc.List.is<EffectLst>())
{
List.reset(new EffectLst());
List.as<EffectLst>() = oSrc.List.as<EffectLst>();
}
else if (oSrc.List.is<EffectDag>())
{
List.reset(new EffectDag());
List.as<EffectDag>() = oSrc.List.as<EffectDag>();
}
}
return *this;
}
OOX::EElementType EffectProperties::getType() const
{
if (List.IsInit())
return List->getType();
return OOX::et_Unknown;
}
void EffectProperties::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"effectLst")
{
Logic::EffectLst* pEffectLst = new Logic::EffectLst();
*pEffectLst = oReader;
List.reset(pEffectLst);
}
else if (strName == L"effectDag")
{
Logic::EffectDag* pEffectDag = new Logic::EffectDag();
*pEffectDag = oReader;
List.reset(pEffectDag);
}
else
List.reset();
}
void EffectProperties::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader) void EffectProperties::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{ {
LONG pos = pReader->GetPos(); LONG pos = pReader->GetPos();
@ -60,6 +106,50 @@ namespace PPTX
pReader->SkipRecord(); pReader->SkipRecord();
} }
} }
void EffectProperties::fromXML(XmlUtils::CXmlNode& node)
{
std::wstring strName = XmlUtils::GetNameNoNS(node.GetName());
if (L"effectLst" == strName)
{
Logic::EffectLst* pEffectLst = new Logic::EffectLst();
pEffectLst->fromXML(node);
List.reset(pEffectLst);
}
else if (L"effectDag" == strName)
{
Logic::EffectDag* pEffectDag = new Logic::EffectDag();
pEffectDag->fromXML(node);
List.reset(pEffectDag);
}
else List.reset();
}
std::wstring EffectProperties::toXML() const
{
if (!List.IsInit())
return L"";
return List->toXML();
}
void EffectProperties::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
if (List.is_init())
List->toXmlWriter(pWriter);
}
void EffectProperties::Merge(EffectProperties& effectProperties) const
{
if (List.IsInit() && List.is<EffectLst>())
{
effectProperties.List.reset(new EffectLst());
List.as<EffectLst>().Merge(effectProperties.List.as<EffectLst>());
}
}
void EffectProperties::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
if (List.is_init())
List->toPPTY(pWriter);
}
} // namespace Logic } // namespace Logic
} // namespace PPTX } // namespace PPTX

View File

@ -30,8 +30,6 @@
* *
*/ */
#pragma once #pragma once
#ifndef PPTX_LOGIC_EFFECTPROPERTIES_INCLUDE_H_
#define PPTX_LOGIC_EFFECTPROPERTIES_INCLUDE_H_
#include "./../WrapperWritingElement.h" #include "./../WrapperWritingElement.h"
#include "EffectLst.h" #include "EffectLst.h"
@ -47,39 +45,10 @@ namespace PPTX
WritingElement_AdditionMethods(EffectProperties) WritingElement_AdditionMethods(EffectProperties)
PPTX_LOGIC_BASE2(EffectProperties) PPTX_LOGIC_BASE2(EffectProperties)
EffectProperties& operator=(const EffectProperties& oSrc) EffectProperties& operator=(const EffectProperties& oSrc);
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
return *this; virtual OOX::EElementType getType() const;
} virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual OOX::EElementType getType () const
{
if (List.IsInit())
return List->getType();
return OOX::et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == _T("effectLst"))
{
Logic::EffectLst* pEffectLst = new Logic::EffectLst();
*pEffectLst = oReader;
List.reset(pEffectLst);
}
else if(strName == _T("effectDag"))
{
Logic::EffectDag* pEffectDag = new Logic::EffectDag();
*pEffectDag = oReader;
List.reset(pEffectDag);
}
else
List.reset();
}
virtual bool is_init() const {return (List.IsInit());}; virtual bool is_init() const {return (List.IsInit());};
@ -87,72 +56,15 @@ namespace PPTX
template<class T> T& as() {return static_cast<T&>(*List);} template<class T> T& as() {return static_cast<T&>(*List);}
template<class T> const T& as() const {return static_cast<const T&>(*List);} template<class T> const T& as() const {return static_cast<const T&>(*List);}
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node);
{
std::wstring strName = XmlUtils::GetNameNoNS(node.GetName());
if (strName == _T("effectLst")) virtual std::wstring toXML() const;
{
Logic::EffectLst* pEffectLst = new Logic::EffectLst();
*pEffectLst = node;
List.reset(pEffectLst);
}
else if(strName == _T("effectDag"))
{
Logic::EffectDag* pEffectDag = new Logic::EffectDag();
*pEffectDag = node;
List.reset(pEffectDag);
}
else List.reset();
}
virtual void GetEffectListFrom(XmlUtils::CXmlNode& element) virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
{
XmlUtils::CXmlNode oNode = element.ReadNodeNoNS(_T("effectLst"));
if (oNode.IsValid())
{
Logic::EffectLst* pEffectLst = new Logic::EffectLst();
*pEffectLst = oNode;
List.reset(pEffectLst);
return;
}
oNode = element.ReadNodeNoNS(_T("effectDag"));
if (oNode.IsValid())
{
Logic::EffectDag* pEffectDag = new Logic::EffectDag();
*pEffectDag = oNode;
List.reset(pEffectDag);
}
else List.reset();
}
virtual std::wstring toXML() const
{
if (!List.IsInit())
return _T("");
return List->toXML();
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
if (List.is_init())
List->toPPTY(pWriter);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader); virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
{
if (List.is_init())
List->toXmlWriter(pWriter);
}
void Merge(EffectProperties& effectProperties) const void Merge(EffectProperties& effectProperties) const;
{
if (List.IsInit() && List.is<EffectLst>())
{
effectProperties.List.reset(new EffectLst());
List.as<EffectLst>().Merge(effectProperties.List.as<EffectLst>());
}
}
nullable<WrapperWritingElement> List; nullable<WrapperWritingElement> List;
protected: protected:
@ -166,5 +78,3 @@ namespace PPTX
}; };
} // namespace Logic } // namespace Logic
} // namespace PPTX } // namespace PPTX
#endif // PPTX_LOGIC_EFFECTPROPERTIES_INCLUDE_H

View File

@ -35,15 +35,52 @@ namespace PPTX
{ {
namespace Logic namespace Logic
{ {
EffectStyle& EffectStyle::operator=(const EffectStyle& oSrc)
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
Effects = oSrc.Effects;
scene3d = oSrc.scene3d;
sp3d = oSrc.sp3d;
return *this;
}
void EffectStyle::fromXML(XmlUtils::CXmlNode& node) void EffectStyle::fromXML(XmlUtils::CXmlNode& node)
{ {
EffectList.GetEffectListFrom(node); std::vector<XmlUtils::CXmlNode> oNodes;
scene3d = node.ReadNode(_T("a:scene3d")); if (node.GetNodes(L"*", oNodes))
sp3d = node.ReadNode(_T("a:sp3d")); {
size_t nCount = oNodes.size();
for (size_t i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode& oNode = oNodes[i];
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (L"scene3d" == strName)
scene3d = oNode;
else if (L"sp3d" == strName)
sp3d = oNode;
else if (L"effectDag" == strName ||
L"effectLst" == strName)
{
Effects.fromXML(oNode);
}
}
}
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
void EffectStyle::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(L"a:effectStyle");
pWriter->EndAttributes();
Effects.toXmlWriter(pWriter);
pWriter->Write(scene3d);
pWriter->Write(sp3d);
pWriter->EndNode(L"a:effectStyle");
}
void EffectStyle::fromXML(XmlUtils::CXmlLiteReader& oReader) void EffectStyle::fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
if ( oReader.IsEmptyNode() ) if ( oReader.IsEmptyNode() )
@ -58,15 +95,49 @@ namespace PPTX
else if (strName == L"a:sp3d") else if (strName == L"a:sp3d")
sp3d = oReader; sp3d = oReader;
else else
EffectList.fromXML(oReader); Effects.fromXML(oReader);
} }
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
void EffectStyle::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteRecord1(0, Effects);
pWriter->WriteRecord2(1, scene3d);
pWriter->WriteRecord2(2, sp3d);
}
void EffectStyle::fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetRecordSize() + 4;
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
Effects.fromPPTY(pReader);
}break;
case 1:
{
scene3d = new Logic::Scene3d();
scene3d->fromPPTY(pReader);
}break;
case 2:
{
sp3d = new Logic::Sp3d();
sp3d->fromPPTY(pReader);
}break;
default:
break;
}
}
pReader->Seek(_end_rec);
}
void EffectStyle::FillParentPointersForChilds() void EffectStyle::FillParentPointersForChilds()
{ {
EffectList.SetParentPointer(this); Effects.SetParentPointer(this);
if(scene3d.IsInit()) if(scene3d.IsInit())
scene3d->SetParentPointer(this); scene3d->SetParentPointer(this);
if(sp3d.IsInit()) if(sp3d.IsInit())

View File

@ -47,16 +47,8 @@ namespace PPTX
WritingElement_AdditionMethods(EffectStyle) WritingElement_AdditionMethods(EffectStyle)
PPTX_LOGIC_BASE2(EffectStyle) PPTX_LOGIC_BASE2(EffectStyle)
EffectStyle& operator=(const EffectStyle& oSrc) EffectStyle& operator=(const EffectStyle& oSrc);
{
parentFile = oSrc.parentFile;
parentElement = oSrc.parentElement;
EffectList = oSrc.EffectList;
scene3d = oSrc.scene3d;
sp3d = oSrc.sp3d;
return *this;
}
virtual OOX::EElementType getType() const virtual OOX::EElementType getType() const
{ {
return OOX::et_a_effectStyle; return OOX::et_a_effectStyle;
@ -64,20 +56,12 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const;
{ virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader);
pWriter->StartNode(_T("a:effectStyle"));
pWriter->EndAttributes();
EffectList.toXmlWriter(pWriter); virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const;
pWriter->Write(scene3d);
pWriter->Write(sp3d);
pWriter->EndNode(_T("a:effectStyle")); EffectProperties Effects;
}
public:
EffectProperties EffectList;
nullable<Scene3d> scene3d; nullable<Scene3d> scene3d;
nullable<Sp3d> sp3d; nullable<Sp3d> sp3d;
protected: protected:

View File

@ -105,7 +105,7 @@ namespace PPTX
void GrpSpPr::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) void GrpSpPr::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("bwMode"), bwMode ) WritingElement_ReadAttributes_ReadSingle( oReader, L"bwMode", bwMode )
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
void GrpSpPr::fromXML(XmlUtils::CXmlNode& node) void GrpSpPr::fromXML(XmlUtils::CXmlNode& node)
@ -115,7 +115,7 @@ namespace PPTX
XmlMacroReadAttributeBase(node, L"bwMode", bwMode); XmlMacroReadAttributeBase(node, L"bwMode", bwMode);
std::vector<XmlUtils::CXmlNode> oNodes; std::vector<XmlUtils::CXmlNode> oNodes;
if (node.GetNodes(_T("*"), oNodes)) if (node.GetNodes(L"*", oNodes))
{ {
size_t count = oNodes.size(); size_t count = oNodes.size();
for (size_t i = 0; i < count; ++i) for (size_t i = 0; i < count; ++i)
@ -123,28 +123,39 @@ namespace PPTX
XmlUtils::CXmlNode& oNode = oNodes[i]; XmlUtils::CXmlNode& oNode = oNodes[i];
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName()); std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (_T("xfrm") == strName) if (L"xfrm" == strName)
{ {
if (!xfrm.IsInit()) if (!xfrm.IsInit())
xfrm = oNode; xfrm = oNode;
} }
else if (_T("scene3d") == strName) else if (L"blipFill" == strName ||
L"gradFill" == strName ||
L"grpFill" == strName ||
L"noFill" == strName ||
L"pattFill" == strName ||
L"solidFill" == strName)
{
Fill.fromXML(oNode);
}
else if (L"scene3d" == strName)
{ {
if (!scene3d.IsInit()) if (!scene3d.IsInit())
scene3d = oNode; scene3d = oNode;
} }
else if (L"effectDag" == strName ||
L"effectLst" == strName)
{
EffectList.fromXML(oNode);
}
} }
} }
Fill.GetFillFrom(node);
EffectList.GetEffectListFrom(node);
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
std::wstring GrpSpPr::toXML() const std::wstring GrpSpPr::toXML() const
{ {
XmlUtils::CAttribute oAttr; XmlUtils::CAttribute oAttr;
oAttr.WriteLimitNullable(_T("bwMode"), bwMode); oAttr.WriteLimitNullable(L"bwMode", bwMode);
XmlUtils::CNodeValue oValue; XmlUtils::CNodeValue oValue;
oValue.WriteNullable(xfrm); oValue.WriteNullable(xfrm);
@ -168,7 +179,7 @@ namespace PPTX
pWriter->StartNode(namespace_ + L":grpSpPr"); pWriter->StartNode(namespace_ + L":grpSpPr");
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("bwMode"), bwMode); pWriter->WriteAttribute(L"bwMode", bwMode);
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->Write(xfrm); pWriter->Write(xfrm);

View File

@ -112,8 +112,6 @@ namespace PPTX
XmlMacroReadAttributeBase(node, L"cmpd", cmpd); XmlMacroReadAttributeBase(node, L"cmpd", cmpd);
XmlMacroReadAttributeBase(node, L"w", w); XmlMacroReadAttributeBase(node, L"w", w);
Fill.GetFillFrom(node);
std::vector<XmlUtils::CXmlNode> oNodes; std::vector<XmlUtils::CXmlNode> oNodes;
if (node.GetNodes(L"*", oNodes)) if (node.GetNodes(L"*", oNodes))
{ {
@ -139,6 +137,20 @@ namespace PPTX
{ {
prstDash = oNode; prstDash = oNode;
} }
else if (L"blipFill" == strName ||
L"gradFill" == strName ||
L"grpFill" == strName ||
L"noFill" == strName ||
L"pattFill" == strName ||
L"solidFill" == strName)
{
Fill.fromXML(oNode);
}
else if (L"effectDag" == strName ||
L"effectLst" == strName)
{
Effects.fromXML(oNode);
}
} }
} }

View File

@ -367,12 +367,23 @@ namespace PPTX
uFillTx = oNode; uFillTx = oNode;
else if (L"highlight" == strName) else if (L"highlight" == strName)
highlight = oNode; highlight = oNode;
else if (L"blipFill" == strName ||
L"gradFill" == strName ||
L"grpFill" == strName ||
L"noFill" == strName ||
L"pattFill" == strName ||
L"solidFill" == strName)
{
Fill.fromXML(oNode);
}
else if (L"effectDag" == strName ||
L"effectLst" == strName)
{
EffectList.fromXML(oNode);
}
} }
} }
Fill.GetFillFrom(node);
EffectList.GetEffectListFrom(node);
Normalize(); Normalize();
FillParentPointersForChilds(); FillParentPointersForChilds();

View File

@ -126,14 +126,10 @@ namespace PPTX
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName()); m_namespace = XmlUtils::GetNamespace(node.GetName());
Geometry.GetGeometryFrom(node);
Fill.GetFillFrom(node);
EffectList.GetEffectListFrom(node);
XmlMacroReadAttributeBase(node,L"bwMode", bwMode); XmlMacroReadAttributeBase(node,L"bwMode", bwMode);
std::vector<XmlUtils::CXmlNode> oNodes; std::vector<XmlUtils::CXmlNode> oNodes;
if (node.GetNodes(_T("*"), oNodes)) if (node.GetNodes(L"*", oNodes))
{ {
size_t nCount = oNodes.size(); size_t nCount = oNodes.size();
for (size_t i = 0; i < nCount; ++i) for (size_t i = 0; i < nCount; ++i)
@ -142,17 +138,35 @@ namespace PPTX
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName()); std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (_T("xfrm") == strName) if (L"xfrm" == strName)
xfrm = oNode; xfrm = oNode;
else if (_T("ln") == strName) else if (L"ln" == strName)
ln = oNode; ln = oNode;
else if (_T("scene3d") == strName) else if (L"scene3d" == strName)
scene3d = oNode; scene3d = oNode;
else if (_T("sp3d") == strName) else if (L"sp3d" == strName)
sp3d = oNode; sp3d = oNode;
else if (L"blipFill" == strName ||
L"gradFill" == strName ||
L"grpFill" == strName ||
L"noFill" == strName ||
L"pattFill" == strName ||
L"solidFill" == strName)
{
Fill.fromXML(oNode);
}
else if ( L"effectDag" == strName ||
L"effectLst" == strName)
{
EffectList.fromXML(oNode);
}
else if (L"prstGeom" == strName ||
L"custGeom" == strName)
{
Geometry.fromXML(oNode);
}
} }
} }
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
std::wstring SpPr::toXML() const std::wstring SpPr::toXML() const
@ -226,42 +240,35 @@ namespace PPTX
case 0: case 0:
{ {
xfrm = new Logic::Xfrm(); xfrm = new Logic::Xfrm();
xfrm->fromPPTY(pReader); xfrm->fromPPTY(pReader);
break; }break;
}
case 1: case 1:
{ {
Geometry.fromPPTY(pReader); Geometry.fromPPTY(pReader);
break; }break;
}
case 2: case 2:
{ {
Fill.fromPPTY(pReader); Fill.fromPPTY(pReader);
break; }break;
}
case 3: case 3:
{ {
ln = new Logic::Ln(); ln = new Logic::Ln();
ln->fromPPTY(pReader); ln->fromPPTY(pReader);
break; }break;
}
case 4: case 4:
{ {
EffectList.fromPPTY(pReader); EffectList.fromPPTY(pReader);
break; }break;
}
case 5: case 5:
{ {
scene3d = new Logic::Scene3d(); scene3d = new Logic::Scene3d();
scene3d->fromPPTY(pReader); scene3d->fromPPTY(pReader);
break; }break;
}
case 6: case 6:
{ {
sp3d = new Logic::Sp3d(); sp3d = new Logic::Sp3d();
sp3d->fromPPTY(pReader); sp3d->fromPPTY(pReader);
break; }break;
}
default: default:
break; break;
} }
@ -276,7 +283,7 @@ namespace PPTX
void SpPr::ReadAttributes(XmlUtils::CXmlLiteReader& oReader) void SpPr::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("bwMode"), bwMode ) WritingElement_ReadAttributes_ReadSingle( oReader, L"bwMode", bwMode )
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
void SpPr::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const void SpPr::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
@ -303,7 +310,7 @@ namespace PPTX
pWriter->StartNode(name_); pWriter->StartNode(name_);
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("bwMode"), bwMode); pWriter->WriteAttribute(L"bwMode", bwMode);
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->Write(xfrm); pWriter->Write(xfrm);
@ -311,7 +318,7 @@ namespace PPTX
if ((pWriter->m_lFlag & 0x02) != 0 && !Fill.is_init()) if ((pWriter->m_lFlag & 0x02) != 0 && !Fill.is_init())
{ {
pWriter->WriteString(_T("<a:grpFill/>")); pWriter->WriteString(L"<a:grpFill/>");
} }
Fill.toXmlWriter(pWriter); Fill.toXmlWriter(pWriter);

View File

@ -118,13 +118,6 @@ namespace PPTX
} }
void TableProperties::fromXML(XmlUtils::CXmlNode& node) void TableProperties::fromXML(XmlUtils::CXmlNode& node)
{ {
Fill.GetFillFrom(node);
Effects.GetEffectListFrom(node);
XmlUtils::CXmlNode oNode;
if (node.GetNode(_T("a:tableStyleId"), oNode))
TableStyleId = oNode.GetTextExt();
XmlMacroReadAttributeBase(node, L"rtl", Rtl); XmlMacroReadAttributeBase(node, L"rtl", Rtl);
XmlMacroReadAttributeBase(node, L"firstRow", FirstRow); XmlMacroReadAttributeBase(node, L"firstRow", FirstRow);
XmlMacroReadAttributeBase(node, L"firstCol", FirstCol); XmlMacroReadAttributeBase(node, L"firstCol", FirstCol);
@ -133,6 +126,36 @@ namespace PPTX
XmlMacroReadAttributeBase(node, L"bandRow", BandRow); XmlMacroReadAttributeBase(node, L"bandRow", BandRow);
XmlMacroReadAttributeBase(node, L"bandCol", BandCol); XmlMacroReadAttributeBase(node, L"bandCol", BandCol);
std::vector<XmlUtils::CXmlNode> oNodes;
if (node.GetNodes(L"*", oNodes))
{
size_t nCount = oNodes.size();
for (size_t i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode& oNode = oNodes[i];
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (L"tableStyleId" == strName)
{
TableStyleId = oNode.GetTextExt();
}
else if (L"blipFill" == strName ||
L"gradFill" == strName ||
L"grpFill" == strName ||
L"noFill" == strName ||
L"pattFill" == strName ||
L"solidFill" == strName)
{
Fill.fromXML(oNode);
}
else if (L"effectDag" == strName ||
L"effectLst" == strName)
{
Effects.fromXML(oNode);
}
}
}
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
void TableProperties::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const void TableProperties::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const

View File

@ -58,19 +58,19 @@ namespace PPTX
effectStyleLst.clear(); effectStyleLst.clear();
bgFillStyleLst.clear(); bgFillStyleLst.clear();
name = node.GetAttribute(_T("name")); name = node.GetAttribute(L"name");
XmlUtils::CXmlNode oNode1 = node.ReadNode(_T("a:fillStyleLst")); XmlUtils::CXmlNode oNode1 = node.ReadNode(L"a:fillStyleLst");
XmlMacroLoadArray(oNode1, _T("*"), fillStyleLst, Logic::UniFill); XmlMacroLoadArray(oNode1, L"*", fillStyleLst, Logic::UniFill);
XmlUtils::CXmlNode oNode2 = node.ReadNode(_T("a:lnStyleLst")); XmlUtils::CXmlNode oNode2 = node.ReadNode(L"a:lnStyleLst");
XmlMacroLoadArray(oNode2, _T("a:ln"), lnStyleLst, Logic::Ln); XmlMacroLoadArray(oNode2, L"a:ln", lnStyleLst, Logic::Ln);
XmlUtils::CXmlNode oNode3 = node.ReadNode(_T("a:effectStyleLst")); XmlUtils::CXmlNode oNode3 = node.ReadNode(L"a:effectStyleLst");
XmlMacroLoadArray(oNode3, _T("a:effectStyle"), effectStyleLst, Logic::EffectStyle); XmlMacroLoadArray(oNode3, L"a:effectStyle", effectStyleLst, Logic::EffectStyle);
XmlUtils::CXmlNode oNode4 = node.ReadNode(_T("a:bgFillStyleLst")); XmlUtils::CXmlNode oNode4 = node.ReadNode(L"a:bgFillStyleLst");
XmlMacroLoadArray(oNode4, _T("*"), bgFillStyleLst, Logic::UniFill); XmlMacroLoadArray(oNode4, L"*", bgFillStyleLst, Logic::UniFill);
FillWithDefaults(); FillWithDefaults();
FillParentPointersForChilds(); FillParentPointersForChilds();
@ -78,38 +78,45 @@ namespace PPTX
std::wstring FmtScheme::toXML() const std::wstring FmtScheme::toXML() const
{ {
XmlUtils::CAttribute oAttr; XmlUtils::CAttribute oAttr;
oAttr.Write(_T("name"), name); oAttr.Write(L"name", name);
XmlUtils::CNodeValue oValue; XmlUtils::CNodeValue oValue;
oValue.WriteArray(_T("a:fillStyleLst"), fillStyleLst); oValue.WriteArray(L"a:fillStyleLst", fillStyleLst);
oValue.WriteArray(_T("a:lnStyleLst"), lnStyleLst); oValue.WriteArray(L"a:lnStyleLst", lnStyleLst);
oValue.WriteArray(_T("a:effectStyleLst"), effectStyleLst); oValue.WriteArray(L"a:effectStyleLst", effectStyleLst);
oValue.WriteArray(_T("a:bgFillStyleLst"), bgFillStyleLst); oValue.WriteArray(L"a:bgFillStyleLst", bgFillStyleLst);
return XmlUtils::CreateNode(_T("a:fmtScheme"), oAttr, oValue); return XmlUtils::CreateNode(L"a:fmtScheme", oAttr, oValue);
} }
void FmtScheme::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const void FmtScheme::toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:fmtScheme")); pWriter->StartNode(L"a:fmtScheme");
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute2(_T("name"), name); pWriter->WriteAttribute2(L"name", name);
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->WriteArray(_T("a:fillStyleLst"), fillStyleLst); pWriter->WriteArray(L"a:fillStyleLst", fillStyleLst);
pWriter->WriteArray(_T("a:lnStyleLst"), lnStyleLst); pWriter->WriteArray(L"a:lnStyleLst", lnStyleLst);
//pWriter->WriteArray(_T("a:effectStyleLst"), effectStyleLst);
// вот такой поуерпоинт (эффекты пока не читаем - а они нужны. даже если и не используются нигде) if (effectStyleLst.empty())
pWriter->WriteString(_T("<a:effectStyleLst><a:effectStyle><a:effectLst>\ {
// вот такой поуерпоинт (эффекты пока не читаем - а они нужны. даже если и не используются нигде)
pWriter->WriteString(L"<a:effectStyleLst><a:effectStyle><a:effectLst>\
<a:outerShdw blurRad=\"40000\" dist=\"20000\" dir=\"5400000\" rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"38000\"/></a:srgbClr></a:outerShdw>\ <a:outerShdw blurRad=\"40000\" dist=\"20000\" dir=\"5400000\" rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"38000\"/></a:srgbClr></a:outerShdw>\
</a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad=\"40000\" dist=\"23000\" dir=\"5400000\" rotWithShape=\"0\">\ </a:effectLst></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad=\"40000\" dist=\"23000\" dir=\"5400000\" rotWithShape=\"0\">\
<a:srgbClr val=\"000000\"><a:alpha val=\"35000\"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst>\ <a:srgbClr val=\"000000\"><a:alpha val=\"35000\"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle><a:effectStyle><a:effectLst>\
<a:outerShdw blurRad=\"40000\" dist=\"23000\" dir=\"5400000\" rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"35000\"/></a:srgbClr>\ <a:outerShdw blurRad=\"40000\" dist=\"23000\" dir=\"5400000\" rotWithShape=\"0\"><a:srgbClr val=\"000000\"><a:alpha val=\"35000\"/></a:srgbClr>\
</a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst>")); </a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst>");
}
else
{
pWriter->WriteArray(L"a:effectStyleLst", effectStyleLst);
}
pWriter->WriteArray(_T("a:bgFillStyleLst"), bgFillStyleLst); pWriter->WriteArray(L"a:bgFillStyleLst", bgFillStyleLst);
pWriter->EndNode(_T("a:fmtScheme")); pWriter->EndNode(L"a:fmtScheme");
} }
void FmtScheme::GetLineStyle(int number, Logic::Ln& lnStyle) const void FmtScheme::GetLineStyle(int number, Logic::Ln& lnStyle) const
{ {

View File

@ -1307,15 +1307,15 @@ void OoxConverter::convert(PPTX::Logic::EffectStyle *oox_effects, DWORD ARGB)
{ {
if (!oox_effects) return; if (!oox_effects) return;
if (oox_effects->EffectList.is_init()) if (oox_effects->Effects.is_init())
{ {
if (oox_effects->EffectList.is<PPTX::Logic::EffectLst>()) if (oox_effects->Effects.is<PPTX::Logic::EffectLst>())
{ {
convert(dynamic_cast<PPTX::Logic::EffectLst*>(oox_effects->EffectList.List.GetPointer()), ARGB); convert(dynamic_cast<PPTX::Logic::EffectLst*>(oox_effects->Effects.List.GetPointer()), ARGB);
} }
else if(oox_effects->EffectList.is<PPTX::Logic::EffectDag>()) else if(oox_effects->Effects.is<PPTX::Logic::EffectDag>())
{ {
convert(dynamic_cast<PPTX::Logic::EffectDag*>(oox_effects->EffectList.List.GetPointer()), ARGB); convert(dynamic_cast<PPTX::Logic::EffectDag*>(oox_effects->Effects.List.GetPointer()), ARGB);
} }
} }
if (oox_effects->scene3d.IsInit()) if (oox_effects->scene3d.IsInit())