init repo
This commit is contained in:
125
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.cpp
Normal file
125
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.cpp
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#include "./stdafx.h"
|
||||
|
||||
#include "Blip.h"
|
||||
#include "./../../Slide.h"
|
||||
#include "./../../SlideMaster.h"
|
||||
#include "./../../SlideLayout.h"
|
||||
#include "./../../Theme.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
void Blip::fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_namespace = XmlUtils::GetNamespace(node.GetName());
|
||||
|
||||
node.ReadAttributeBase(L"r:embed", embed);
|
||||
node.ReadAttributeBase(L"r:link", link);
|
||||
node.ReadAttributeBase(L"cstate", cstate);
|
||||
|
||||
Effects.RemoveAll();
|
||||
node.LoadArray(_T("*"), Effects);
|
||||
|
||||
FillParentPointersForChilds();
|
||||
}
|
||||
|
||||
CString Blip::toXML() const
|
||||
{
|
||||
XmlUtils::CAttribute oAttr;
|
||||
|
||||
if (embed.IsInit())
|
||||
oAttr.Write(_T("r:embed"), embed->ToString());
|
||||
if (link.IsInit())
|
||||
oAttr.Write(_T("r:link"), link->ToString());
|
||||
oAttr.WriteLimitNullable(_T("cstate"), cstate);
|
||||
|
||||
XmlUtils::CNodeValue oValue;
|
||||
oValue.WriteArray(Effects);
|
||||
|
||||
CString strName = (_T("") == m_namespace) ? _T("blip") : (m_namespace + _T(":blip"));
|
||||
return XmlUtils::CreateNode(strName, oAttr, oValue);
|
||||
}
|
||||
|
||||
void Blip::FillParentPointersForChilds()
|
||||
{
|
||||
size_t count = Effects.GetCount();
|
||||
for(size_t i = 0; i < count; ++i)
|
||||
Effects[i].SetParentPointer(this);
|
||||
}
|
||||
|
||||
CString Blip::GetFullPicName(FileContainer* pRels)const
|
||||
{
|
||||
if(embed.IsInit())
|
||||
{
|
||||
if (pRels != NULL)
|
||||
{
|
||||
smart_ptr<OOX::Image> p = pRels->image(*embed);
|
||||
if (p.is_init())
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
|
||||
if(parentFileIs<Slide>())
|
||||
return parentFileAs<Slide>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<SlideLayout>())
|
||||
return parentFileAs<SlideLayout>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<SlideMaster>())
|
||||
return parentFileAs<SlideMaster>().GetMediaFullPathNameFromRId(*embed);
|
||||
else if(parentFileIs<Theme>())
|
||||
return parentFileAs<Theme>().GetMediaFullPathNameFromRId(*embed);
|
||||
return _T("");
|
||||
}
|
||||
else if(link.IsInit())
|
||||
{
|
||||
if (pRels != NULL)
|
||||
{
|
||||
smart_ptr<OOX::Image> p = pRels->image(*link);
|
||||
if (p.is_init())
|
||||
return p->filename().m_strFilename;
|
||||
}
|
||||
|
||||
if(parentFileIs<Slide>())
|
||||
return parentFileAs<Slide>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<SlideLayout>())
|
||||
return parentFileAs<SlideLayout>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<SlideMaster>())
|
||||
return parentFileAs<SlideMaster>().GetMediaFullPathNameFromRId(*link);
|
||||
else if(parentFileIs<Theme>())
|
||||
return parentFileAs<Theme>().GetMediaFullPathNameFromRId(*link);
|
||||
return _T("");
|
||||
}
|
||||
return _T("");
|
||||
}
|
||||
}
|
||||
} // namespace PPTX
|
||||
155
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.h
Normal file
155
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Blip.h
Normal file
@@ -0,0 +1,155 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_BLIP_INCLUDE_H_
|
||||
#define PPTX_LOGIC_BLIP_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
#include "./../../Limit/BlipCompression.h"
|
||||
#include "./../UniEffect.h"
|
||||
#include "../../DocxFormat/RId.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
class Blip : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(Blip)
|
||||
|
||||
Blip& operator=(const Blip& oSrc)
|
||||
{
|
||||
parentFile = oSrc.parentFile;
|
||||
parentElement = oSrc.parentElement;
|
||||
|
||||
Effects.Copy(oSrc.Effects);
|
||||
|
||||
cstate = oSrc.cstate;
|
||||
embed = oSrc.embed;
|
||||
link = oSrc.link;
|
||||
|
||||
m_namespace = oSrc.m_namespace;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node);
|
||||
virtual CString toXML() const;
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
CString strName = (_T("") == m_namespace) ? _T("blip") : (m_namespace + _T(":blip"));
|
||||
pWriter->StartNode(strName);
|
||||
|
||||
pWriter->StartAttributes();
|
||||
if (embed.IsInit())
|
||||
pWriter->WriteAttribute(_T("r:embed"), embed->ToString());
|
||||
if (link.IsInit())
|
||||
pWriter->WriteAttribute(_T("r:link"), link->ToString());
|
||||
pWriter->WriteAttribute(_T("cstate"), cstate);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
|
||||
size_t nCount = Effects.GetCount();
|
||||
for (size_t i = 0; i < nCount; ++i)
|
||||
{
|
||||
Effects[i].toXmlWriter(pWriter);
|
||||
}
|
||||
|
||||
pWriter->EndNode(strName);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteLimit2(0, cstate);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
|
||||
|
||||
|
||||
if (embed.is_init())
|
||||
pWriter->WriteString1(10, embed->get());
|
||||
if (link.is_init())
|
||||
pWriter->WriteString1(11, link->get());
|
||||
|
||||
pWriter->StartRecord(2);
|
||||
ULONG len = (ULONG)Effects.GetCount();
|
||||
pWriter->WriteULONG(len);
|
||||
|
||||
for (ULONG i = 0; i < len; ++i)
|
||||
{
|
||||
pWriter->WriteRecord1(3, Effects[i]);
|
||||
}
|
||||
|
||||
pWriter->EndRecord();
|
||||
|
||||
double dX = 0;
|
||||
double dY = 0;
|
||||
double dW = pWriter->GetWidthMM();
|
||||
double dH = pWriter->GetHeightMM();
|
||||
|
||||
FileContainer* pRels = NULL;
|
||||
if (pWriter->m_pCommonRels.is_init())
|
||||
pRels = pWriter->m_pCommonRels.operator ->();
|
||||
|
||||
NSShapeImageGen::CImageInfo oId = pWriter->m_oCommon.m_oImageManager.WriteImage(this->GetFullPicName(pRels), dX, dY, dW, dH);
|
||||
CString s = oId.GetPath2();
|
||||
|
||||
pWriter->StartRecord(3);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteString1(0, s);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
public:
|
||||
virtual CString GetFullPicName(FileContainer* pRels = NULL)const;
|
||||
public:
|
||||
CAtlArray<UniEffect> Effects;
|
||||
|
||||
nullable_limit<Limit::BlipCompression> cstate;
|
||||
nullable<OOX::RId> embed;
|
||||
nullable<OOX::RId> link;
|
||||
|
||||
public:
|
||||
CString m_namespace;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PPTX_LOGIC_BLIP_INCLUDE_H_
|
||||
433
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
Normal file
433
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/BlipFill.h
Normal file
@@ -0,0 +1,433 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_BLIPFILL_INCLUDE_H_
|
||||
#define PPTX_LOGIC_BLIPFILL_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
#include "./../Rect.h"
|
||||
#include "Blip.h"
|
||||
#include "Tile.h"
|
||||
#include "Stretch.h"
|
||||
#include "../Effects/AlphaModFix.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
|
||||
class BlipFill : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(BlipFill)
|
||||
|
||||
BlipFill& operator=(const BlipFill& oSrc)
|
||||
{
|
||||
parentFile = oSrc.parentFile;
|
||||
parentElement = oSrc.parentElement;
|
||||
|
||||
blip = oSrc.blip;
|
||||
srcRect = oSrc.srcRect;
|
||||
tile = oSrc.tile;
|
||||
stretch = oSrc.stretch;
|
||||
|
||||
dpi = oSrc.dpi;
|
||||
rotWithShape = oSrc.rotWithShape;
|
||||
|
||||
m_namespace = oSrc.m_namespace;
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_namespace = XmlUtils::GetNamespace(node.GetName());
|
||||
|
||||
node.ReadAttributeBase(L"dpi", dpi);
|
||||
node.ReadAttributeBase(L"rotWithShape", rotWithShape);
|
||||
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (node.GetNodes(_T("*"), oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNodes.GetAt(i, oNode);
|
||||
|
||||
CString strName = XmlUtils::GetNameNoNS(oNode.GetName());
|
||||
if (_T("blip") == strName)
|
||||
{
|
||||
if (!blip.IsInit())
|
||||
blip = oNode;
|
||||
}
|
||||
else if (_T("srcRect") == strName)
|
||||
{
|
||||
if (!srcRect.IsInit())
|
||||
srcRect = oNode;
|
||||
}
|
||||
else if (_T("tile") == strName)
|
||||
{
|
||||
if (!tile.IsInit())
|
||||
tile = oNode;
|
||||
}
|
||||
else if (_T("stretch") == strName)
|
||||
{
|
||||
if (!stretch.IsInit())
|
||||
stretch = oNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FillParentPointersForChilds();
|
||||
}
|
||||
|
||||
virtual CString toXML() const
|
||||
{
|
||||
XmlUtils::CAttribute oAttr;
|
||||
oAttr.Write(_T("dpi"), dpi);
|
||||
oAttr.Write(_T("rotWithShape"), rotWithShape);
|
||||
|
||||
XmlUtils::CNodeValue oValue;
|
||||
oValue.WriteNullable(blip);
|
||||
oValue.WriteNullable(srcRect);
|
||||
oValue.WriteNullable(tile);
|
||||
oValue.WriteNullable(stretch);
|
||||
|
||||
CString strName = (_T("") == m_namespace) ? _T("blipFill") : (m_namespace + _T(":blipFill"));
|
||||
return XmlUtils::CreateNode(strName, oAttr, oValue);
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
CString strName = (_T("") == m_namespace) ? _T("blipFill") : (m_namespace + _T(":blipFill"));
|
||||
pWriter->StartNode(strName);
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("dpi"), dpi);
|
||||
pWriter->WriteAttribute(_T("rotWithShape"), rotWithShape);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->Write(blip);
|
||||
|
||||
if (srcRect.is_init())
|
||||
{
|
||||
pWriter->StartNode(_T("a:srcRect"));
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("l"), srcRect->l);
|
||||
pWriter->WriteAttribute(_T("t"), srcRect->t);
|
||||
pWriter->WriteAttribute(_T("r"), srcRect->r);
|
||||
pWriter->WriteAttribute(_T("b"), srcRect->b);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->EndNode(_T("a:srcRect"));
|
||||
}
|
||||
|
||||
pWriter->Write(tile);
|
||||
pWriter->Write(stretch);
|
||||
|
||||
pWriter->EndNode(strName);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(FILL_TYPE_BLIP);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteInt2(0, dpi);
|
||||
pWriter->WriteBool2(1, rotWithShape);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->WriteRecord2(0, blip);
|
||||
pWriter->WriteRecord2(1, srcRect);
|
||||
pWriter->WriteRecord2(2, tile);
|
||||
pWriter->WriteRecord2(3, stretch);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
|
||||
{
|
||||
pReader->Skip(4);
|
||||
BYTE _type = pReader->GetUChar();
|
||||
LONG _e = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1);
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar();
|
||||
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
|
||||
break;
|
||||
|
||||
switch (_at)
|
||||
{
|
||||
case 0:
|
||||
dpi = pReader->GetLong();
|
||||
break;
|
||||
case 1:
|
||||
rotWithShape = pReader->GetBool();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
while (pReader->GetPos() < _e)
|
||||
{
|
||||
BYTE rec = pReader->GetUChar();
|
||||
|
||||
switch (rec)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
LONG _s2 = pReader->GetPos();
|
||||
LONG _e2 = _s2 + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1);
|
||||
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar();
|
||||
if (NSBinPptxRW::g_nodeAttributeEnd == _at)
|
||||
break;
|
||||
|
||||
if (_at == 0)
|
||||
pReader->Skip(1);
|
||||
}
|
||||
|
||||
while (pReader->GetPos() < _e2)
|
||||
{
|
||||
BYTE _t = pReader->GetUChar();
|
||||
|
||||
switch (_t)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
{
|
||||
|
||||
pReader->Skip(4);
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
case 11:
|
||||
{
|
||||
|
||||
pReader->GetString2();
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
pReader->Skip(4);
|
||||
ULONG count_effects = pReader->GetULong();
|
||||
for (ULONG _eff = 0; _eff < count_effects; ++_eff)
|
||||
{
|
||||
pReader->Skip(1);
|
||||
ULONG rec_len = pReader->GetULong();
|
||||
if (0 == rec_len)
|
||||
continue;
|
||||
|
||||
BYTE rec = pReader->GetUChar();
|
||||
|
||||
if (rec == EFFECT_TYPE_ALPHAMODFIX)
|
||||
{
|
||||
|
||||
LONG _e22 = pReader->GetPos() + pReader->GetLong() + 4;
|
||||
|
||||
pReader->Skip(1);
|
||||
|
||||
PPTX::Logic::AlphaModFix* pEffect = new PPTX::Logic::AlphaModFix();
|
||||
while (true)
|
||||
{
|
||||
BYTE _at = pReader->GetUChar();
|
||||
if (NSBinPptxRW::g_nodeAttributeEnd == _at)
|
||||
break;
|
||||
|
||||
if (_at == 0)
|
||||
pEffect->amt = pReader->GetLong();
|
||||
}
|
||||
|
||||
if (!blip.is_init())
|
||||
blip = new PPTX::Logic::Blip();
|
||||
|
||||
blip->Effects.Add();
|
||||
blip->Effects[0].InitPointer(pEffect);
|
||||
|
||||
pReader->Seek(_e22);
|
||||
}
|
||||
else
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
pReader->Skip(6);
|
||||
|
||||
|
||||
CString strUrl = pReader->GetString2();
|
||||
CString strTempFile = _T("");
|
||||
CString strOrigBase64 = _T("");
|
||||
|
||||
if (0 == strUrl.Find(_T("data:")))
|
||||
{
|
||||
strOrigBase64 = strUrl;
|
||||
int nFind = strUrl.Find(_T(","));
|
||||
strUrl.Delete(0, nFind + 1);
|
||||
|
||||
CStringA __s = (CStringA)strUrl;
|
||||
int len = __s.GetLength();
|
||||
int dstLenTemp = Base64DecodeGetRequiredLength(len);
|
||||
|
||||
BYTE* pDstBuffer = new BYTE[dstLenTemp];
|
||||
int dstLen = dstLenTemp;
|
||||
Base64Decode(__s.GetBuffer(), len, pDstBuffer, &dstLen);
|
||||
|
||||
strTempFile = pReader->m_strFolder + _T("\\media\\temp.jpg");
|
||||
CFile oTempFile;
|
||||
oTempFile.CreateFile(strTempFile);
|
||||
oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen);
|
||||
oTempFile.CloseFile();
|
||||
|
||||
strUrl = strTempFile;
|
||||
RELEASEARRAYOBJECTS(pDstBuffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (0 != strUrl.Find(_T("http:")) &&
|
||||
0 != strUrl.Find(_T("https:")) &&
|
||||
0 != strUrl.Find(_T("ftp:")) &&
|
||||
0 != strUrl.Find(_T("file:")))
|
||||
{
|
||||
if (0 == strUrl.Find(_T("theme")))
|
||||
{
|
||||
strUrl = pReader->m_strFolderThemes + _T("\\") + strUrl;
|
||||
}
|
||||
else
|
||||
{
|
||||
strUrl = pReader->m_strFolder + _T("\\media\\") + strUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LONG lId = pReader->m_oRels.WriteImage(strUrl, strOrigBase64);
|
||||
|
||||
|
||||
if (strTempFile != _T(""))
|
||||
{
|
||||
::DeleteFile(strTempFile);
|
||||
}
|
||||
|
||||
|
||||
if (!blip.is_init())
|
||||
blip = new PPTX::Logic::Blip();
|
||||
|
||||
blip->embed = new OOX::RId((size_t)lId);
|
||||
|
||||
pReader->Skip(1);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
pReader->SkipRecord();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(_e2);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
srcRect = new PPTX::Logic::Rect();
|
||||
srcRect->fromPPTY(pReader);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
tile = new PPTX::Logic::Tile();
|
||||
pReader->SkipRecord();
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
stretch = new PPTX::Logic::Stretch();
|
||||
pReader->SkipRecord();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
|
||||
pReader->SkipRecord();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pReader->Seek(_e);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable<Blip> blip;
|
||||
nullable<Rect> srcRect;
|
||||
nullable<Tile> tile;
|
||||
nullable<Stretch> stretch;
|
||||
|
||||
nullable_int dpi;
|
||||
nullable_bool rotWithShape;
|
||||
|
||||
mutable CString m_namespace;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
if(blip.IsInit())
|
||||
blip->SetParentPointer(this);
|
||||
if(srcRect.IsInit())
|
||||
srcRect->SetParentPointer(this);
|
||||
if(tile.IsInit())
|
||||
tile->SetParentPointer(this);
|
||||
if(stretch.IsInit())
|
||||
stretch->SetParentPointer(this);
|
||||
}
|
||||
|
||||
AVSINLINE void Normalize()
|
||||
{
|
||||
dpi.normalize_positive();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PPTX_LOGIC_BLIPFILL_INCLUDE_H_
|
||||
236
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/GradFill.h
Normal file
236
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/GradFill.h
Normal file
@@ -0,0 +1,236 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_GRADFILL_INCLUDE_H_
|
||||
#define PPTX_LOGIC_GRADFILL_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
#include "./../../Limit/Flip.h"
|
||||
#include "./../Rect.h"
|
||||
#include "./../Gs.h"
|
||||
#include "./../Lin.h"
|
||||
#include "./../Path.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
|
||||
class GradFill : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(GradFill)
|
||||
|
||||
GradFill& operator=(const GradFill& oSrc)
|
||||
{
|
||||
parentFile = oSrc.parentFile;
|
||||
parentElement = oSrc.parentElement;
|
||||
|
||||
flip = oSrc.flip;
|
||||
rotWithShape = oSrc.rotWithShape;
|
||||
|
||||
GsLst.Copy(oSrc.GsLst);
|
||||
lin = oSrc.lin;
|
||||
path = oSrc.path;
|
||||
tileRect = oSrc.tileRect;
|
||||
|
||||
m_namespace = oSrc.m_namespace;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_namespace = XmlUtils::GetNamespace(node.GetName());
|
||||
|
||||
node.ReadAttributeBase(L"flip", flip);
|
||||
node.ReadAttributeBase(L"rotWithShape", rotWithShape);
|
||||
|
||||
node.LoadArray(_T("a:gsLst"), _T("a:gs"), GsLst);
|
||||
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (node.GetNodes(_T("*"), oNodes))
|
||||
{
|
||||
int nCount = oNodes.GetCount();
|
||||
for (int i = 0; i < nCount; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNodes.GetAt(i, oNode);
|
||||
|
||||
CString strName = XmlUtils::GetNameNoNS(oNode.GetName());
|
||||
|
||||
if (_T("path") == strName)
|
||||
{
|
||||
if (!path.IsInit())
|
||||
path = oNode;
|
||||
}
|
||||
else if (_T("lin") == strName)
|
||||
{
|
||||
if (!lin.IsInit())
|
||||
lin = oNode;
|
||||
}
|
||||
else if (_T("tileRect") == strName)
|
||||
{
|
||||
if (!tileRect.IsInit())
|
||||
tileRect = oNode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FillParentPointersForChilds();
|
||||
}
|
||||
|
||||
virtual CString toXML() const
|
||||
{
|
||||
XmlUtils::CAttribute oAttr;
|
||||
oAttr.WriteLimitNullable(_T("flip"), flip);
|
||||
oAttr.Write(_T("rotWithShape"), rotWithShape);
|
||||
|
||||
XmlUtils::CNodeValue oValue;
|
||||
oValue.WriteArray(_T("a:gsLst"), GsLst);
|
||||
oValue.WriteNullable(path);
|
||||
oValue.WriteNullable(lin);
|
||||
oValue.WriteNullable(tileRect);
|
||||
|
||||
CString strName = (_T("") == m_namespace) ? _T("gradFill") : (m_namespace + _T(":gradFill"));
|
||||
return XmlUtils::CreateNode(strName, oAttr, oValue);
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
CString strName = (_T("") == m_namespace) ? _T("gradFill") : (m_namespace + _T(":gradFill"));
|
||||
pWriter->StartNode(strName);
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("flip"), flip);
|
||||
pWriter->WriteAttribute(_T("rotWithShape"), rotWithShape);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->WriteArray(_T("a:gsLst"), GsLst);
|
||||
pWriter->Write(path);
|
||||
pWriter->Write(lin);
|
||||
pWriter->Write(tileRect);
|
||||
|
||||
pWriter->EndNode(strName);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(FILL_TYPE_GRAD);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteLimit2(0, flip);
|
||||
pWriter->WriteBool2(1, rotWithShape);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->StartRecord(0);
|
||||
|
||||
ULONG len = (ULONG)GsLst.GetCount();
|
||||
pWriter->WriteULONG(len);
|
||||
|
||||
for (ULONG i = 0; i < len; ++i)
|
||||
{
|
||||
pWriter->WriteRecord1(0, GsLst[i]);
|
||||
}
|
||||
|
||||
pWriter->EndRecord();
|
||||
|
||||
pWriter->WriteRecord2(1, lin);
|
||||
pWriter->WriteRecord2(2, path);
|
||||
pWriter->WriteRecord2(3, tileRect);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
|
||||
void Merge(GradFill& fill)const
|
||||
{
|
||||
if(flip.IsInit())
|
||||
fill.flip = *flip;
|
||||
if(rotWithShape.IsInit())
|
||||
fill.rotWithShape = *rotWithShape;
|
||||
if(tileRect.IsInit())
|
||||
fill.tileRect = tileRect;
|
||||
if(0 != GsLst.GetCount())
|
||||
{
|
||||
fill.GsLst.RemoveAll();
|
||||
fill.GsLst.Copy(GsLst);
|
||||
}
|
||||
|
||||
if(lin.IsInit())
|
||||
{
|
||||
fill.lin = lin;
|
||||
fill.path.reset();
|
||||
}
|
||||
if(path.IsInit())
|
||||
{
|
||||
fill.path = path;
|
||||
fill.lin.reset();
|
||||
}
|
||||
}
|
||||
|
||||
UniColor GetFrontColor()const
|
||||
{
|
||||
if (0 == GsLst.GetCount())
|
||||
return UniColor();
|
||||
return GsLst[0].color;
|
||||
}
|
||||
|
||||
public:
|
||||
nullable_limit<Limit::Flip> flip;
|
||||
nullable_bool rotWithShape;
|
||||
|
||||
CAtlArray<Gs> GsLst;
|
||||
nullable<Lin> lin;
|
||||
nullable<Path> path;
|
||||
nullable<Rect> tileRect;
|
||||
|
||||
CString m_namespace;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
size_t count = GsLst.GetCount();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
GsLst[i].SetParentPointer(this);
|
||||
|
||||
if(lin.IsInit())
|
||||
lin->SetParentPointer(this);
|
||||
if(path.IsInit())
|
||||
path->SetParentPointer(this);
|
||||
if(tileRect.IsInit())
|
||||
tileRect->SetParentPointer(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PPTX_LOGIC_GRADFILL_INCLUDE_H_
|
||||
86
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/NoFill.h
Normal file
86
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/NoFill.h
Normal file
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_NOFILL_INCLUDE_H_
|
||||
#define PPTX_LOGIC_NOFILL_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
|
||||
class NoFill : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(NoFill)
|
||||
|
||||
NoFill& operator=(const NoFill& oSrc)
|
||||
{
|
||||
parentFile = oSrc.parentFile;
|
||||
parentElement = oSrc.parentElement;
|
||||
|
||||
m_namespace = oSrc.m_namespace;
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_namespace = XmlUtils::GetNamespace(node.GetName());
|
||||
}
|
||||
virtual CString toXML() const
|
||||
{
|
||||
if (_T("") == m_namespace)
|
||||
return _T("<noFill/>");
|
||||
return _T("<") + m_namespace + _T(":noFill/>");
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteString(_T("<a:noFill/>"));
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(FILL_TYPE_NOFILL);
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
public:
|
||||
CString m_namespace;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PPTX_LOGIC_NOFILL_INCLUDE_H_
|
||||
145
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/PattFill.h
Normal file
145
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/PattFill.h
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_PATTFILL_INCLUDE_H_
|
||||
#define PPTX_LOGIC_PATTFILL_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
#include "./../../Limit/PattFillVal.h"
|
||||
#include "./../UniColor.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
|
||||
class PattFill : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(PattFill)
|
||||
|
||||
PattFill& operator=(const PattFill& oSrc)
|
||||
{
|
||||
parentFile = oSrc.parentFile;
|
||||
parentElement = oSrc.parentElement;
|
||||
|
||||
prst = oSrc.prst;
|
||||
|
||||
fgClr = oSrc.fgClr;
|
||||
bgClr = oSrc.bgClr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_namespace = XmlUtils::GetNamespace(node.GetName());
|
||||
|
||||
node.ReadAttributeBase(L"prst", prst);
|
||||
|
||||
XmlUtils::CXmlNode oNode;
|
||||
if (node.GetNode(_T("a:fgClr"), oNode))
|
||||
fgClr.GetColorFrom(oNode);
|
||||
if (node.GetNode(_T("a:bgClr"), oNode))
|
||||
bgClr.GetColorFrom(oNode);
|
||||
|
||||
FillParentPointersForChilds();
|
||||
}
|
||||
|
||||
virtual CString toXML() const
|
||||
{
|
||||
XmlUtils::CAttribute oAttr;
|
||||
oAttr.WriteLimitNullable(_T("prst"), prst);
|
||||
|
||||
XmlUtils::CNodeValue oValue;
|
||||
oValue.Write(_T("a:fgClr"), fgClr);
|
||||
oValue.Write(_T("a:bgClr"), bgClr);
|
||||
|
||||
CString strName = (_T("") == m_namespace) ? _T("pattFill") : (m_namespace + _T(":pattFill"));
|
||||
return XmlUtils::CreateNode(strName, oAttr, oValue);
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
CString strName = (_T("") == m_namespace) ? _T("pattFill") : (m_namespace + _T(":pattFill"));
|
||||
pWriter->StartNode(strName);
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("prst"), prst);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(_T("a:fgClr"));
|
||||
pWriter->EndAttributes();
|
||||
fgClr.toXmlWriter(pWriter);
|
||||
pWriter->EndNode(_T("a:fgClr"));
|
||||
|
||||
pWriter->StartNode(_T("a:bgClr"));
|
||||
pWriter->EndAttributes();
|
||||
bgClr.toXmlWriter(pWriter);
|
||||
pWriter->EndNode(_T("a:bgClr"));
|
||||
|
||||
pWriter->EndNode(strName);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(FILL_TYPE_PATT);
|
||||
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteLimit2(0, prst);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
|
||||
pWriter->WriteRecord1(0, fgClr);
|
||||
pWriter->WriteRecord1(1, bgClr);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
|
||||
public:
|
||||
nullable_limit<Limit::PattFillVal> prst;
|
||||
|
||||
UniColor fgClr;
|
||||
UniColor bgClr;
|
||||
|
||||
CString m_namespace;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
fgClr.SetParentPointer(this);
|
||||
bgClr.SetParentPointer(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PPTX_LOGIC_PATTFILL_INCLUDE_H_
|
||||
115
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/SolidFill.h
Normal file
115
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/SolidFill.h
Normal file
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_SOLIDFILL_INCLUDE_H_
|
||||
#define PPTX_LOGIC_SOLIDFILL_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
#include "./../UniColor.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
|
||||
class SolidFill : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(SolidFill)
|
||||
|
||||
SolidFill& operator=(const SolidFill& oSrc)
|
||||
{
|
||||
parentFile = oSrc.parentFile;
|
||||
parentElement = oSrc.parentElement;
|
||||
|
||||
Color = oSrc.Color;
|
||||
m_namespace = oSrc.m_namespace;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
m_namespace = XmlUtils::GetNamespace(node.GetName());
|
||||
Color.GetColorFrom(node);
|
||||
FillParentPointersForChilds();
|
||||
}
|
||||
virtual CString toXML() const
|
||||
{
|
||||
CString strName = (_T("") == m_namespace) ? _T("solidFill") : (m_namespace + _T(":solidFill"));
|
||||
|
||||
XmlUtils::CNodeValue oValue;
|
||||
oValue.Write(Color);
|
||||
|
||||
return XmlUtils::CreateNode(strName, oValue);
|
||||
}
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
CString strName = (_T("") == m_namespace) ? _T("solidFill") : (m_namespace + _T(":solidFill"));
|
||||
pWriter->StartNode(strName);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
if (Color.is_init())
|
||||
Color.toXmlWriter(pWriter);
|
||||
|
||||
pWriter->EndNode(strName);
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartRecord(FILL_TYPE_SOLID);
|
||||
|
||||
pWriter->WriteRecord1(0, Color);
|
||||
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
|
||||
void Merge(SolidFill& fill)const
|
||||
{
|
||||
if(Color.is_init())
|
||||
fill.Color = Color;
|
||||
}
|
||||
public:
|
||||
UniColor Color;
|
||||
|
||||
CString m_namespace;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
Color.SetParentPointer(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PPTX_LOGIC_SOLIDFILL_INCLUDE_H_
|
||||
111
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Stretch.h
Normal file
111
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Stretch.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_STRETCH_INCLUDE_H_
|
||||
#define PPTX_LOGIC_STRETCH_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
#include "./../Rect.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
|
||||
class Stretch : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(Stretch)
|
||||
|
||||
Stretch& operator=(const Stretch& oSrc)
|
||||
{
|
||||
parentFile = oSrc.parentFile;
|
||||
parentElement = oSrc.parentElement;
|
||||
|
||||
fillRect = oSrc.fillRect;
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
XmlUtils::CXmlNodes oNodes;
|
||||
if (node.GetNodes(_T("*"), oNodes))
|
||||
{
|
||||
int count = oNodes.GetCount();
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
XmlUtils::CXmlNode oNode;
|
||||
oNodes.GetAt(i, oNode);
|
||||
|
||||
if (_T("fillRect") == XmlUtils::GetNameNoNS(oNode.GetName()))
|
||||
fillRect = oNode;
|
||||
}
|
||||
}
|
||||
FillParentPointersForChilds();
|
||||
}
|
||||
virtual CString toXML() const
|
||||
{
|
||||
XmlUtils::CNodeValue oValue;
|
||||
oValue.WriteNullable(fillRect);
|
||||
|
||||
return XmlUtils::CreateNode(_T("a:stretch"), oValue);
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(_T("a:stretch"));
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->Write(fillRect);
|
||||
|
||||
pWriter->EndNode(_T("a:stretch"));
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteRecord2(0, fillRect);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable<Rect> fillRect;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds()
|
||||
{
|
||||
if(fillRect.IsInit())
|
||||
fillRect->SetParentPointer(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PPTX_LOGIC_STRETCH_INCLUDE_H_
|
||||
129
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Tile.h
Normal file
129
ActiveX/ASCOfficePPTXFile/PPTXFormat/Logic/Fills/Tile.h
Normal file
@@ -0,0 +1,129 @@
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2014
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
#ifndef PPTX_LOGIC_TILE_INCLUDE_H_
|
||||
#define PPTX_LOGIC_TILE_INCLUDE_H_
|
||||
|
||||
#include "./../../WrapperWritingElement.h"
|
||||
#include "./../../Limit/RectAlign.h"
|
||||
#include "./../../Limit/Flip.h"
|
||||
|
||||
namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
|
||||
class Tile : public WrapperWritingElement
|
||||
{
|
||||
public:
|
||||
PPTX_LOGIC_BASE(Tile)
|
||||
|
||||
Tile& operator=(const Tile& oSrc)
|
||||
{
|
||||
parentFile = oSrc.parentFile;
|
||||
parentElement = oSrc.parentElement;
|
||||
|
||||
algn = oSrc.algn;
|
||||
flip = oSrc.flip;
|
||||
sx = oSrc.sx;
|
||||
sy = oSrc.sy;
|
||||
tx = oSrc.tx;
|
||||
ty = oSrc.ty;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
public:
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
node.ReadAttributeBase(L"algn", algn);
|
||||
node.ReadAttributeBase(L"flip", flip);
|
||||
node.ReadAttributeBase(L"sx", sx);
|
||||
node.ReadAttributeBase(L"sy", sy);
|
||||
node.ReadAttributeBase(L"tx", tx);
|
||||
node.ReadAttributeBase(L"ty", ty);
|
||||
}
|
||||
virtual CString toXML() const
|
||||
{
|
||||
XmlUtils::CAttribute oAttr;
|
||||
oAttr.WriteLimitNullable(_T("algn"), algn);
|
||||
oAttr.WriteLimitNullable(_T("flip"), flip);
|
||||
oAttr.Write(_T("sx"), sx);
|
||||
oAttr.Write(_T("sy"), sy);
|
||||
oAttr.Write(_T("tx"), tx);
|
||||
oAttr.Write(_T("ty"), ty);
|
||||
|
||||
return XmlUtils::CreateNode(_T("a:tile"), oAttr);
|
||||
}
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
pWriter->StartNode(_T("a:tile"));
|
||||
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("algn"), algn);
|
||||
pWriter->WriteAttribute(_T("flip"), flip);
|
||||
pWriter->WriteAttribute(_T("sx"), sx);
|
||||
pWriter->WriteAttribute(_T("sy"), sy);
|
||||
pWriter->WriteAttribute(_T("tx"), tx);
|
||||
pWriter->WriteAttribute(_T("ty"), ty);
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->EndNode(_T("a:tile"));
|
||||
}
|
||||
|
||||
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
|
||||
{
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
|
||||
pWriter->WriteInt2(0, sx);
|
||||
pWriter->WriteInt2(1, sy);
|
||||
pWriter->WriteInt2(2, tx);
|
||||
pWriter->WriteInt2(3, ty);
|
||||
pWriter->WriteLimit2(4, algn);
|
||||
pWriter->WriteLimit2(5, flip);
|
||||
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
|
||||
}
|
||||
|
||||
public:
|
||||
nullable_limit<Limit::RectAlign> algn;
|
||||
nullable_limit<Limit::Flip> flip;
|
||||
nullable_int sx;
|
||||
nullable_int sy;
|
||||
nullable_int tx;
|
||||
nullable_int ty;
|
||||
protected:
|
||||
virtual void FillParentPointersForChilds(){};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // PPTX_LOGIC_TILE_INCLUDE_H_
|
||||
Reference in New Issue
Block a user