Commit f89d75ae authored by ElenaSubbotina's avatar ElenaSubbotina

PptxFormat refactoring and extending drawing objects

parent 40350720
...@@ -60,6 +60,10 @@ namespace BinDocxRW ...@@ -60,6 +60,10 @@ namespace BinDocxRW
{ {
class CDocxSerializer; class CDocxSerializer;
} }
namespace OOX
{
class CContentTypes;
}
namespace NSBinPptxRW namespace NSBinPptxRW
{ {
class CBinaryFileWriter; class CBinaryFileWriter;
...@@ -72,12 +76,14 @@ namespace PPTX ...@@ -72,12 +76,14 @@ namespace PPTX
class WrapperFile; class WrapperFile;
class WrapperWritingElement; class WrapperWritingElement;
class CCommonRels; class CCommonRels;
class Theme;
namespace Logic namespace Logic
{ {
class SpTreeElem; class SpTreeElem;
class Xfrm; class Xfrm;
class Shape; class Shape;
class ClrMap;
} }
class CStringTrimmer class CStringTrimmer
...@@ -196,8 +202,8 @@ namespace NSBinPptxRW ...@@ -196,8 +202,8 @@ namespace NSBinPptxRW
IRenderer* m_pOOXToVMLRenderer; IRenderer* m_pOOXToVMLRenderer;
bool m_bIsUseConvertion2007; bool m_bIsUseConvertion2007;
NSCommon::smart_ptr<PPTX::WrapperFile>* m_pTheme; NSCommon::smart_ptr<PPTX::Theme>* m_pTheme;
NSCommon::smart_ptr<PPTX::WrapperWritingElement>* m_pClrMap; NSCommon::smart_ptr<PPTX::Logic::ClrMap>* m_pClrMap;
std::wstring m_strFontDirectory; std::wstring m_strFontDirectory;
...@@ -213,27 +219,24 @@ namespace NSBinPptxRW ...@@ -213,27 +219,24 @@ namespace NSBinPptxRW
HRESULT AddShapeType (const std::wstring& sXml); HRESULT AddShapeType (const std::wstring& sXml);
HRESULT AddObject (const std::wstring& sXml, std::wstring** pMainProps); HRESULT AddObject (const std::wstring& sXml, std::wstring** pMainProps);
HRESULT GetThemeBinary (BYTE** ppBinary, long& lBinarySize, const std::wstring& sThemeFilePath);
HRESULT SaveThemeXml (long lStart, long lLength, const std::wstring& sThemePath);
HRESULT SaveObject (long lStart, long lLength, const std::wstring& sMainProps, std::wstring & sXml); HRESULT SaveObject (long lStart, long lLength, const std::wstring& sMainProps, std::wstring & sXml);
HRESULT SaveObjectEx (long lStart, long lLength, const std::wstring& sMainProps, long lDocType, std::wstring & sXml); HRESULT SaveObjectEx (long lStart, long lLength, const std::wstring& sMainProps, int nDocType, std::wstring & sXml);
void SaveObjectExWriterInit (NSBinPptxRW::CXmlWriter& oXmlWriter, LONG lDocType); void SaveObjectExWriterInit (NSBinPptxRW::CXmlWriter& oXmlWriter, int lDocType);
void SaveObjectExWriterRelease (NSBinPptxRW::CXmlWriter& oXmlWriter); void SaveObjectExWriterRelease (NSBinPptxRW::CXmlWriter& oXmlWriter);
PPTX::Logic::SpTreeElem ObjectFromXml(const std::wstring& sXml, std::wstring** pMainProps); PPTX::Logic::SpTreeElem ObjectFromXml(const std::wstring& sXml, std::wstring** pMainProps);
std::wstring ObjectToVML (const std::wstring& sXml); std::wstring ObjectToVML (const std::wstring& sXml);
std::wstring ObjectToDrawingML (const std::wstring& sXml, LONG lDocType); std::wstring ObjectToDrawingML (const std::wstring& sXml, int nDocType);
std::wstring SaveObjectBackground(LONG lStart, LONG lLength); std::wstring SaveObjectBackground(LONG lStart, LONG lLength);
HRESULT GetRecordBinary (long lRecordType, const std::wstring& sXml); HRESULT GetRecordBinary (long lRecordType, const std::wstring& sXml);
HRESULT GetRecordXml (long lStart, long lLength, long lRecType, long lDocType, std::wstring & sXml); HRESULT GetRecordXml (long lStart, long lLength, long lRecType, int lDocType, std::wstring & sXml);
HRESULT SetDstContentRels (); HRESULT SetDstContentRels ();
HRESULT SaveDstContentRels (const std::wstring& sRelsPath); HRESULT SaveDstContentRels (const std::wstring& sRelsPath);
HRESULT WriteRels (const std::wstring& sType, const std::wstring& sTarget, const std::wstring& sTargetMode, long* lId);
HRESULT LoadClrMap (const std::wstring& sXml); HRESULT LoadClrMap (const std::wstring& sXml);
HRESULT(SetFontDir) (const std::wstring& sFontDir); HRESULT(SetFontDir) (const std::wstring& sFontDir);
...@@ -243,19 +246,17 @@ namespace NSBinPptxRW ...@@ -243,19 +246,17 @@ namespace NSBinPptxRW
HRESULT SetAdditionalParam(const std::wstring& ParamName, BYTE *pArray, size_t szCount); HRESULT SetAdditionalParam(const std::wstring& ParamName, BYTE *pArray, size_t szCount);
HRESULT GetAdditionalParam(const std::wstring& ParamName, BYTE **pArray, size_t& szCount); HRESULT GetAdditionalParam(const std::wstring& ParamName, BYTE **pArray, size_t& szCount);
void SetFontManager (CFontManager* pFontManager); void WriteRels (const std::wstring& sType, const std::wstring& sTarget, const std::wstring& sTargetMode, long* lId);
void Registration (const std::wstring& sType, const std::wstring& oDirectory, const std::wstring& oFilename);
void SetFontManager (CFontManager* pFontManager);
void SetDocumentChartsCount (int val); void SetDocumentChartsCount (int val);
int GetDocumentChartsCount (); int GetDocumentChartsCount ();
void SetObjectIdVML (int val); void SetSourceFileDir (std::wstring path, int nDocType = 1/*XMLWRITER_DOC_TYPE_DOCX*/);
int GetObjectIdVML ();
void SetSourceFileDir (std::wstring path, int type = 1);
std::wstring GetContentTypes(); OOX::CContentTypes* GetContentTypes();
std::wstring GetOleXlsx();
std::wstring GetOleDrawing();
protected: protected:
nullable<PPTX::Logic::Xfrm> m_oxfrm_override; nullable<PPTX::Logic::Xfrm> m_oxfrm_override;
......
...@@ -51,19 +51,17 @@ namespace PPTX ...@@ -51,19 +51,17 @@ namespace PPTX
class CPPTXFile : public PPTX::IPPTXEvent class CPPTXFile : public PPTX::IPPTXEvent
{ {
private: private:
PPTX::Folder* m_pFolder; PPTX::Folder* m_pFolder;
std::wstring m_strTempDir; std::wstring m_strTempDir;
std::wstring m_strDirectory; std::wstring m_strDirectory;
// writer to ppty
std::wstring m_strFontDirectory; std::wstring m_strFontDirectory;
std::wstring m_strMediaDirectory; std::wstring m_strMediaDirectory;
bool m_bIsUseSystemFonts; bool m_bIsUseSystemFonts;
std::wstring m_strEmbeddedFontsDirectory; std::wstring m_strEmbeddedFontsDirectory;
std::wstring m_strFolderThemes; std::wstring m_strFolderThemes;
//load_from_resource m_fCallbackResource;
extract_to_directory m_fCallbackExtract; extract_to_directory m_fCallbackExtract;
compress_from_directory m_fCallbackCompress; compress_from_directory m_fCallbackCompress;
progress_operation m_fCallbackProgress; progress_operation m_fCallbackProgress;
......
...@@ -74,8 +74,8 @@ namespace PPTX2EditorAdvanced ...@@ -74,8 +74,8 @@ namespace PPTX2EditorAdvanced
continue; continue;
} }
oBinaryWriter.m_pCommon->m_oRels.push_back (CMasterSlideInfo()); oBinaryWriter.m_pCommon->m_oRels.push_back (_masterSlideInfo());
CMasterSlideInfo& oMasterInfo = oBinaryWriter.m_pCommon->m_oRels[oBinaryWriter.m_pCommon->m_oRels.size() - 1]; _masterSlideInfo& oMasterInfo = oBinaryWriter.m_pCommon->m_oRels[oBinaryWriter.m_pCommon->m_oRels.size() - 1];
// записываем mainMaster // записываем mainMaster
LONG lCountSM = (LONG)_slideMasters.size(); LONG lCountSM = (LONG)_slideMasters.size();
...@@ -218,7 +218,7 @@ namespace PPTX2EditorAdvanced ...@@ -218,7 +218,7 @@ namespace PPTX2EditorAdvanced
oBinaryWriter.WriteULONG(0); oBinaryWriter.WriteULONG(0);
// App // App
smart_ptr<PPTX::App> app = oFolder.Get(OOX::Presentation::FileTypes::App).smart_dynamic_cast<PPTX::App>(); smart_ptr<PPTX::App> app = oFolder.Get(OOX::FileTypes::App).smart_dynamic_cast<PPTX::App>();
if (app.is_init()) if (app.is_init())
{ {
oBinaryWriter.StartMainRecord(NSMainTables::App); oBinaryWriter.StartMainRecord(NSMainTables::App);
...@@ -226,7 +226,7 @@ namespace PPTX2EditorAdvanced ...@@ -226,7 +226,7 @@ namespace PPTX2EditorAdvanced
} }
// Core // Core
smart_ptr<PPTX::Core> core = oFolder.Get(OOX::Presentation::FileTypes::Core).smart_dynamic_cast<PPTX::Core>(); smart_ptr<PPTX::Core> core = oFolder.Get(OOX::FileTypes::Core).smart_dynamic_cast<PPTX::Core>();
if (core.is_init()) if (core.is_init())
{ {
oBinaryWriter.StartMainRecord(NSMainTables::Core); oBinaryWriter.StartMainRecord(NSMainTables::Core);
...@@ -412,12 +412,12 @@ namespace PPTX2EditorAdvanced ...@@ -412,12 +412,12 @@ namespace PPTX2EditorAdvanced
oBinaryWriter.StartMainRecord(NSMainTables::ThemeRels); oBinaryWriter.StartMainRecord(NSMainTables::ThemeRels);
oBinaryWriter.StartRecord(NSMainTables::ThemeRels); oBinaryWriter.StartRecord(NSMainTables::ThemeRels);
std::vector <NSBinPptxRW::CMasterSlideInfo>& th_rels = oBinaryWriter.m_pCommon->m_oRels; std::vector <NSBinPptxRW::_masterSlideInfo>& th_rels = oBinaryWriter.m_pCommon->m_oRels;
oBinaryWriter.WriteULONG((ULONG)th_rels.size()); oBinaryWriter.WriteULONG((ULONG)th_rels.size());
for (size_t i = 0; i < th_rels.size(); i++) for (size_t i = 0; i < th_rels.size(); i++)
{ {
NSBinPptxRW::CMasterSlideInfo& oTh = th_rels [i]; NSBinPptxRW::_masterSlideInfo& oTh = th_rels [i];
oBinaryWriter.StartRecord(0); oBinaryWriter.StartRecord(0);
......
This diff is collapsed.
...@@ -268,18 +268,15 @@ namespace NSBinPptxRW ...@@ -268,18 +268,15 @@ namespace NSBinPptxRW
std::wstring m_strStyleMain; std::wstring m_strStyleMain;
std::wstring m_strAttributesMain; std::wstring m_strAttributesMain;
std::wstring m_strNodes; std::wstring m_strNodes;
std::wstring m_strOleXlsx;
std::wstring m_strOleDrawing;
IRenderer* m_pOOXToVMLRenderer; IRenderer* m_pOOXToVMLRenderer;
bool m_bIsTop; bool m_bIsTop;
bool m_bIsUseOffice2007; bool m_bIsUseOffice2007;
CXmlWriter() : m_oWriter() CXmlWriter (BYTE ooxType = XMLWRITER_DOC_TYPE_PPTX) : m_oWriter()
{ {
m_lDocType = XMLWRITER_DOC_TYPE_PPTX; m_lDocType = ooxType;
m_lFlag = 0; m_lFlag = 0;
m_lGroupIndex = 0; m_lGroupIndex = 0;
m_lObjectId = 0; m_lObjectId = 0;
...@@ -290,7 +287,7 @@ namespace NSBinPptxRW ...@@ -290,7 +287,7 @@ namespace NSBinPptxRW
m_pOOXToVMLRenderer = NULL; m_pOOXToVMLRenderer = NULL;
m_bIsTop = false; m_bIsTop = false;
} }
~CXmlWriter() ~CXmlWriter()
{ {
} }
......
...@@ -161,13 +161,9 @@ namespace NSShapeImageGen ...@@ -161,13 +161,9 @@ namespace NSShapeImageGen
LONG m_lNextIDImage; LONG m_lNextIDImage;
CCalculatorCRC32 m_oCRC; CCalculatorCRC32 m_oCRC;
LONG m_lDstFormat; LONG m_lDstFormat;
NSWMFToImageConverter::CImageExt m_oImageExt; NSWMFToImageConverter::CImageExt m_oImageExt;
CFontManager* m_pFontManager;
CFontManager* m_pFontManager;
public:
CImageManager() CImageManager()
{ {
...@@ -188,77 +184,6 @@ namespace NSShapeImageGen ...@@ -188,77 +184,6 @@ namespace NSShapeImageGen
m_listImages.clear(); m_listImages.clear();
} }
public:
template <typename T>
void Serialize(T* pWriter)
{
pWriter->WriteINT(m_lMaxSizeImage);
pWriter->WriteINT(m_lNextIDImage);
pWriter->WriteINT(m_lDstFormat);
pWriter->WriteString(m_strDstMedia);
int lCount = (int)m_mapImagesFile.size();
pWriter->WriteINT(lCount);
for (std::map<std::wstring, CImageInfo>::iterator pPair = m_mapImagesFile.begin(); pPair != m_mapImagesFile.end(); ++pPair)
{
pWriter->WriteString(pPair->first);
pWriter->WriteINT((int)(pPair->second.m_eType));
pWriter->WriteINT((int)(pPair->second.m_lID));
pWriter->WriteBYTE(pPair->second.m_bValid ? 1 : 0);
}
lCount = (int)m_mapImageData.size();
pWriter->WriteINT(lCount);
for (std::map<DWORD, CImageInfo>::iterator pPair = m_mapImageData.begin(); pPair != m_mapImageData.end(); ++pPair)
{
pWriter->WriteULONG(pPair->first);
pWriter->WriteINT((int)pPair->second.m_eType);
pWriter->WriteINT((int)pPair->second.m_lID);
pWriter->WriteBYTE(pPair->second.m_bValid ? 1 : 0);
}
}
template <typename T>
void Deserialize(T* pReader)
{
m_lMaxSizeImage = pReader->GetLong();
m_lNextIDImage = pReader->GetLong();
m_lDstFormat = pReader->GetLong();
m_strDstMedia = pReader->GetString2();
m_mapImageData.clear();
m_mapImagesFile.clear();
LONG lCount = pReader->GetLong();
for (LONG i = 0; i < lCount; ++i)
{
std::wstring sKey = pReader->GetString2();
CImageInfo oInfo;
oInfo.m_eType = (NSShapeImageGen::ImageType)pReader->GetLong();
oInfo.m_lID = pReader->GetLong();
oInfo.m_bValid = pReader->GetBool();
m_mapImagesFile.insert(std::pair<std::wstring, CImageInfo>(sKey, oInfo));
}
lCount = pReader->GetLong();
for (LONG i = 0; i < lCount; ++i)
{
DWORD dwKey = (DWORD)pReader->GetULong();
CImageInfo oInfo;
oInfo.m_eType = (NSShapeImageGen::ImageType)pReader->GetLong();
oInfo.m_lID = pReader->GetLong();
oInfo.m_bValid = pReader->GetBool();
m_mapImageData.insert(std::pair<DWORD, CImageInfo>(dwKey, oInfo));
}
}
public:
CImageInfo WriteImage(CBgraFrame& punkImage, double& x, double& y, double& width, double& height) CImageInfo WriteImage(CBgraFrame& punkImage, double& x, double& y, double& width, double& height)
{ {
CImageInfo info; CImageInfo info;
...@@ -507,10 +432,13 @@ namespace NSShapeImageGen ...@@ -507,10 +432,13 @@ namespace NSShapeImageGen
oInfo.m_lID = m_lNextIDImage; oInfo.m_lID = m_lNextIDImage;
LONG lImageType = m_oImageExt.GetImageType(strFileName); LONG lImageType = m_oImageExt.GetImageType(strFileName);
bool bVector = (1 == lImageType || 2 == lImageType); bool bVector = (1 == lImageType || 2 == lImageType);
bool bOle = !strOleFile.empty(); bool bOle = !strOleFile.empty();
if(bVector) if(bVector)
oInfo.m_eType = (1 == lImageType) ? itWMF : itEMF; oInfo.m_eType = (1 == lImageType) ? itWMF : itEMF;
oInfo.SetNameModificator(oInfo.m_eType, bOle); oInfo.SetNameModificator(oInfo.m_eType, bOle);
std::wstring strSaveDir = m_strDstMedia + FILE_SEPARATOR_STR; std::wstring strSaveDir = m_strDstMedia + FILE_SEPARATOR_STR;
...@@ -519,7 +447,12 @@ namespace NSShapeImageGen ...@@ -519,7 +447,12 @@ namespace NSShapeImageGen
//copy ole bin //copy ole bin
if(bOle) if(bOle)
{ {
std::wstring sCopyOlePath = strSaveItemWE + L".bin"; std::wstring strExts = _T(".bin");
int nIndexExt = (int)strOleFile.rfind(wchar_t('.'));
if (-1 != nIndexExt)
strExts = strOleFile.substr(nIndexExt);
std::wstring sCopyOlePath = strSaveItemWE + strExts;//L".bin";
CDirectory::CopyFile(strOleFile, sCopyOlePath); CDirectory::CopyFile(strOleFile, sCopyOlePath);
} }
......
...@@ -114,71 +114,13 @@ namespace PPTX ...@@ -114,71 +114,13 @@ namespace PPTX
} }
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{ {
XmlUtils::CAttribute oAttr; WrapperFile::write(filename, directory, content);
oAttr.Write(_T("xmlns"), PPTX::g_Namespaces.xmlns.m_strLink);
oAttr.Write(_T("xmlns:vt"), PPTX::g_Namespaces.vt.m_strLink);
XmlUtils::CNodeValue oValue;
oValue.Write2(_T("Template"), Template);
oValue.Write2(_T("TotalTime"), TotalTime);
oValue.Write2(_T("Words"), Words);
oValue.Write2(_T("Application"), Application);
oValue.Write2(_T("PresentationFormat"), PresentationFormat);
oValue.Write2(_T("Paragraphs"), Paragraphs);
oValue.Write2(_T("Slides"), Slides);
oValue.Write2(_T("Notes"), Notes);
oValue.Write2(_T("HiddenSlides"), HiddenSlides);
oValue.Write2(_T("MMClips"), MMClips);
oValue.Write2(_T("ScaleCrop"), ScaleCrop);
XmlUtils::CAttribute oAttr1;
oAttr1.Write(_T("size"), m_Headings);
oAttr1.Write(_T("baseType"), _T("variant"));
XmlUtils::CNodeValue oValue1;
oValue1.WriteArray(HeadingPairs);
oValue.Write2(_T("HeadingPairs"), XmlUtils::CreateNode(_T("vt:vector"), oAttr1, oValue1));
XmlUtils::CAttribute oAttr2;
oAttr2.Write(_T("size"), m_Headings);
oAttr2.Write(_T("baseType"), _T("lpstr"));
XmlUtils::CNodeValue oValue2;
oValue2.WriteArray(HeadingPairs);
oValue.Write2(_T("TitlesOfParts"), XmlUtils::CreateNode(_T("vt:vector"), oAttr2, oValue2));
oValue.Write2(_T("Company"), Company);
oValue.Write2(_T("LinksUpToDate"), LinksUpToDate);
oValue.Write2(_T("SharedDoc"), SharedDoc);
oValue.Write2(_T("HyperlinksChanged"), HyperlinksChanged);
oValue.Write2(_T("AppVersion"), AppVersion);
XmlUtils::SaveToFile(filename.m_strFilename, XmlUtils::CreateNode(_T("Properties"), oAttr, oValue));
//if(DocSecurity.is_init())
// root.push_back(XML::XElement("DocSecurity", XML::XText(DocSecurity)));
//if(Manager.is_init())
// root.push_back(XML::XElement("Manager", XML::XText(Manager)));
//if(HyperlinkBase.is_init())
// root.push_back(XML::XElement("HyperlinkBase", XML::XText(HyperlinkBase)));
//XML::XElement("Characters", XML::XText(Characters)) +
//XML::XElement("Lines", XML::XText(Lines)) +
//XML::XElement("CharactersWithSpaces", XML::XText(CharactersWithSpaces))
//DigSig (Digital Signature)
//HLinks
content.Registration(type().OverrideType(), directory, filename);
m_written = true;
m_WrittenFileName.m_strFilename = filename.GetFilename();
} }
public: public:
virtual const OOX::FileType type() const virtual const OOX::FileType type() const
{ {
return OOX::Presentation::FileTypes::App; return OOX::FileTypes::App;
} }
virtual const OOX::CPath DefaultDirectory() const virtual const OOX::CPath DefaultDirectory() const
{ {
...@@ -291,7 +233,7 @@ namespace PPTX ...@@ -291,7 +233,7 @@ namespace PPTX
nullable_int MMClips; // (Total Number of Multimedia Clips) nullable_int MMClips; // (Total Number of Multimedia Clips)
nullable_bool ScaleCrop; // (Thumbnail Display Mode) nullable_bool ScaleCrop; // (Thumbnail Display Mode)
std::vector<Logic::HeadingVariant> HeadingPairs; // (Heading Pairs) std::vector<Logic::HeadingVariant> HeadingPairs; // (Heading Pairs)
std::vector<Logic::PartTitle> TitlesOfParts; // (Part Titles) std::vector<Logic::PartTitle> TitlesOfParts; // (Part Titles)
nullable_string Company; // (Name of Company) nullable_string Company; // (Name of Company)
nullable_bool LinksUpToDate; // (Links Up-to-Date) nullable_bool LinksUpToDate; // (Links Up-to-Date)
nullable_bool SharedDoc; // (Shared Document) nullable_bool SharedDoc; // (Shared Document)
......
...@@ -174,7 +174,8 @@ namespace PPTX ...@@ -174,7 +174,8 @@ namespace PPTX
} }
} }
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{ {
WrapperFile::write(filename, directory, content);
} }
public: public:
......
...@@ -311,7 +311,8 @@ namespace PPTX ...@@ -311,7 +311,8 @@ namespace PPTX
} }
} }
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{ {
WrapperFile::write(filename, directory, content);
} }
public: public:
......
...@@ -86,67 +86,13 @@ namespace PPTX ...@@ -86,67 +86,13 @@ namespace PPTX
} }
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{ {
XmlUtils::CAttribute oAttr; WrapperFile::write(filename, directory, content);
oAttr.Write(_T("xmlns:dc"), PPTX::g_Namespaces.dc.m_strLink);
//oAttr.Write(_T("xmlns:cp"), PPTX::g_Namespaces.cp.m_strLink);
oAttr.Write(_T("xmlns:dcterms"), PPTX::g_Namespaces.dcterms.m_strLink);
oAttr.Write(_T("xmlns:xsi"), PPTX::g_Namespaces.xsi.m_strLink);
XmlUtils::CNodeValue oValue;
oValue.Write2(_T("dc:title"), title);
oValue.Write2(_T("dc:creator"), creator);
oValue.Write2(_T("cp:lastModifiedBy"), lastModifiedBy);
oValue.Write2(_T("cp:revision"), revision);
if (created.IsInit())
{
oValue.m_strValue += _T("<dcterms:created xsi:type=\"dcterms:W3CDTF\">");
oValue.m_strValue += *created;
oValue.m_strValue += _T("</dcterms:created>");
}
oValue.m_strValue += _T("<dcterms:modified xsi:type=\"dcterms:W3CDTF\">");
if (modified.IsInit())
oValue.m_strValue += *modified;
oValue.m_strValue += _T("</dcterms:modified>");
XmlUtils::SaveToFile(filename.m_strFilename, XmlUtils::CreateNode(_T("cp:coreProperties"), oAttr, oValue));
/*
if(category.is_init())
root.push_back(XML::XElement("category", XML::XText(category)));
if(contentStatus.is_init())
root.push_back(XML::XElement("contentStatus", XML::XText(contentStatus)));
if(description.is_init())
root.push_back(XML::XElement(ns.dc + "description", XML::XText(description)));
//identifier - ??? dc
//XML::XElement(ns.cp + "keywords", XML::XText(keywords)) +
if(language.is_init())
root.push_back(XML::XElement(ns.dc + "language", XML::XText(language)));
// if(lastModifiedBy.is_init())
// root.push_back(XML::XElement(ns.cp + "lastModifiedBy", XML::XText(lastModifiedBy)));
//XML::XElement("lastPrinted",
// XML::XAttribute(,)+
// XML::XText(lastPrinted)
//) + //??? namespace ???
// if(revision.is_init())
// root.push_back(XML::XElement(ns.cp + "revision", XML::XText(revision)));
if(subject.is_init())
root.push_back(XML::XElement(ns.dc + "subject", XML::XText(subject)));
// if(title.is_init())
// root.push_back(XML::XElement(ns.dc + "title", XML::XText(title)));
if(version.is_init())
root.push_back(XML::XElement("version", XML::XText(version)));
*/
content.Registration(type().OverrideType(), directory, filename);
m_written = true;
m_WrittenFileName = filename.GetFilename();
} }
public: public:
virtual const OOX::FileType type() const virtual const OOX::FileType type() const
{ {
return OOX::Presentation::FileTypes::Core; return OOX::FileTypes::Core;
} }
virtual const OOX::CPath DefaultDirectory() const virtual const OOX::CPath DefaultDirectory() const
{ {
......
...@@ -94,55 +94,6 @@ namespace PPTX ...@@ -94,55 +94,6 @@ namespace PPTX
{ {
//not implement FileContainer.read //not implement FileContainer.read
} }
smart_ptr<PPTX::LegacyDiagramText> FileContainer::legacyDiagramText(const OOX::RId& rId) const
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
if (pPair == m_mContainer.end ())
return smart_ptr<LegacyDiagramText>();
return pPair->second.smart_dynamic_cast<LegacyDiagramText>();
}
void FileContainer::read(const OOX::CPath& filename, FileMap& map, IPPTXEvent* Event)
{
OOX::CRels rels(filename);
OOX::CPath path = filename.GetDirectory();
read(rels, path, map, Event);
}
OOX::CPath FileContainer::CorrectPathRels(const OOX::CPath& path, OOX::Rels::CRelationShip* relation )
{
if (relation->IsExternal()) return relation->Target();
OOX::CPath filename = path / relation->Target();
if ( NSFile::CFileBinary::Exists(filename.GetPath()) == true ) return filename;
//file_1_ (1).pptx
std::wstring strDefDirectory;
for (int i = 0; i < 9; i++)
{
if (relation->Type() == arDefDirectories[i][0])
{
strDefDirectory = arDefDirectories[i][1];
break;
}
}
OOX::CPath new_filename = strDefDirectory + FILE_SEPARATOR_STR + relation->Filename().GetFilename();
filename = path / new_filename;
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false)
{
filename = FindFileInDirectory(path.GetPath(), relation->Filename().GetFilename()); // find true path by filename
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false)
return filename;
}
*relation = OOX::Rels::CRelationShip( relation->rId(), relation->Type(), filename);
return filename;
}
void FileContainer::read(const OOX::CRels& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event) void FileContainer::read(const OOX::CRels& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event)
{ {
bool bIsSlide = false; bool bIsSlide = false;
...@@ -158,7 +109,7 @@ namespace PPTX ...@@ -158,7 +109,7 @@ namespace PPTX
OOX::CPath normPath = CorrectPathRels(path, pRelation); OOX::CPath normPath = CorrectPathRels(path, pRelation);
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.find(normPath); std::map<std::wstring, smart_ptr<OOX::File>>::iterator pPair = map.find(normPath);
if (bIsSlide && (pRelation->Type() == OOX::FileTypes::HyperLink || if (bIsSlide && (pRelation->Type() == OOX::FileTypes::HyperLink ||
pRelation->Type() == OOX::Presentation::FileTypes::Slide)) pRelation->Type() == OOX::Presentation::FileTypes::Slide))
...@@ -180,7 +131,7 @@ namespace PPTX ...@@ -180,7 +131,7 @@ namespace PPTX
} }
else else
{ {
long percent = Event->GetPercent(); long percent = Event ? Event->GetPercent() : 0;
smart_ptr<OOX::File> file = PPTX::FileFactory::CreateFilePPTX(normPath, *pRelation, map); smart_ptr<OOX::File> file = PPTX::FileFactory::CreateFilePPTX(normPath, *pRelation, map);
...@@ -191,12 +142,13 @@ namespace PPTX ...@@ -191,12 +142,13 @@ namespace PPTX
Add(pRelation->rId(), file); Add(pRelation->rId(), file);
smart_ptr<FileContainer> pContainer = file.smart_dynamic_cast<FileContainer>(); smart_ptr<FileContainer> pContainer = file.smart_dynamic_cast<FileContainer>();
Event->Progress(0, percent + m_lPercent);
if (Event) Event->Progress(0, percent + m_lPercent);
if (pContainer.IsInit()) if (pContainer.IsInit())
{ {
pContainer->m_lPercent = m_lPercent; pContainer->m_lPercent = m_lPercent;
Event->AddPercent(m_lPercent); if (Event) Event->AddPercent(m_lPercent);
pContainer->read(normPath, map, Event); pContainer->read(normPath, map, Event);
m_bCancelled = pContainer->m_bCancelled; m_bCancelled = pContainer->m_bCancelled;
...@@ -289,7 +241,70 @@ namespace PPTX ...@@ -289,7 +241,70 @@ namespace PPTX
} }
} }
} }
smart_ptr<PPTX::LegacyDiagramText> FileContainer::legacyDiagramText(const OOX::RId& rId) const
{
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mContainer.find(rId.get());
if (pPair == m_mContainer.end ())
return smart_ptr<LegacyDiagramText>();
return pPair->second.smart_dynamic_cast<LegacyDiagramText>();
}
void FileContainer::read(const OOX::CPath& filename, FileMap& map, IPPTXEvent* Event)
{
OOX::CRels rels(filename);
OOX::CPath path = filename.GetDirectory();
read(rels, path, map, Event);
}
OOX::CPath FileContainer::CorrectPathRels(const OOX::CPath& path, OOX::Rels::CRelationShip* relation )
{
if (relation->IsExternal()) return relation->Target();
OOX::CPath filename = path / relation->Target();
if ( NSFile::CFileBinary::Exists(filename.GetPath()) == true ) return filename;
//file_1_ (1).pptx
std::wstring strDefDirectory;
for (int i = 0; i < 9; i++)
{
if (relation->Type() == arDefDirectories[i][0])
{
strDefDirectory = arDefDirectories[i][1];
break;
}
}
OOX::CPath new_filename = strDefDirectory + FILE_SEPARATOR_STR + relation->Filename().GetFilename();
filename = path / new_filename;
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false)
{
filename = FindFileInDirectory(path.GetPath(), relation->Filename().GetFilename()); // find true path by filename
if (NSFile::CFileBinary::Exists(filename.GetPath()) == false)
return filename;
}
*relation = OOX::Rels::CRelationShip( relation->rId(), relation->Type(), filename);
return filename;
}
//---------------------------------------------------------------------------------------------------------------------------
void WrapperFile::write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content) const
{
m_WrittenFileName = filename.GetFilename();
NSBinPptxRW::CXmlWriter oXmlWriter;
toXmlWriter(&oXmlWriter);
oXmlWriter.SaveToFile(filename.m_strFilename);
content.Registration(type().OverrideType(), directory, m_WrittenFileName);
m_written = true;
}
//---------------------------------------------------------------------------------------------------------------------------
void CCommonRels::_read(const OOX::CRels& rels, const OOX::CPath& path) void CCommonRels::_read(const OOX::CRels& rels, const OOX::CPath& path)
{ {
size_t nCount = rels.m_arrRelations.size(); size_t nCount = rels.m_arrRelations.size();
......
...@@ -60,6 +60,7 @@ namespace PPTX ...@@ -60,6 +60,7 @@ namespace PPTX
void read(const OOX::CPath& filename, FileMap& map, IPPTXEvent* Event); void read(const OOX::CPath& filename, FileMap& map, IPPTXEvent* Event);
void read(const OOX::CRels& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event); void read(const OOX::CRels& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event);
void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content) const; void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content) const;
void write(OOX::CRels& rels, const OOX::CPath& current, const OOX::CPath& directory, OOX::CContentTypes& content) const; void write(OOX::CRels& rels, const OOX::CPath& current, const OOX::CPath& directory, OOX::CContentTypes& content) const;
......
...@@ -54,6 +54,7 @@ ...@@ -54,6 +54,7 @@
#include "NotesMaster.h" #include "NotesMaster.h"
#include "LegacyDiagramText.h" #include "LegacyDiagramText.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h"
#include "../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h" #include "../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h" #include "../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h" #include "../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
...@@ -79,13 +80,13 @@ namespace PPTX ...@@ -79,13 +80,13 @@ namespace PPTX
return smart_ptr<OOX::File>(NULL); return smart_ptr<OOX::File>(NULL);
} }
if (relation.Type() == OOX::Presentation::FileTypes::App) if (relation.Type() == OOX::FileTypes::App)
return smart_ptr<OOX::File>(new PPTX::App(filename, map)); return smart_ptr<OOX::File>(new PPTX::App(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::Core) else if (relation.Type() == OOX::FileTypes::Core)
return smart_ptr<OOX::File>(new PPTX::Core(filename, map)); return smart_ptr<OOX::File>(new PPTX::Core(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::Presentation) else if (relation.Type() == OOX::Presentation::FileTypes::Presentation)
return smart_ptr<OOX::File>(new PPTX::Presentation(filename, map)); return smart_ptr<OOX::File>(new PPTX::Presentation(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::Theme) else if (relation.Type() == OOX::FileTypes::Theme)
return smart_ptr<OOX::File>(new PPTX::Theme(filename, map)); return smart_ptr<OOX::File>(new PPTX::Theme(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::SlideMaster) else if (relation.Type() == OOX::Presentation::FileTypes::SlideMaster)
return smart_ptr<OOX::File>(new PPTX::SlideMaster(filename, map)); return smart_ptr<OOX::File>(new PPTX::SlideMaster(filename, map));
...@@ -105,19 +106,17 @@ namespace PPTX ...@@ -105,19 +106,17 @@ namespace PPTX
return smart_ptr<OOX::File>(new PPTX::ViewProps(filename, map)); return smart_ptr<OOX::File>(new PPTX::ViewProps(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::TableStyles) else if (relation.Type() == OOX::Presentation::FileTypes::TableStyles)
return smart_ptr<OOX::File>(new PPTX::TableStyles(filename, map)); return smart_ptr<OOX::File>(new PPTX::TableStyles(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::LegacyDiagramText) else if (relation.Type() == OOX::FileTypes::LegacyDiagramText)
return smart_ptr<OOX::File>(new PPTX::LegacyDiagramText(filename)); return smart_ptr<OOX::File>(new PPTX::LegacyDiagramText(filename));
else if (relation.Type() == OOX::Presentation::FileTypes::VmlDrawing) else if (relation.Type() == OOX::FileTypes::VmlDrawing)
return smart_ptr<OOX::File>(new OOX::CVmlDrawing(OOX::CPath(), filename)); return smart_ptr<OOX::File>(new OOX::CVmlDrawing(OOX::CPath(), filename));
else if (relation.Type() == OOX::Presentation::FileTypes::Media) // FOR NONE OPTIMIZED PPTX FILES
return smart_ptr<OOX::File>(new OOX::HyperLink(filename));
else if (relation.Type() == OOX::FileTypes::Chart)
return smart_ptr<OOX::File>(new OOX::Image(filename)); // нужен только filepath
else if (relation.Type() == OOX::Presentation::FileTypes::CommentAuthors) else if (relation.Type() == OOX::Presentation::FileTypes::CommentAuthors)
return smart_ptr<OOX::File>(new PPTX::Authors(filename, map)); return smart_ptr<OOX::File>(new PPTX::Authors(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::SlideComments) else if (relation.Type() == OOX::Presentation::FileTypes::SlideComments)
return smart_ptr<OOX::File>(new PPTX::Comments(filename, map)); return smart_ptr<OOX::File>(new PPTX::Comments(filename, map));
else if (relation.Type() == OOX::FileTypes::Chart)
return smart_ptr<OOX::File>(new OOX::Spreadsheet::CChartSpace(filename, filename));
else if (relation.Type() == OOX::FileTypes::HyperLink) else if (relation.Type() == OOX::FileTypes::HyperLink)
return smart_ptr<OOX::File>(new OOX::HyperLink(relation.Target())); return smart_ptr<OOX::File>(new OOX::HyperLink(relation.Target()));
else if ((relation.Type() == OOX::FileTypes::ExternalImage) && (relation.IsExternal())) else if ((relation.Type() == OOX::FileTypes::ExternalImage) && (relation.IsExternal()))
...@@ -138,6 +137,8 @@ namespace PPTX ...@@ -138,6 +137,8 @@ namespace PPTX
return smart_ptr<OOX::File>(new OOX::CDiagramDrawing(filename)); return smart_ptr<OOX::File>(new OOX::CDiagramDrawing(filename));
else if (relation.Type() == OOX::FileTypes::OleObject) else if (relation.Type() == OOX::FileTypes::OleObject)
return smart_ptr<OOX::File>(new OOX::OleObject(filename)); return smart_ptr<OOX::File>(new OOX::OleObject(filename));
else if (relation.Type() == OOX::FileTypes::MicrosoftOfficeUnknown) //ms package
return smart_ptr<OOX::File>(new OOX::OleObject( filename, true ));
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile()); return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
} }
...@@ -184,6 +185,9 @@ namespace PPTX ...@@ -184,6 +185,9 @@ namespace PPTX
else if(strT == OOX::FileTypes::OleObject) else if(strT == OOX::FileTypes::OleObject)
return smart_ptr<OOX::File>(new OOX::OleObject(filename)); return smart_ptr<OOX::File>(new OOX::OleObject(filename));
else if ( strT == OOX::FileTypes::MicrosoftOfficeUnknown) //ms package
return smart_ptr<OOX::File>(new OOX::OleObject( filename, true ));
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile()); return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
} }
......
...@@ -51,13 +51,9 @@ namespace PPTX ...@@ -51,13 +51,9 @@ namespace PPTX
~FileMap() ~FileMap()
{ {
} }
public:
std::map<std::wstring, smart_ptr<OOX::File>> m_map; std::map<std::wstring, smart_ptr<OOX::File>> m_map;
public: AVSINLINE std::map<std::wstring, smart_ptr<OOX::File>>::iterator find(const OOX::CPath& path)
AVSINLINE std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator find(const OOX::CPath& path)
{ {
return m_map.find(path.m_strFilename); return m_map.find(path.m_strFilename);
} }
......
This diff is collapsed.
...@@ -66,7 +66,7 @@ namespace PPTX ...@@ -66,7 +66,7 @@ namespace PPTX
m_lPercent = (long)floor(1000000. / files); m_lPercent = (long)floor(1000000. / files);
FileContainer::read(rels, path, map, Event); FileContainer::read(rels, path, map, Event);
long percent = Event->GetPercent(); long percent = Event ? Event->GetPercent() : 0;
if(m_bCancelled && percent < 1000000) if(m_bCancelled && percent < 1000000)
return; return;
...@@ -81,7 +81,7 @@ namespace PPTX ...@@ -81,7 +81,7 @@ namespace PPTX
{ {
const OOX::FileType& curType = pPair->second->type(); const OOX::FileType& curType = pPair->second->type();
if (OOX::Presentation::FileTypes::ThemePPTX == curType) if (OOX::FileTypes::Theme == curType)
{ {
smart_ptr<PPTX::Theme> pTheme = pPair->second.smart_dynamic_cast<PPTX::Theme>(); smart_ptr<PPTX::Theme> pTheme = pPair->second.smart_dynamic_cast<PPTX::Theme>();
if (pTheme.IsInit()) if (pTheme.IsInit())
...@@ -141,7 +141,8 @@ namespace PPTX ...@@ -141,7 +141,8 @@ namespace PPTX
} }
} }
Event->Progress(0, 1000000); if (Event)
Event->Progress(0, 1000000);
} }
void Folder::write(const OOX::CPath& path) void Folder::write(const OOX::CPath& path)
......
...@@ -44,15 +44,12 @@ namespace PPTX ...@@ -44,15 +44,12 @@ namespace PPTX
Folder(); Folder();
Folder(const OOX::CPath& path, IPPTXEvent* Event); Folder(const OOX::CPath& path, IPPTXEvent* Event);
public:
void read(const OOX::CPath& path, IPPTXEvent* Event); void read(const OOX::CPath& path, IPPTXEvent* Event);
void write(const OOX::CPath& path); void write(const OOX::CPath& path);
void createFromTemplate(const OOX::CPath& path); void createFromTemplate(const OOX::CPath& path);
public:
const bool isValid(const OOX::CPath& path) const; const bool isValid(const OOX::CPath& path) const;
public:
void extractPictures(const OOX::CPath& path); void extractPictures(const OOX::CPath& path);
void extractPictures(const OOX::CPath& source, const OOX::CPath& path); void extractPictures(const OOX::CPath& source, const OOX::CPath& path);
private: private:
......
...@@ -78,22 +78,7 @@ namespace PPTX ...@@ -78,22 +78,7 @@ namespace PPTX
} }
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{ {
XmlUtils::CAttribute oAttr; WrapperFile::write(filename, directory, content);
oAttr.Write(_T("xmlns:a"), PPTX::g_Namespaces.a.m_strLink);
oAttr.Write(_T("xmlns:r"), PPTX::g_Namespaces.r.m_strLink);
oAttr.Write(_T("xmlns:m"), PPTX::g_Namespaces.m.m_strLink);
oAttr.Write(_T("xmlns:w"), PPTX::g_Namespaces.w.m_strLink);
XmlUtils::CNodeValue oValue;
oValue.Write(cSld);
oValue.Write(clrMap);
oValue.WriteNullable(hf);
XmlUtils::SaveToFile(filename.m_strFilename, XmlUtils::CreateNode(_T("p:handoutMaster"), oAttr, oValue));
content.Registration(type().OverrideType(), directory, filename);
m_written = true;
m_WrittenFileName = filename.GetFilename();
FileContainer::write(filename, directory, content); FileContainer::write(filename, directory, content);
} }
......
...@@ -105,7 +105,7 @@ namespace PPTX ...@@ -105,7 +105,7 @@ namespace PPTX
public: public:
virtual const OOX::FileType type() const virtual const OOX::FileType type() const
{ {
return OOX::Presentation::FileTypes::LegacyDiagramText; return OOX::FileTypes::LegacyDiagramText;
} }
virtual const OOX::CPath DefaultDirectory() const virtual const OOX::CPath DefaultDirectory() const
{ {
......
...@@ -60,6 +60,8 @@ namespace PPTX ...@@ -60,6 +60,8 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
ReadAttributes( oReader ); ReadAttributes( oReader );
if ( oReader.IsEmptyNode() ) if ( oReader.IsEmptyNode() )
......
...@@ -80,22 +80,14 @@ namespace PPTX ...@@ -80,22 +80,14 @@ namespace PPTX
Normalize(); Normalize();
} }
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("type"), type.get());
oAttr.Write(_T("startAt"), startAt);
return XmlUtils::CreateNode(_T("a:buAutoNum"), oAttr);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:buAutoNum")); pWriter->StartNode(L"a:buAutoNum");
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("type"), type.get()); pWriter->WriteAttribute(L"type", type.get());
pWriter->WriteAttribute(_T("startAt"), startAt); pWriter->WriteAttribute(L"startAt", startAt);
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->EndNode(_T("a:buAutoNum")); pWriter->EndNode(L"a:buAutoNum");
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
...@@ -79,18 +79,14 @@ namespace PPTX ...@@ -79,18 +79,14 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
blip = node.ReadNodeNoNS(_T("blip")); blip = node.ReadNodeNoNS(L"blip");
}
virtual std::wstring toXML() const
{
return XmlUtils::CreateNode(_T("a:buBlip"), blip.toXML());
} }
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:buBlip")); pWriter->StartNode(L"a:buBlip");
pWriter->EndAttributes(); pWriter->EndAttributes();
blip.toXmlWriter(pWriter); blip.toXmlWriter(pWriter);
pWriter->EndNode(_T("a:buBlip")); pWriter->EndNode(L"a:buBlip");
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
...@@ -88,17 +88,12 @@ namespace PPTX ...@@ -88,17 +88,12 @@ namespace PPTX
{ {
Color.GetColorFrom(node); Color.GetColorFrom(node);
} }
virtual std::wstring toXML() const
{
return XmlUtils::CreateNode(_T("a:buClr"), Color.toXML());
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:buClr")); pWriter->StartNode(L"a:buClr");
pWriter->EndAttributes(); pWriter->EndAttributes();
Color.toXmlWriter(pWriter); Color.toXmlWriter(pWriter);
pWriter->EndNode(_T("a:buClr")); pWriter->EndNode(L"a:buClr");
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
...@@ -78,13 +78,9 @@ namespace PPTX ...@@ -78,13 +78,9 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
} }
virtual std::wstring toXML() const
{
return _T("<a:buClrTx/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->WriteString(_T("<a:buClrTx/>")); pWriter->WriteString(L"<a:buClrTx/>");
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
...@@ -79,13 +79,9 @@ namespace PPTX ...@@ -79,13 +79,9 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
} }
virtual std::wstring toXML() const
{
return _T("<a:buFontTx/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->WriteString(_T("<a:buFontTx/>")); pWriter->WriteString(L"<a:buFontTx/>");
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
...@@ -62,13 +62,9 @@ namespace PPTX ...@@ -62,13 +62,9 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
} }
virtual std::wstring toXML() const
{
return _T("<a:buNone/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->WriteString(_T("<a:buNone/>")); pWriter->WriteString(L"<a:buNone/>");
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
...@@ -64,27 +64,20 @@ namespace PPTX ...@@ -64,27 +64,20 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val) WritingElement_ReadAttributes_ReadSingle ( oReader, L"val", val)
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
val = node.ReadAttributeInt(_T("val")); val = node.ReadAttributeInt(L"val");
} }
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("val"), val);
return XmlUtils::CreateNode(_T("a:buSzPts"), oAttr);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:buSzPts")); pWriter->StartNode(L"a:buSzPts");
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("val"), val); pWriter->WriteAttribute(L"val", val);
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->EndNode(_T("a:buSzPts")); pWriter->EndNode(L"a:buSzPts");
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
...@@ -62,13 +62,9 @@ namespace PPTX ...@@ -62,13 +62,9 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
} }
virtual std::wstring toXML() const
{
return _T("<a:buSzTx/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->WriteString(_T("<a:buSzTx/>")); pWriter->WriteString(L"<a:buSzTx/>");
} }
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
...@@ -34,8 +34,9 @@ ...@@ -34,8 +34,9 @@
#define PPTX_LOGIC_C_NV_PROPERTIES_INCLUDE_H_ #define PPTX_LOGIC_C_NV_PROPERTIES_INCLUDE_H_
#include "./../WrapperWritingElement.h" #include "./../WrapperWritingElement.h"
#include "Hyperlink.h"
#include "Hyperlink.h"
#include "extp.h"
namespace PPTX namespace PPTX
{ {
...@@ -81,11 +82,29 @@ namespace PPTX ...@@ -81,11 +82,29 @@ namespace PPTX
int nParentDepth = oReader.GetDepth(); int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) ) while( oReader.ReadNextSiblingNode( nParentDepth ) )
{ {
std::wstring sName = oReader.GetName(); std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (sName == L"a:hlinkClick") if (strName == L"hlinkClick")
hlinkClick = oReader; hlinkClick = oReader;
else if (sName == L"a:hlinkHover") else if (strName == L"hlinkHover")
hlinkHover = oReader; hlinkHover = oReader;
else if (strName == L"extLst")
{
if ( oReader.IsEmptyNode() )
continue;
int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
{
Ext ext;
ext.fromXML(oReader);
if (ext.spid.IsInit())
{
oleSpid = ext.spid;
break;
}
}
}
} }
} }
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
...@@ -102,6 +121,29 @@ namespace PPTX ...@@ -102,6 +121,29 @@ namespace PPTX
hlinkClick = node.ReadNode(_T("a:hlinkClick")); hlinkClick = node.ReadNode(_T("a:hlinkClick"));
hlinkHover = node.ReadNode(_T("a:hlinkHover")); hlinkHover = node.ReadNode(_T("a:hlinkHover"));
XmlUtils::CXmlNode list = node.ReadNodeNoNS(_T("extLst"));
if (list.IsValid())
{
XmlUtils::CXmlNodes oNodes;
if (list.GetNodes(_T("*"), oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNode;
oNodes.GetAt(i, oNode);
Ext ext;
ext.fromXML(oNode);
if (ext.spid.IsInit())
{
oleSpid = ext.spid;
break;
}
}
}
}
Normalize(); Normalize();
} }
...@@ -163,12 +205,13 @@ namespace PPTX ...@@ -163,12 +205,13 @@ namespace PPTX
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute (_T("id"), _id); pWriter->WriteAttribute (_T("id"), _id);
pWriter->WriteAttribute (_T("name"), XmlUtils::EncodeXmlString(name)); pWriter->WriteAttribute (_T("name"), XmlUtils::EncodeXmlString(name));
if (descr.IsInit()) if (descr.IsInit())
{ {
std::wstring d = XmlUtils::EncodeXmlString(descr.get()); std::wstring d = XmlUtils::EncodeXmlString(descr.get());
XmlUtils::replace_all(d, L"\n", L"&#xA;"); XmlUtils::replace_all(d, L"\n", L"&#xA;");
pWriter->WriteAttribute (_T("descr"), d);
} pWriter->WriteAttribute (_T("descr"), d);
}
pWriter->WriteAttribute (_T("hidden"), hidden); pWriter->WriteAttribute (_T("hidden"), hidden);
if (title.IsInit()) pWriter->WriteAttribute (_T("title"), XmlUtils::EncodeXmlString(title.get())); if (title.IsInit()) pWriter->WriteAttribute (_T("title"), XmlUtils::EncodeXmlString(title.get()));
...@@ -239,8 +282,29 @@ namespace PPTX ...@@ -239,8 +282,29 @@ namespace PPTX
break; break;
} }
} }
while (pReader->GetPos() < _end_rec)
// TODO: пока без гиперссылок {
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
hlinkClick = new PPTX::Logic::Hyperlink(L"hlinkClick");
hlinkClick->fromPPTY(pReader);
break;
}
case 1:
{
hlinkHover = new PPTX::Logic::Hyperlink(L"hlinkHover");
hlinkHover->fromPPTY(pReader);
break;
}
default:
{
break;
}
}
}
pReader->Seek(_end_rec); pReader->Seek(_end_rec);
} }
...@@ -254,6 +318,9 @@ namespace PPTX ...@@ -254,6 +318,9 @@ namespace PPTX
nullable_string title; nullable_string title;
nullable<Hyperlink> hlinkClick; nullable<Hyperlink> hlinkClick;
nullable<Hyperlink> hlinkHover; nullable<Hyperlink> hlinkHover;
//std::vector<Ext> extLst;
nullable_string oleSpid;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -44,6 +44,7 @@ namespace PPTX ...@@ -44,6 +44,7 @@ namespace PPTX
namespace Logic namespace Logic
{ {
class ClrMap;
class ColorBase : public WrapperWritingElement class ColorBase : public WrapperWritingElement
{ {
public: public:
...@@ -102,7 +103,7 @@ namespace PPTX ...@@ -102,7 +103,7 @@ namespace PPTX
return ApplyModifiers(ctABGR); return ApplyModifiers(ctABGR);
} }
virtual DWORD GetRGBColor(NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap, DWORD ARGB = 0) virtual DWORD GetRGBColor(NSCommon::smart_ptr<PPTX::Theme>& _oTheme, NSCommon::smart_ptr<PPTX::Logic::ClrMap>& _oClrMap, DWORD ARGB = 0)
{ {
return GetARGB(ARGB); return GetARGB(ARGB);
} }
......
...@@ -119,7 +119,7 @@ namespace PPTX ...@@ -119,7 +119,7 @@ namespace PPTX
return ColorBase::GetABGR(ABGR); return ColorBase::GetABGR(ABGR);
} }
DWORD SchemeClr::GetRGBColor(NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap, DWORD ARGB) DWORD SchemeClr::GetRGBColor(NSCommon::smart_ptr<PPTX::Theme>& oTheme, NSCommon::smart_ptr<PPTX::Logic::ClrMap>& oClrMap, DWORD ARGB)
{ {
DWORD RGB = 0; DWORD RGB = 0;
...@@ -128,9 +128,6 @@ namespace PPTX ...@@ -128,9 +128,6 @@ namespace PPTX
RGB = ARGB; RGB = ARGB;
else else
{ {
smart_ptr<PPTX::Theme> oTheme = _oTheme.smart_dynamic_cast<PPTX::Theme>();
smart_ptr<PPTX::Logic::ClrMap> oClrMap = _oClrMap.smart_dynamic_cast<PPTX::Logic::ClrMap>();
if (oTheme.is_init()) if (oTheme.is_init())
{ {
if (oClrMap.is_init()) if (oClrMap.is_init())
......
...@@ -91,7 +91,7 @@ namespace PPTX ...@@ -91,7 +91,7 @@ namespace PPTX
virtual DWORD GetBGRA(DWORD BGRA) const; virtual DWORD GetBGRA(DWORD BGRA) const;
virtual DWORD GetABGR(DWORD ABGR) const; virtual DWORD GetABGR(DWORD ABGR) const;
virtual DWORD GetRGBColor(NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap, DWORD ARGB = 0); virtual DWORD GetRGBColor(NSCommon::smart_ptr<PPTX::Theme>& _oTheme, NSCommon::smart_ptr<PPTX::Logic::ClrMap>& _oClrMap, DWORD ARGB = 0);
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{ {
......
...@@ -63,15 +63,6 @@ namespace PPTX ...@@ -63,15 +63,6 @@ namespace PPTX
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
std::wstring EffectStyle::toXML() const
{
XmlUtils::CNodeValue oValue;
oValue.Write(EffectList);
oValue.WriteNullable(scene3d);
oValue.WriteNullable(sp3d);
return XmlUtils::CreateNode(_T("a:effectStyle"), oValue);
}
void EffectStyle::FillParentPointersForChilds() void EffectStyle::FillParentPointersForChilds()
{ {
......
...@@ -66,8 +66,6 @@ namespace PPTX ...@@ -66,8 +66,6 @@ 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 std::wstring toXML() const;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:effectStyle")); pWriter->StartNode(_T("a:effectStyle"));
......
...@@ -35,35 +35,37 @@ ...@@ -35,35 +35,37 @@
#include "./../WrapperWritingElement.h" #include "./../WrapperWritingElement.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/RId.h" #include "../../../Common/DocxFormat/Source/DocxFormat/RId.h"
//<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}"> //<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">
//<p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId2"> //<p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId2">
//<p14:trim st="93333.0816" end="96583.4816"/> //<p14:trim st="93333.0816" end="96583.4816"/>
//</p14:media> //</p14:media>
//</p:ext> //</p:ext>
//<ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
// <x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
// <x14:sparklineGroup displayEmptyCellsAs="gap">
// <x14:colorSeries theme="5" tint="-0.499984740745262"/>
// <x14:colorNegative theme="6"/>
// <x14:colorAxis rgb="FF000000"/>
// <x14:colorMarkers theme="5" tint="-0.499984740745262"/>
// <x14:colorFirst theme="5" tint="0.39997558519241921"/>
// <x14:colorLast theme="5" tint="0.39997558519241921"/>
// <x14:colorHigh theme="5"/>
// <x14:colorLow theme="5"/>
// <x14:sparklines>
// <x14:sparkline>
// <xm:f>Лист1!D10:D12</xm:f>
// <xm:sqref>H12</xm:sqref>
// </x14:sparkline>
// </x14:sparklines>
// </x14:sparklineGroup>
// </x14:sparklineGroups>
//</ext>
//<a:ext uri="{63B3BB69-23CF-44E3-9099-C40C66FF867C}">
// <a14:compatExt spid="_x0000_s1025"/>
//</a:ext>
//<ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">
// <x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">
// <x14:sparklineGroup displayEmptyCellsAs="gap">
// <x14:colorSeries theme="5" tint="-0.499984740745262"/>
// <x14:colorNegative theme="6"/>
// <x14:colorAxis rgb="FF000000"/>
// <x14:colorMarkers theme="5" tint="-0.499984740745262"/>
// <x14:colorFirst theme="5" tint="0.39997558519241921"/>
// <x14:colorLast theme="5" tint="0.39997558519241921"/>
// <x14:colorHigh theme="5"/>
// <x14:colorLow theme="5"/>
// <x14:sparklines>
// <x14:sparkline>
// <xm:f>Лист1!D10:D12</xm:f>
// <xm:sqref>H12</xm:sqref>
// </x14:sparkline>
// </x14:sparklines>
// </x14:sparklineGroup>
// </x14:sparklineGroups>
//</ext>
namespace PPTX namespace PPTX
{ {
namespace Logic namespace Logic
...@@ -79,6 +81,8 @@ namespace PPTX ...@@ -79,6 +81,8 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
ReadAttributes(oReader);
if ( oReader.IsEmptyNode() ) if ( oReader.IsEmptyNode() )
return; return;
...@@ -89,8 +93,7 @@ namespace PPTX ...@@ -89,8 +93,7 @@ namespace PPTX
if (strName == L"media") if (strName == L"media")
{ {
ReadAttributes(oReader); ReadAttributes1(oReader);
//std::wstring xmkl = media.GetXml();
int nParentDepth1 = oReader.GetDepth(); int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) ) while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
...@@ -99,35 +102,61 @@ namespace PPTX ...@@ -99,35 +102,61 @@ namespace PPTX
if (strName1 == L"trim") if (strName1 == L"trim")
{ {
ReadAttributes(oReader); ReadAttributes2(oReader);
} }
} }
} }
else if (strName == L"compatExt")
{
ReadAttributes3(oReader);
}
} }
} }
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("uri"), uri)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes1(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("r:embed"), link)
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("st"), st) WritingElement_ReadAttributes_Read_if ( oReader, _T("st"), st)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("end"), end) WritingElement_ReadAttributes_Read_else_if ( oReader, _T("end"), end)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("r:embed"), link)
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
virtual void fromXML(XmlUtils::CXmlNode& node) void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
{ {
XmlUtils::CXmlNode media; WritingElement_ReadAttributes_Start( oReader )
if (node.GetNode(_T("p14:media"), media)) WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), spid)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{//todooo списком ..
XmlUtils::CXmlNode media = node.ReadNodeNoNS(_T("media"));
if (media.IsValid())
{ {
link = media.GetAttribute(_T("r:embed")); link = media.GetAttribute(_T("r:embed"));
std::wstring xmkl = media.GetXml(); XmlUtils::CXmlNode trim = media.ReadNodeNoNS(_T("trim"));
if (trim.IsValid())
XmlUtils::CXmlNode trim;
if (media.GetNode(_T("p14:trim"), trim))
{ {
trim.ReadAttributeBase(_T("st"), st); trim.ReadAttributeBase(_T("st"), st);
trim.ReadAttributeBase(_T("end"), end); trim.ReadAttributeBase(_T("end"), end);
} }
return;
}
XmlUtils::CXmlNode compatExt = node.ReadNodeNoNS(_T("compatExt"));
if (compatExt.IsValid())
{
spid = media.GetAttribute(_T("spid"));
return;
} }
} }
...@@ -147,18 +176,24 @@ namespace PPTX ...@@ -147,18 +176,24 @@ namespace PPTX
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{ {
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
link.toPPTY(0, pWriter); if (link.IsInit())
link->toPPTY(0, pWriter);
pWriter->WriteDouble2(1, st); pWriter->WriteDouble2(1, st);
pWriter->WriteDouble2(2, end); pWriter->WriteDouble2(2, end);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
} }
//-------------------------------------------------------
OOX::RId link; nullable_string uri;
//media
// trim nullable<OOX::RId> link;
nullable_double st; nullable_double st;
nullable_double end; nullable_double end;
//compatExt
nullable_string spid;
//dataModelExt
//table
//sparklineGroups
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -143,22 +143,18 @@ namespace PPTX ...@@ -143,22 +143,18 @@ namespace PPTX
} }
std::wstring Blip::GetFullOleName(const OOX::RId& oRId, FileContainer* pRels)const std::wstring Blip::GetFullOleName(const OOX::RId& oRId, FileContainer* pRels)const
{ {
if (pRels != NULL) smart_ptr<OOX::OleObject> pOleObject;
{
smart_ptr<OOX::OleObject> p = pRels->GetOleObject(oRId); if (pRels != NULL) pOleObject = pRels->GetOleObject(oRId);
if (p.is_init()) else if(parentFileIs<Slide>()) pOleObject = parentFileAs<Slide>().GetOleObject(oRId);
return p->filename().m_strFilename; else if(parentFileIs<SlideLayout>()) pOleObject = parentFileAs<SlideLayout>().GetOleObject(oRId);
} else if(parentFileIs<SlideMaster>()) pOleObject = parentFileAs<SlideMaster>().GetOleObject(oRId);
else if(parentFileIs<Theme>()) pOleObject = parentFileAs<Theme>().GetOleObject(oRId);
if(parentFileIs<Slide>())
return parentFileAs<Slide>().GetOleFromRId(oRId); if (pOleObject.IsInit())
else if(parentFileIs<SlideLayout>()) return pOleObject->filename().m_strFilename;
return parentFileAs<SlideLayout>().GetOleFromRId(oRId);
else if(parentFileIs<SlideMaster>()) return L"";
return parentFileAs<SlideMaster>().GetOleFromRId(oRId);
else if(parentFileIs<Theme>())
return parentFileAs<Theme>().GetOleFromRId(oRId);
return _T("");
} }
} // namespace Logic } // namespace Logic
} // namespace PPTX } // namespace PPTX
\ No newline at end of file
...@@ -62,11 +62,9 @@ namespace PPTX ...@@ -62,11 +62,9 @@ namespace PPTX
embed = oSrc.embed; embed = oSrc.embed;
link = oSrc.link; link = oSrc.link;
m_namespace = oSrc.m_namespace; m_namespace = oSrc.m_namespace;
oleRid = oSrc.oleRid; oleRid = oSrc.oleRid;
oleFilepathBin = oSrc.oleFilepathBin; oleFilepathBin = oSrc.oleFilepathBin;
oleFilepathImg = oSrc.oleFilepathImg;
oleRidImg = oSrc.oleRidImg;
return *this; return *this;
} }
...@@ -115,15 +113,6 @@ namespace PPTX ...@@ -115,15 +113,6 @@ namespace PPTX
pWriter->WriteLimit2(0, cstate); pWriter->WriteLimit2(0, cstate);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
/*
old version
if (embed.is_init())
embed->toPPTY(0, pWriter);
if (link.is_init())
link->toPPTY(1, pWriter);
*/
// new version
if (embed.is_init()) if (embed.is_init())
pWriter->WriteString1(10, embed->get()); pWriter->WriteString1(10, embed->get());
if (link.is_init()) if (link.is_init())
...@@ -161,7 +150,17 @@ namespace PPTX ...@@ -161,7 +150,17 @@ namespace PPTX
olePath= this->GetFullOleName(OOX::RId(oleRid), pRels); olePath= this->GetFullOleName(OOX::RId(oleRid), pRels);
} }
NSShapeImageGen::CImageInfo oId = pWriter->m_pCommon->m_pImageManager->WriteImage(this->GetFullPicName(pRels), olePath, dX, dY, dW, dH); std::wstring imagePath;
if(!oleFilepathImage.empty())
{
imagePath = oleFilepathImage;
}
else
{
imagePath = this->GetFullPicName(pRels);
}
NSShapeImageGen::CImageInfo oId = pWriter->m_pCommon->m_pImageManager->WriteImage(imagePath, olePath, dX, dY, dW, dH);
std::wstring s = oId.GetPath2(); std::wstring s = oId.GetPath2();
pWriter->StartRecord(3); pWriter->StartRecord(3);
...@@ -172,23 +171,20 @@ namespace PPTX ...@@ -172,23 +171,20 @@ namespace PPTX
pWriter->EndRecord(); pWriter->EndRecord();
} }
public:
virtual std::wstring GetFullPicName(FileContainer* pRels = NULL)const; virtual std::wstring GetFullPicName(FileContainer* pRels = NULL)const;
virtual std::wstring GetFullOleName(const OOX::RId& pRId, FileContainer* pRels = NULL)const; virtual std::wstring GetFullOleName(const OOX::RId& pRId, FileContainer* pRels = NULL)const;
public:
std::vector<UniEffect> Effects; std::vector<UniEffect> Effects;
nullable_limit<Limit::BlipCompression> cstate; nullable_limit<Limit::BlipCompression> cstate;
nullable<OOX::RId> embed; nullable<OOX::RId> embed;
nullable<OOX::RId> link; nullable<OOX::RId> link;
public: std::wstring m_namespace;
std::wstring m_namespace;
std::wstring oleRid;
std::wstring oleRid; //internal
std::wstring oleFilepathBin; std::wstring oleFilepathBin;
std::wstring oleFilepathImg; std::wstring oleFilepathImage;
std::wstring oleRidImg;
protected: protected:
virtual void FillParentPointersForChilds(); virtual void FillParentPointersForChilds();
}; };
......
...@@ -333,21 +333,23 @@ namespace PPTX ...@@ -333,21 +333,23 @@ namespace PPTX
pReader->Skip(6); // len + start attributes + type pReader->Skip(6); // len + start attributes + type
// ------------------- // -------------------
std::wstring strUrl = pReader->GetString2(); std::wstring strImagePath = pReader->GetString2();
std::wstring strOrigBase64 = _T("");
std::wstring strOrigBase64;
std::wstring strTempFile ;
std::wstring strTempFile = _T("");
bool bIsUrl = false; bool bIsUrl = false;
if (0 == strUrl.find(_T("data:")))
if (0 == strImagePath.find(_T("data:")))
{ {
bool bBase64 = false; bool bBase64 = false;
strOrigBase64 = strUrl; strOrigBase64 = strImagePath;
int nFind = (int)strUrl.find(_T(",")); int nFind = (int)strImagePath.find(_T(","));
std::wstring sImageExtension; std::wstring sImageExtension;
std::wstring sFormatDataString = XmlUtils::GetLower(strUrl.substr(5,nFind-5)); std::wstring sFormatDataString = XmlUtils::GetLower(strImagePath.substr(5,nFind-5));
{ {
int nFind1 = (int)sFormatDataString.find(_T("base64")); int nFind1 = (int)sFormatDataString.find(_T("base64"));
if (nFind1 >=0 ) bBase64 = true; if (nFind1 >=0 ) bBase64 = true;
...@@ -361,9 +363,9 @@ namespace PPTX ...@@ -361,9 +363,9 @@ namespace PPTX
sImageExtension = sFormatDataString.substr(nFind1 + 6, nFind2 - 6 - nFind1); sImageExtension = sFormatDataString.substr(nFind1 + 6, nFind2 - 6 - nFind1);
} }
} }
strUrl.erase(0, nFind + 1); strImagePath.erase(0, nFind + 1);
std::string __s = std::string(strUrl.begin(), strUrl.end()); std::string __s = std::string(strImagePath.begin(), strImagePath.end());
int len = (int)__s.length(); int len = (int)__s.length();
BYTE* pDstBuffer = NULL; BYTE* pDstBuffer = NULL;
int dstLen = 0; int dstLen = 0;
...@@ -397,7 +399,7 @@ namespace PPTX ...@@ -397,7 +399,7 @@ namespace PPTX
oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen); oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen);
oTempFile.CloseFile(); oTempFile.CloseFile();
strUrl = strTempFile =pathTemp.GetPath(); // strTempFile для удаления strImagePath = strTempFile =pathTemp.GetPath(); // strTempFile для удаления
if (bBase64) if (bBase64)
{ {
RELEASEARRAYOBJECTS(pDstBuffer); RELEASEARRAYOBJECTS(pDstBuffer);
...@@ -405,18 +407,18 @@ namespace PPTX ...@@ -405,18 +407,18 @@ namespace PPTX
} }
else else
{ {
if (0 != strUrl.find(_T("http:")) && if (0 != strImagePath.find(_T("http:")) &&
0 != strUrl.find(_T("https:")) && 0 != strImagePath.find(_T("https:")) &&
0 != strUrl.find(_T("ftp:")) && 0 != strImagePath.find(_T("ftp:")) &&
0 != strUrl.find(_T("file:"))) 0 != strImagePath.find(_T("file:")))
{ {
if (0 == strUrl.find(_T("theme"))) if (0 == strImagePath.find(_T("theme")))
{ {
strUrl = pReader->m_strFolderExternalThemes + FILE_SEPARATOR_STR + strUrl; strImagePath = pReader->m_strFolderExternalThemes + FILE_SEPARATOR_STR + strImagePath;
} }
else else
{ {
strUrl = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + strUrl; strImagePath = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + strImagePath;
} }
} }
else else
...@@ -426,11 +428,11 @@ namespace PPTX ...@@ -426,11 +428,11 @@ namespace PPTX
//в случае url не надо нормализовать путь //в случае url не надо нормализовать путь
if(!bIsUrl) if(!bIsUrl)
{ {
OOX::CPath pathUrl = strUrl; OOX::CPath pathUrl = strImagePath;
strUrl = pathUrl.GetPath(); strImagePath = pathUrl.GetPath();
} }
NSBinPptxRW::CRelsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteImage(strUrl, oleData, strOrigBase64); NSBinPptxRW::_relsGeneratorInfo oRelsGeneratorInfo = pReader->m_pRels->WriteImage(strImagePath, oleFile, oleData, strOrigBase64);
// ------------------- // -------------------
if (strTempFile != _T("")) if (strTempFile != _T(""))
...@@ -442,14 +444,13 @@ namespace PPTX ...@@ -442,14 +444,13 @@ namespace PPTX
if (!blip.is_init()) if (!blip.is_init())
blip = new PPTX::Logic::Blip(); blip = new PPTX::Logic::Blip();
blip->embed = new OOX::RId((size_t)oRelsGeneratorInfo.m_nImageRId); blip->embed = new OOX::RId((size_t)oRelsGeneratorInfo.nImageRId);
blip->oleFilepathImage = oRelsGeneratorInfo.sFilepathImage;
if(oRelsGeneratorInfo.m_nOleRId > 0)
if(oRelsGeneratorInfo.nOleRId > 0)
{ {
blip->oleRid = OOX::RId((size_t)oRelsGeneratorInfo.m_nOleRId).get(); blip->oleRid = OOX::RId((size_t)oRelsGeneratorInfo.nOleRId).get();
blip->oleFilepathBin = oRelsGeneratorInfo.m_sFilepathBin; blip->oleFilepathBin = oRelsGeneratorInfo.sFilepathOle;
blip->oleFilepathImg = oRelsGeneratorInfo.m_sFilepathImg;
blip->oleRidImg = blip->embed->get();
} }
pReader->Skip(1); // end attribute pReader->Skip(1); // end attribute
...@@ -494,8 +495,9 @@ namespace PPTX ...@@ -494,8 +495,9 @@ namespace PPTX
pReader->Seek(_e); pReader->Seek(_e);
} }
mutable std::wstring m_namespace;
public:
nullable<Blip> blip; nullable<Blip> blip;
nullable<Rect> srcRect; nullable<Rect> srcRect;
nullable<Tile> tile; nullable<Tile> tile;
...@@ -504,9 +506,9 @@ namespace PPTX ...@@ -504,9 +506,9 @@ namespace PPTX
nullable_int dpi; nullable_int dpi;
nullable_bool rotWithShape; nullable_bool rotWithShape;
mutable std::wstring m_namespace; //internal
//internal smart_ptr<OOX::OleObject> oleFile;
std::wstring oleData; std::wstring oleData;
protected: protected:
virtual void FillParentPointersForChilds() virtual void FillParentPointersForChilds()
{ {
......
...@@ -61,6 +61,9 @@ namespace PPTX ...@@ -61,6 +61,9 @@ namespace PPTX
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth(); int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) ) while( oReader.ReadNextSiblingNode( nCurDepth ) )
{ {
......
...@@ -79,13 +79,6 @@ namespace PPTX ...@@ -79,13 +79,6 @@ namespace PPTX
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.WriteLimitNullable(_T("idx"), idx);
return XmlUtils::CreateNode(m_name, oAttr, Color.toXML());
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
......
...@@ -378,8 +378,7 @@ namespace PPTX ...@@ -378,8 +378,7 @@ namespace PPTX
template<class T> AVSINLINE const bool is() const { return m_geometry.is<T>(); } template<class T> AVSINLINE const bool is() const { return m_geometry.is<T>(); }
template<class T> AVSINLINE T& as() { return m_geometry.as<T>(); } template<class T> AVSINLINE T& as() { return m_geometry.as<T>(); }
template<class T> AVSINLINE const T& as() const { return m_geometry.as<T>(); } template<class T> AVSINLINE const T& as() const { return m_geometry.as<T>(); }
//public:
private:
smart_ptr<WrapperWritingElement> m_geometry; smart_ptr<WrapperWritingElement> m_geometry;
protected: protected:
virtual void FillParentPointersForChilds(){}; virtual void FillParentPointersForChilds(){};
......
...@@ -87,10 +87,32 @@ namespace PPTX ...@@ -87,10 +87,32 @@ namespace PPTX
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
void GraphicFrame::ReadAttributes2(XmlUtils::CXmlLiteReader& oReader)
{
//todooo нормальный объект сделать!!
if (!olePic.IsInit()) olePic.Init();
if (!olePic->oleObject.IsInit()) olePic->oleObject.Init();
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("progId"), olePic->oleObject->m_sProgId)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("r:id"), olePic->oleObject->m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("imgW"), olePic->oleObject->m_oDxaOrig )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("imgH"), olePic->oleObject->m_oDyaOrig )
WritingElement_ReadAttributes_End( oReader )
if(olePic->oleObject->m_oDxaOrig.IsInit())
{
olePic->oleObject->m_oDxaOrig = (int)Emu_To_Twips(olePic->oleObject->m_oDxaOrig.get());
}
if(olePic->oleObject->m_oDyaOrig.IsInit())
{
olePic->oleObject->m_oDyaOrig = (int)Emu_To_Twips(olePic->oleObject->m_oDyaOrig.get());
}
}
void GraphicFrame::ReadAttributes3(XmlUtils::CXmlLiteReader& oReader) void GraphicFrame::ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
{ {
WritingElement_ReadAttributes_Start( oReader ) WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), spid ) WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), oleSpid )
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
void GraphicFrame::fromXML2(XmlUtils::CXmlLiteReader& oReader) void GraphicFrame::fromXML2(XmlUtils::CXmlLiteReader& oReader)
...@@ -135,7 +157,10 @@ namespace PPTX ...@@ -135,7 +157,10 @@ namespace PPTX
else if (strName == L"oleObj") else if (strName == L"oleObj")
{ {
ReadAttributes3(oReader); ReadAttributes2(oReader);
if ( oReader.IsEmptyNode() )
continue;
int nCurDepth1 = oReader.GetDepth(); int nCurDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth1 ) ) while( oReader.ReadNextSiblingNode( nCurDepth1 ) )
...@@ -144,11 +169,12 @@ namespace PPTX ...@@ -144,11 +169,12 @@ namespace PPTX
if (strName1 == L"pic") if (strName1 == L"pic")
{ {
result = true; result = true;
pic = oReader; if (!olePic.IsInit()) //создается уровнем выше
//pic->fromXMLOle(oNode2); olePic.Init();
olePic->fromXML(oReader);
if (xfrm.IsInit()) if (xfrm.IsInit())
xfrm->Merge(pic->spPr.xfrm); xfrm->Merge(olePic->spPr.xfrm);
} }
} }
} }
...@@ -169,6 +195,9 @@ namespace PPTX ...@@ -169,6 +195,9 @@ namespace PPTX
} }
else if (strName == L"AlternateContent") else if (strName == L"AlternateContent")
{ {
if ( oReader.IsEmptyNode() )
continue;
int nCurDepth1 = oReader.GetDepth(); int nCurDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth1 ) ) while( oReader.ReadNextSiblingNode( nCurDepth1 ) )
{ {
...@@ -197,7 +226,64 @@ namespace PPTX ...@@ -197,7 +226,64 @@ namespace PPTX
} }
return result; return result;
} }
bool GraphicFrame::fromXML3(XmlUtils::CXmlNode& node)
{
bool result = false;
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);
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (L"tbl" == strName)
{
table = oNode;
if (table.IsInit()) result = true;
}
else if (L"oleObj" == strName)
{
olePic = oNode.ReadNode(L"p:pic");
if (olePic.IsInit())
{
olePic->fromXMLOle(oNode);
result = true;
}
}
else if (L"AlternateContent" == strName)
{
XmlUtils::CXmlNode oNodeChoice;
if (!result && oNode.GetNode(L"mc:Choice", oNodeChoice))
result = fromXML3(oNodeChoice);
XmlUtils::CXmlNode oNodeFallback;
if (!result && oNode.GetNode(L"mc:Fallback", oNodeFallback))
result = fromXML3(oNodeFallback);
}
else if (L"relIds" == strName)
{
smartArt = oNode;
result = true;
}
else if (L"chart" == strName)
{
chartRec = oNode;
result = true;
}
else if (L"legacyDrawing" == strName)
{
oNode.ReadAttributeBase(L"spid", oleSpid);
result = true;
}
}
}
return result;
}
void GraphicFrame::fromXML(XmlUtils::CXmlNode& node) void GraphicFrame::fromXML(XmlUtils::CXmlNode& node)
{ {
m_namespace = XmlUtils::GetNamespace(node.GetName()); m_namespace = XmlUtils::GetNamespace(node.GetName());
...@@ -223,70 +309,7 @@ namespace PPTX ...@@ -223,70 +309,7 @@ namespace PPTX
XmlUtils::CXmlNode oNodeData; XmlUtils::CXmlNode oNodeData;
if (oNode.GetNode(L"a:graphicData", oNodeData)) if (oNode.GetNode(L"a:graphicData", oNodeData))
{ {
XmlUtils::CXmlNode oNode1 = oNodeData.ReadNodeNoNS(L"tbl"); fromXML3(oNodeData);
if (oNode1.IsValid())
{
table = oNode1;
return;
}
XmlUtils::CXmlNode oNode2 = oNodeData.ReadNodeNoNS(L"oleObj");
if (oNode2.IsValid())
{
oNode2.ReadAttributeBase(L"spid", spid);
pic = oNode2.ReadNode(L"p:pic");
if (pic.is_init())
{
pic->fromXMLOle(oNode2);
if (xfrm.IsInit())
xfrm->Merge(pic->spPr.xfrm);
}
}
XmlUtils::CXmlNode oNode3 = oNodeData.ReadNodeNoNS(L"AlternateContent");
if (oNode3.IsValid())
{
XmlUtils::CXmlNode oNodeC;
if (oNode3.GetNode(L"mc:Choice", oNodeC))
{
XmlUtils::CXmlNode oNodeO;
if (oNodeC.GetNode(L"p:oleObj", oNodeO))
{
oNodeO.ReadAttributeBase(L"spid", spid);
}
}
XmlUtils::CXmlNode oNodeFallback;
if (oNode3.GetNode(L"mc:Fallback", oNodeFallback))
{
XmlUtils::CXmlNode oNodeO;
if (oNodeFallback.GetNode(L"p:oleObj", oNodeO))
{
pic = oNodeO.ReadNode(L"p:pic");
if (pic.is_init())
{
pic->fromXMLOle(oNode2);
if (xfrm.IsInit())
xfrm->Merge(pic->spPr.xfrm);
}
}
}
}
XmlUtils::CXmlNode oNode4 = oNodeData.ReadNode(L"dgm:relIds");
if (oNode4.IsValid())
{
smartArt = oNode4;
}
XmlUtils::CXmlNode oNode5 = oNodeData.ReadNode(L"c:chart");
if (oNode5.IsValid())
{
chartRec = oNode5;
}
XmlUtils::CXmlNode oNode6 = oNodeData.ReadNode(L"com:legacyDrawing");
if (oNode6.IsValid())
{
oNode6.ReadAttributeBase(L"spid", spid);
}
} }
} }
} }
...@@ -338,23 +361,23 @@ namespace PPTX ...@@ -338,23 +361,23 @@ namespace PPTX
void GraphicFrame::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const void GraphicFrame::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{ {
if (pic.is_init()) if (olePic.is_init())
{ {
pic->toPPTY(pWriter); olePic->toPPTY(pWriter);
return; return;
} }
if (!smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !spid.is_init() ) if (!smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !oleSpid.is_init() )
return; return;
std::wstring xml_object_vml; std::wstring xml_object_vml;
std::wstring xml_object_rels; std::wstring xml_object_rels;
if (spid.is_init()) if (oleSpid.is_init())
{ {
xml_object_vml = GetVmlXmlBySpid(xml_object_rels); xml_object_vml = GetVmlXmlBySpid(xml_object_rels);
} }
if (smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !spid.is_init()) if (smartArt.is_init() && !table.is_init() && !chartRec.is_init() && !oleSpid.is_init())
{ {
smartArt->LoadDrawing(pWriter); smartArt->LoadDrawing(pWriter);
...@@ -437,7 +460,7 @@ namespace PPTX ...@@ -437,7 +460,7 @@ namespace PPTX
pWriter->StartRecord(SPTREE_TYPE_GRFRAME); pWriter->StartRecord(SPTREE_TYPE_GRFRAME);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString2(0, spid); pWriter->WriteString2(0, oleSpid);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd); pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecord1(0, nvGraphicFramePr); pWriter->WriteRecord1(0, nvGraphicFramePr);
...@@ -470,7 +493,7 @@ namespace PPTX ...@@ -470,7 +493,7 @@ namespace PPTX
{ {
case 0: case 0:
{ {
spid = pReader->GetString2(); oleSpid = pReader->GetString2();
break; break;
} }
default: default:
...@@ -584,8 +607,8 @@ namespace PPTX ...@@ -584,8 +607,8 @@ namespace PPTX
smartArt->SetParentPointer(this); smartArt->SetParentPointer(this);
if (chartRec.is_init()) if (chartRec.is_init())
chartRec->SetParentPointer(this); chartRec->SetParentPointer(this);
if (pic.is_init()) if (olePic.is_init())
pic->SetParentPointer(this); olePic->SetParentPointer(this);
} }
std::wstring GraphicFrame::GetVmlXmlBySpid(std::wstring & rels)const std::wstring GraphicFrame::GetVmlXmlBySpid(std::wstring & rels)const
{ {
...@@ -593,17 +616,17 @@ namespace PPTX ...@@ -593,17 +616,17 @@ namespace PPTX
rels = L""; rels = L"";
if(parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit()) if(parentFileIs<PPTX::Slide>() && parentFileAs<PPTX::Slide>().Vml.IsInit())
{ {
xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(spid.get_value_or(L"")); xml = parentFileAs<PPTX::Slide>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
rels = parentFileAs<PPTX::Slide>().Vml->GetReadPath().GetPath(); rels = parentFileAs<PPTX::Slide>().Vml->GetReadPath().GetPath();
} }
else if(parentFileIs<PPTX::SlideLayout>() && parentFileAs<PPTX::SlideLayout>().Vml.IsInit()) else if(parentFileIs<PPTX::SlideLayout>() && parentFileAs<PPTX::SlideLayout>().Vml.IsInit())
{ {
xml= parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(spid.get_value_or(L"")); xml= parentFileAs<PPTX::SlideLayout>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
rels = parentFileAs<PPTX::SlideLayout>().Vml->GetReadPath().GetPath(); rels = parentFileAs<PPTX::SlideLayout>().Vml->GetReadPath().GetPath();
} }
else if(parentFileIs<PPTX::SlideMaster>() && parentFileAs<PPTX::SlideMaster>().Vml.IsInit()) else if(parentFileIs<PPTX::SlideMaster>() && parentFileAs<PPTX::SlideMaster>().Vml.IsInit())
{ {
xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(spid.get_value_or(L"")); xml = parentFileAs<PPTX::SlideMaster>().GetVmlXmlBySpid(oleSpid.get_value_or(L""));
rels = parentFileAs<PPTX::SlideMaster>().Vml->GetReadPath().GetPath(); rels = parentFileAs<PPTX::SlideMaster>().Vml->GetReadPath().GetPath();
} }
......
...@@ -63,10 +63,12 @@ namespace PPTX ...@@ -63,10 +63,12 @@ namespace PPTX
const GraphicFrame& operator =(XmlUtils::CXmlNode& node); const GraphicFrame& operator =(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlNode& node); virtual void fromXML(XmlUtils::CXmlNode& node);
bool fromXML3(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader); virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
void fromXML2(XmlUtils::CXmlLiteReader& oReader); void fromXML2(XmlUtils::CXmlLiteReader& oReader);
bool fromXML3(XmlUtils::CXmlLiteReader& oReader); bool fromXML3(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader); void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const; virtual std::wstring toXML() const;
...@@ -86,11 +88,12 @@ namespace PPTX ...@@ -86,11 +88,12 @@ namespace PPTX
nullable<Xfrm> xfrm; nullable<Xfrm> xfrm;
nullable_string spid; nullable_string oleSpid;
nullable<Pic> olePic;
nullable<Table> table; nullable<Table> table;
nullable<SmartArt> smartArt; nullable<SmartArt> smartArt;
nullable<ChartRec> chartRec; nullable<ChartRec> chartRec;
nullable<Pic> pic;
nullable<SpTreeElem> element; nullable<SpTreeElem> element;
std::wstring GetVmlXmlBySpid(std::wstring & rels) const; std::wstring GetVmlXmlBySpid(std::wstring & rels) const;
......
...@@ -46,7 +46,11 @@ namespace PPTX ...@@ -46,7 +46,11 @@ namespace PPTX
{ {
public: public:
WritingElement_AdditionConstructors(Hyperlink) WritingElement_AdditionConstructors(Hyperlink)
PPTX_LOGIC_BASE2(Hyperlink)
Hyperlink(std::wstring name = L"hlinkClick")
{
m_name = name;
}
virtual OOX::EElementType getType () const virtual OOX::EElementType getType () const
{ {
...@@ -54,6 +58,8 @@ namespace PPTX ...@@ -54,6 +58,8 @@ namespace PPTX
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
m_name = XmlUtils::GetNameNoNS(oReader.GetName());
ReadAttributes( oReader ); ReadAttributes( oReader );
if ( oReader.IsEmptyNode() ) if ( oReader.IsEmptyNode() )
...@@ -100,23 +106,6 @@ namespace PPTX ...@@ -100,23 +106,6 @@ namespace PPTX
node.ReadAttributeBase(L"highlightClick", highlightClick); node.ReadAttributeBase(L"highlightClick", highlightClick);
node.ReadAttributeBase(L"endSnd", endSnd); node.ReadAttributeBase(L"endSnd", endSnd);
} }
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("r:id"), id);
oAttr.Write(_T("invalidUrl"), invalidUrl);
oAttr.Write(_T("action"), action);
oAttr.Write(_T("tgtFrame"), tgtFrame);
oAttr.Write(_T("tooltip"), tooltip);
oAttr.Write(_T("history"), history);
oAttr.Write(_T("highlightClick"), highlightClick);
oAttr.Write(_T("endSnd"), endSnd);
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(snd);
return XmlUtils::CreateNode(_T("a:") + m_name, oAttr, oValue);
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{ {
...@@ -225,35 +214,38 @@ namespace PPTX ...@@ -225,35 +214,38 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:") + m_name); pWriter->StartNode(L"a:" + m_name);
pWriter->StartAttributes(); pWriter->StartAttributes();
pWriter->WriteAttribute(_T("r:id"), id); pWriter->WriteAttribute (L"r:id", id);
pWriter->WriteAttribute2(_T("invalidUrl"), invalidUrl); pWriter->WriteAttribute2(L"invalidUrl", invalidUrl);
pWriter->WriteAttribute2(_T("action"), action); pWriter->WriteAttribute2(L"action", action);
pWriter->WriteAttribute2(_T("tgtFrame"), tgtFrame); pWriter->WriteAttribute2(L"tgtFrame", tgtFrame);
pWriter->WriteAttribute2(_T("tooltip"), tooltip);
pWriter->WriteAttribute(_T("history"), history); if (tooltip.IsInit())
pWriter->WriteAttribute(_T("highlightClick"), highlightClick); pWriter->WriteAttribute(L"tooltip", XmlUtils::EncodeXmlString(*tooltip));
pWriter->WriteAttribute(_T("endSnd"), endSnd);
pWriter->WriteAttribute(L"history", history);
pWriter->WriteAttribute(L"highlightClick", highlightClick);
pWriter->WriteAttribute(L"endSnd", endSnd);
pWriter->EndAttributes(); pWriter->EndAttributes();
pWriter->Write(snd); pWriter->Write(snd);
pWriter->EndNode(_T("a:") + m_name); pWriter->EndNode(L"a:" + m_name);
} }
public: public:
nullable<WavAudioFile> snd; nullable<WavAudioFile> snd;
nullable_string id;//<OOX::RId> id;// <xsd:attribute ref="r:id" use="optional"/> nullable_string id; //<OOX::RId> id;// <xsd:attribute ref="r:id" use="optional"/>
nullable_string invalidUrl;//default="" nullable_string invalidUrl; //default=""
nullable_string action;//default="" nullable_string action; //default=""
nullable_string tgtFrame;//default="" nullable_string tgtFrame; //default=""
nullable_string tooltip;//default="" nullable_string tooltip; //default=""
nullable_bool history;//default="true" nullable_bool history; //default="true"
nullable_bool highlightClick;//default="false" nullable_bool highlightClick; //default="false"
nullable_bool endSnd;//default="false" nullable_bool endSnd; //default="false"
//private: //private:
public: public:
std::wstring m_name; std::wstring m_name;
......
...@@ -165,7 +165,7 @@ namespace PPTX ...@@ -165,7 +165,7 @@ namespace PPTX
pWriter->Write(ph); pWriter->Write(ph);
media.toXmlWriter(pWriter); media.toXmlWriter(pWriter);
pWriter->WriteArray(_T("p:extLst"), extLst); pWriter->WriteArray(strNS + _T(":extLst"), extLst);
pWriter->EndNode(strNS + _T(":nvPr")); pWriter->EndNode(strNS + _T(":nvPr"));
} }
......
...@@ -177,15 +177,6 @@ namespace PPTX ...@@ -177,15 +177,6 @@ namespace PPTX
{ {
fromXML2(node, true); fromXML2(node, true);
} }
virtual std::wstring toXML() const
{
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(pPr);
oValue.WriteArray(RunElems);
oValue.WriteNullable(endParaRPr);
return XmlUtils::CreateNode(_T("a:p"), oValue);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
......
...@@ -82,17 +82,6 @@ namespace PPTX ...@@ -82,17 +82,6 @@ namespace PPTX
swAng = node.GetAttribute(_T("swAng")); swAng = node.GetAttribute(_T("swAng"));
} }
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("wR"), wR);
oAttr.Write(_T("hR"), hR);
oAttr.Write(_T("stAng"), stAng);
oAttr.Write(_T("swAng"), swAng);
return XmlUtils::CreateNode(_T("a:arcTo"), oAttr);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:arcTo")); pWriter->StartNode(_T("a:arcTo"));
......
...@@ -64,11 +64,6 @@ namespace PPTX ...@@ -64,11 +64,6 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node) virtual void fromXML(XmlUtils::CXmlNode& node)
{ {
} }
virtual std::wstring toXML() const
{
return _T("<a:close/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->WriteString(_T("<a:close/>")); pWriter->WriteString(_T("<a:close/>"));
......
...@@ -115,14 +115,6 @@ namespace PPTX ...@@ -115,14 +115,6 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("y"), y ) WritingElement_ReadAttributes_Read_else_if ( oReader, _T("y"), y )
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
virtual std::wstring toXML() const
{
std::wstring str1 = L"<a:pt x=\"" + x[0] + L"\" y=\"" + y[0] + L"\" />";
std::wstring str2 = L"<a:pt x=\"" + x[1] + L"\" y=\"" + y[1] + L"\" />";
std::wstring str3 = L"<a:pt x=\"" + x[2] + L"\" y=\"" + y[2] + L"\" />";
return _T("<a:cubicBezTo>") + str1 + str2 + str3 + _T("</a:cubicBezTo>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
......
...@@ -92,12 +92,6 @@ namespace PPTX ...@@ -92,12 +92,6 @@ namespace PPTX
y = oNode.GetAttribute(_T("y")); y = oNode.GetAttribute(_T("y"));
} }
} }
virtual std::wstring toXML() const
{
return _T("<a:lnTo><a:pt x=\"") + x + L"\" y=\"" + y + _T("\"/></a:lnTo>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:lnTo")); pWriter->StartNode(_T("a:lnTo"));
......
...@@ -92,11 +92,6 @@ namespace PPTX ...@@ -92,11 +92,6 @@ namespace PPTX
y = oNode.GetAttribute(_T("y")); y = oNode.GetAttribute(_T("y"));
} }
} }
virtual std::wstring toXML() const
{
return _T("<a:moveTo><a:pt x=\"") + x + L"\" y=\"" + y + _T("\"/></a:moveTo>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:moveTo")); pWriter->StartNode(_T("a:moveTo"));
......
...@@ -108,15 +108,6 @@ namespace PPTX ...@@ -108,15 +108,6 @@ namespace PPTX
} }
} }
} }
virtual std::wstring toXML() const
{
std::wstring str1 = L"<a:pt x=\"" + x[0] + L"\" y=\"" + y[0] + L"\" />";
std::wstring str2 = L"<a:pt x=\"" + x[1] + L"\" y=\"" + y[1] + L"\" />";
return _T("<a:quadBezTo>") + str1 + str2 + _T("</a:quadBezTo>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:quadBezTo")); pWriter->StartNode(_T("a:quadBezTo"));
......
This diff is collapsed.
This diff is collapsed.
...@@ -77,13 +77,6 @@ namespace PPTX ...@@ -77,13 +77,6 @@ namespace PPTX
rPr = oReader; rPr = oReader;
} }
} }
virtual std::wstring toXML() const
{
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(rPr);
return XmlUtils::CreateNode(_T("a:br"), oValue);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
......
...@@ -137,26 +137,6 @@ namespace PPTX ...@@ -137,26 +137,6 @@ namespace PPTX
FillParentPointersForChilds(); FillParentPointersForChilds();
} }
virtual std::wstring toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("id"), id);
oAttr.Write(_T("type"), type);
XmlUtils::CNodeValue oValue;
oValue.WriteNullable(rPr);
oValue.WriteNullable(pPr);
if (text.IsInit())
{
std::wstring s = XmlUtils::EncodeXmlString(*text);
oValue.m_strValue += (_T("<a:t>") + s + _T("</a:t>"));
}
return XmlUtils::CreateNode(_T("a:fld"), oAttr, oValue);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
pWriter->StartNode(_T("a:fld")); pWriter->StartNode(_T("a:fld"));
......
This diff is collapsed.
This diff is collapsed.
...@@ -192,7 +192,7 @@ namespace PPTX ...@@ -192,7 +192,7 @@ namespace PPTX
return XmlUtils::CreateNode(name_, oValue); return XmlUtils::CreateNode(name_, oValue);
} }
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group = false); void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::Theme>& oTheme, smart_ptr<PPTX::Logic::ClrMap>& oClrMap, bool in_group = false);
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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