Commit f89d75ae authored by ElenaSubbotina's avatar ElenaSubbotina

PptxFormat refactoring and extending drawing objects

parent 40350720
......@@ -60,6 +60,10 @@ namespace BinDocxRW
{
class CDocxSerializer;
}
namespace OOX
{
class CContentTypes;
}
namespace NSBinPptxRW
{
class CBinaryFileWriter;
......@@ -72,12 +76,14 @@ namespace PPTX
class WrapperFile;
class WrapperWritingElement;
class CCommonRels;
class Theme;
namespace Logic
{
class SpTreeElem;
class Xfrm;
class Shape;
class ClrMap;
}
class CStringTrimmer
......@@ -196,8 +202,8 @@ namespace NSBinPptxRW
IRenderer* m_pOOXToVMLRenderer;
bool m_bIsUseConvertion2007;
NSCommon::smart_ptr<PPTX::WrapperFile>* m_pTheme;
NSCommon::smart_ptr<PPTX::WrapperWritingElement>* m_pClrMap;
NSCommon::smart_ptr<PPTX::Theme>* m_pTheme;
NSCommon::smart_ptr<PPTX::Logic::ClrMap>* m_pClrMap;
std::wstring m_strFontDirectory;
......@@ -213,27 +219,24 @@ namespace NSBinPptxRW
HRESULT AddShapeType (const std::wstring& sXml);
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 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);
PPTX::Logic::SpTreeElem ObjectFromXml(const std::wstring& sXml, std::wstring** pMainProps);
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);
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 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(SetFontDir) (const std::wstring& sFontDir);
......@@ -243,19 +246,17 @@ namespace NSBinPptxRW
HRESULT SetAdditionalParam(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);
int GetDocumentChartsCount ();
void SetObjectIdVML (int val);
int GetObjectIdVML ();
void SetSourceFileDir (std::wstring path, int type = 1);
void SetSourceFileDir (std::wstring path, int nDocType = 1/*XMLWRITER_DOC_TYPE_DOCX*/);
std::wstring GetContentTypes();
std::wstring GetOleXlsx();
std::wstring GetOleDrawing();
OOX::CContentTypes* GetContentTypes();
protected:
nullable<PPTX::Logic::Xfrm> m_oxfrm_override;
......
......@@ -51,19 +51,17 @@ namespace PPTX
class CPPTXFile : public PPTX::IPPTXEvent
{
private:
PPTX::Folder* m_pFolder;
std::wstring m_strTempDir;
std::wstring m_strDirectory;
PPTX::Folder* m_pFolder;
std::wstring m_strTempDir;
std::wstring m_strDirectory;
// writer to ppty
std::wstring m_strFontDirectory;
std::wstring m_strMediaDirectory;
bool m_bIsUseSystemFonts;
bool m_bIsUseSystemFonts;
std::wstring m_strEmbeddedFontsDirectory;
std::wstring m_strFolderThemes;
//load_from_resource m_fCallbackResource;
extract_to_directory m_fCallbackExtract;
compress_from_directory m_fCallbackCompress;
progress_operation m_fCallbackProgress;
......
......@@ -74,8 +74,8 @@ namespace PPTX2EditorAdvanced
continue;
}
oBinaryWriter.m_pCommon->m_oRels.push_back (CMasterSlideInfo());
CMasterSlideInfo& oMasterInfo = oBinaryWriter.m_pCommon->m_oRels[oBinaryWriter.m_pCommon->m_oRels.size() - 1];
oBinaryWriter.m_pCommon->m_oRels.push_back (_masterSlideInfo());
_masterSlideInfo& oMasterInfo = oBinaryWriter.m_pCommon->m_oRels[oBinaryWriter.m_pCommon->m_oRels.size() - 1];
// записываем mainMaster
LONG lCountSM = (LONG)_slideMasters.size();
......@@ -218,7 +218,7 @@ namespace PPTX2EditorAdvanced
oBinaryWriter.WriteULONG(0);
// 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())
{
oBinaryWriter.StartMainRecord(NSMainTables::App);
......@@ -226,7 +226,7 @@ namespace PPTX2EditorAdvanced
}
// 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())
{
oBinaryWriter.StartMainRecord(NSMainTables::Core);
......@@ -412,12 +412,12 @@ namespace PPTX2EditorAdvanced
oBinaryWriter.StartMainRecord(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());
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);
......
This diff is collapsed.
......@@ -268,18 +268,15 @@ namespace NSBinPptxRW
std::wstring m_strStyleMain;
std::wstring m_strAttributesMain;
std::wstring m_strNodes;
std::wstring m_strOleXlsx;
std::wstring m_strOleDrawing;
IRenderer* m_pOOXToVMLRenderer;
bool m_bIsTop;
bool m_bIsUseOffice2007;
CXmlWriter() : m_oWriter()
{
m_lDocType = XMLWRITER_DOC_TYPE_PPTX;
CXmlWriter (BYTE ooxType = XMLWRITER_DOC_TYPE_PPTX) : m_oWriter()
{
m_lDocType = ooxType;
m_lFlag = 0;
m_lGroupIndex = 0;
m_lObjectId = 0;
......@@ -290,7 +287,7 @@ namespace NSBinPptxRW
m_pOOXToVMLRenderer = NULL;
m_bIsTop = false;
}
}
~CXmlWriter()
{
}
......
......@@ -161,13 +161,9 @@ namespace NSShapeImageGen
LONG m_lNextIDImage;
CCalculatorCRC32 m_oCRC;
LONG m_lDstFormat;
NSWMFToImageConverter::CImageExt m_oImageExt;
CFontManager* m_pFontManager;
public:
CFontManager* m_pFontManager;
CImageManager()
{
......@@ -188,77 +184,6 @@ namespace NSShapeImageGen
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 info;
......@@ -507,10 +432,13 @@ namespace NSShapeImageGen
oInfo.m_lID = m_lNextIDImage;
LONG lImageType = m_oImageExt.GetImageType(strFileName);
bool bVector = (1 == lImageType || 2 == lImageType);
bool bOle = !strOleFile.empty();
if(bVector)
oInfo.m_eType = (1 == lImageType) ? itWMF : itEMF;
oInfo.SetNameModificator(oInfo.m_eType, bOle);
std::wstring strSaveDir = m_strDstMedia + FILE_SEPARATOR_STR;
......@@ -519,7 +447,12 @@ namespace NSShapeImageGen
//copy ole bin
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);
}
......
......@@ -114,71 +114,13 @@ namespace PPTX
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{
XmlUtils::CAttribute oAttr;
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();
WrapperFile::write(filename, directory, content);
}
public:
virtual const OOX::FileType type() const
{
return OOX::Presentation::FileTypes::App;
return OOX::FileTypes::App;
}
virtual const OOX::CPath DefaultDirectory() const
{
......@@ -291,7 +233,7 @@ namespace PPTX
nullable_int MMClips; // (Total Number of Multimedia Clips)
nullable_bool ScaleCrop; // (Thumbnail Display Mode)
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_bool LinksUpToDate; // (Links Up-to-Date)
nullable_bool SharedDoc; // (Shared Document)
......
......@@ -174,7 +174,8 @@ namespace PPTX
}
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{
{
WrapperFile::write(filename, directory, content);
}
public:
......
......@@ -311,7 +311,8 @@ namespace PPTX
}
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{
{
WrapperFile::write(filename, directory, content);
}
public:
......
......@@ -86,67 +86,13 @@ namespace PPTX
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{
XmlUtils::CAttribute oAttr;
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();
WrapperFile::write(filename, directory, content);
}
public:
virtual const OOX::FileType type() const
{
return OOX::Presentation::FileTypes::Core;
return OOX::FileTypes::Core;
}
virtual const OOX::CPath DefaultDirectory() const
{
......
......@@ -94,55 +94,6 @@ namespace PPTX
{
//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)
{
bool bIsSlide = false;
......@@ -158,7 +109,7 @@ namespace PPTX
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 ||
pRelation->Type() == OOX::Presentation::FileTypes::Slide))
......@@ -180,7 +131,7 @@ namespace PPTX
}
else
{
long percent = Event->GetPercent();
long percent = Event ? Event->GetPercent() : 0;
smart_ptr<OOX::File> file = PPTX::FileFactory::CreateFilePPTX(normPath, *pRelation, map);
......@@ -191,12 +142,13 @@ namespace PPTX
Add(pRelation->rId(), file);
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())
{
pContainer->m_lPercent = m_lPercent;
Event->AddPercent(m_lPercent);
if (Event) Event->AddPercent(m_lPercent);
pContainer->read(normPath, map, Event);
m_bCancelled = pContainer->m_bCancelled;
......@@ -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)
{
size_t nCount = rels.m_arrRelations.size();
......
......@@ -60,6 +60,7 @@ namespace PPTX
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 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;
......
......@@ -54,6 +54,7 @@
#include "NotesMaster.h"
#include "LegacyDiagramText.h"
#include "../../Common/DocxFormat/Source/XlsxFormat/Chart/Chart.h"
#include "../../Common/DocxFormat/Source/DocxFormat/VmlDrawing.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramData.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Diagram/DiagramDrawing.h"
......@@ -79,13 +80,13 @@ namespace PPTX
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));
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));
else if (relation.Type() == OOX::Presentation::FileTypes::Presentation)
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));
else if (relation.Type() == OOX::Presentation::FileTypes::SlideMaster)
return smart_ptr<OOX::File>(new PPTX::SlideMaster(filename, map));
......@@ -105,19 +106,17 @@ namespace PPTX
return smart_ptr<OOX::File>(new PPTX::ViewProps(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::TableStyles)
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));
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));
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)
return smart_ptr<OOX::File>(new PPTX::Authors(filename, map));
else if (relation.Type() == OOX::Presentation::FileTypes::SlideComments)
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)
return smart_ptr<OOX::File>(new OOX::HyperLink(relation.Target()));
else if ((relation.Type() == OOX::FileTypes::ExternalImage) && (relation.IsExternal()))
......@@ -138,6 +137,8 @@ namespace PPTX
return smart_ptr<OOX::File>(new OOX::CDiagramDrawing(filename));
else if (relation.Type() == OOX::FileTypes::OleObject)
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());
}
......@@ -184,6 +185,9 @@ namespace PPTX
else if(strT == OOX::FileTypes::OleObject)
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());
}
......
......@@ -51,13 +51,9 @@ namespace PPTX
~FileMap()
{
}
public:
std::map<std::wstring, smart_ptr<OOX::File>> m_map;
public:
AVSINLINE std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator find(const OOX::CPath& path)
AVSINLINE std::map<std::wstring, smart_ptr<OOX::File>>::iterator find(const OOX::CPath& path)
{
return m_map.find(path.m_strFilename);
}
......
This diff is collapsed.
......@@ -66,7 +66,7 @@ namespace PPTX
m_lPercent = (long)floor(1000000. / files);
FileContainer::read(rels, path, map, Event);
long percent = Event->GetPercent();
long percent = Event ? Event->GetPercent() : 0;
if(m_bCancelled && percent < 1000000)
return;
......@@ -81,7 +81,7 @@ namespace PPTX
{
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>();
if (pTheme.IsInit())
......@@ -141,7 +141,8 @@ namespace PPTX
}
}
Event->Progress(0, 1000000);
if (Event)
Event->Progress(0, 1000000);
}
void Folder::write(const OOX::CPath& path)
......
......@@ -44,15 +44,12 @@ namespace PPTX
Folder();
Folder(const OOX::CPath& path, IPPTXEvent* Event);
public:
void read(const OOX::CPath& path, IPPTXEvent* Event);
void write(const OOX::CPath& path);
void createFromTemplate(const OOX::CPath& path);
public:
const bool isValid(const OOX::CPath& path) const;
public:
void extractPictures(const OOX::CPath& path);
void extractPictures(const OOX::CPath& source, const OOX::CPath& path);
private:
......
......@@ -78,22 +78,7 @@ namespace PPTX
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::CContentTypes& content)const
{
XmlUtils::CAttribute oAttr;
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();
WrapperFile::write(filename, directory, content);
FileContainer::write(filename, directory, content);
}
......
......@@ -105,7 +105,7 @@ namespace PPTX
public:
virtual const OOX::FileType type() const
{
return OOX::Presentation::FileTypes::LegacyDiagramText;
return OOX::FileTypes::LegacyDiagramText;
}
virtual const OOX::CPath DefaultDirectory() const
{
......
......@@ -60,6 +60,8 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_namespace = XmlUtils::GetNamespace(oReader.GetName());
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
......
......@@ -80,22 +80,14 @@ namespace PPTX
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
{
pWriter->StartNode(_T("a:buAutoNum"));
pWriter->StartNode(L"a:buAutoNum");
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("type"), type.get());
pWriter->WriteAttribute(_T("startAt"), startAt);
pWriter->WriteAttribute(L"type", type.get());
pWriter->WriteAttribute(L"startAt", startAt);
pWriter->EndAttributes();
pWriter->EndNode(_T("a:buAutoNum"));
pWriter->EndNode(L"a:buAutoNum");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
......@@ -79,18 +79,14 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node)
{
blip = node.ReadNodeNoNS(_T("blip"));
}
virtual std::wstring toXML() const
{
return XmlUtils::CreateNode(_T("a:buBlip"), blip.toXML());
blip = node.ReadNodeNoNS(L"blip");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:buBlip"));
pWriter->StartNode(L"a:buBlip");
pWriter->EndAttributes();
blip.toXmlWriter(pWriter);
pWriter->EndNode(_T("a:buBlip"));
pWriter->EndNode(L"a:buBlip");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
......@@ -88,17 +88,12 @@ namespace PPTX
{
Color.GetColorFrom(node);
}
virtual std::wstring toXML() const
{
return XmlUtils::CreateNode(_T("a:buClr"), Color.toXML());
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:buClr"));
pWriter->StartNode(L"a:buClr");
pWriter->EndAttributes();
Color.toXmlWriter(pWriter);
pWriter->EndNode(_T("a:buClr"));
pWriter->EndNode(L"a:buClr");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
......@@ -78,13 +78,9 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("<a:buClrTx/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->WriteString(_T("<a:buClrTx/>"));
pWriter->WriteString(L"<a:buClrTx/>");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
......@@ -79,13 +79,9 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("<a:buFontTx/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->WriteString(_T("<a:buFontTx/>"));
pWriter->WriteString(L"<a:buFontTx/>");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
......@@ -62,13 +62,9 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("<a:buNone/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->WriteString(_T("<a:buNone/>"));
pWriter->WriteString(L"<a:buNone/>");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
......@@ -64,27 +64,20 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("val"), val)
WritingElement_ReadAttributes_ReadSingle ( oReader, L"val", val)
WritingElement_ReadAttributes_End( oReader )
}
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
{
pWriter->StartNode(_T("a:buSzPts"));
pWriter->StartNode(L"a:buSzPts");
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("val"), val);
pWriter->WriteAttribute(L"val", val);
pWriter->EndAttributes();
pWriter->EndNode(_T("a:buSzPts"));
pWriter->EndNode(L"a:buSzPts");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
......@@ -62,13 +62,9 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("<a:buSzTx/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->WriteString(_T("<a:buSzTx/>"));
pWriter->WriteString(L"<a:buSzTx/>");
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
......
......@@ -34,8 +34,9 @@
#define PPTX_LOGIC_C_NV_PROPERTIES_INCLUDE_H_
#include "./../WrapperWritingElement.h"
#include "Hyperlink.h"
#include "Hyperlink.h"
#include "extp.h"
namespace PPTX
{
......@@ -81,11 +82,29 @@ namespace PPTX
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = oReader.GetName();
if (sName == L"a:hlinkClick")
std::wstring strName = XmlUtils::GetNameNoNS(oReader.GetName());
if (strName == L"hlinkClick")
hlinkClick = oReader;
else if (sName == L"a:hlinkHover")
else if (strName == L"hlinkHover")
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)
......@@ -102,6 +121,29 @@ namespace PPTX
hlinkClick = node.ReadNode(_T("a:hlinkClick"));
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();
}
......@@ -163,12 +205,13 @@ namespace PPTX
pWriter->StartAttributes();
pWriter->WriteAttribute (_T("id"), _id);
pWriter->WriteAttribute (_T("name"), XmlUtils::EncodeXmlString(name));
if (descr.IsInit())
{
std::wstring d = XmlUtils::EncodeXmlString(descr.get());
XmlUtils::replace_all(d, L"\n", L"&#xA;");
pWriter->WriteAttribute (_T("descr"), d);
}
if (descr.IsInit())
{
std::wstring d = XmlUtils::EncodeXmlString(descr.get());
XmlUtils::replace_all(d, L"\n", L"&#xA;");
pWriter->WriteAttribute (_T("descr"), d);
}
pWriter->WriteAttribute (_T("hidden"), hidden);
if (title.IsInit()) pWriter->WriteAttribute (_T("title"), XmlUtils::EncodeXmlString(title.get()));
......@@ -239,8 +282,29 @@ namespace PPTX
break;
}
}
// TODO: пока без гиперссылок
while (pReader->GetPos() < _end_rec)
{
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);
}
......@@ -254,6 +318,9 @@ namespace PPTX
nullable_string title;
nullable<Hyperlink> hlinkClick;
nullable<Hyperlink> hlinkHover;
//std::vector<Ext> extLst;
nullable_string oleSpid;
protected:
virtual void FillParentPointersForChilds()
{
......
......@@ -44,6 +44,7 @@ namespace PPTX
namespace Logic
{
class ClrMap;
class ColorBase : public WrapperWritingElement
{
public:
......@@ -102,7 +103,7 @@ namespace PPTX
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);
}
......
......@@ -119,7 +119,7 @@ namespace PPTX
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;
......@@ -128,9 +128,6 @@ namespace PPTX
RGB = ARGB;
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 (oClrMap.is_init())
......
......@@ -91,7 +91,7 @@ namespace PPTX
virtual DWORD GetBGRA(DWORD BGRA) 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
{
......
......@@ -63,15 +63,6 @@ namespace PPTX
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()
{
......
......@@ -66,8 +66,6 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual void fromXML(XmlUtils::CXmlNode& node);
virtual std::wstring toXML() const;
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:effectStyle"));
......
......@@ -35,35 +35,37 @@
#include "./../WrapperWritingElement.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/RId.h"
//<p:ext uri="{DAA4B4D4-6D71-4841-9C94-3DE7FCFB9230}">
//<p14:media xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" r:embed="rId2">
//<p14:trim st="93333.0816" end="96583.4816"/>
//</p14:media>
//</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 Logic
......@@ -79,6 +81,8 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if ( oReader.IsEmptyNode() )
return;
......@@ -89,8 +93,7 @@ namespace PPTX
if (strName == L"media")
{
ReadAttributes(oReader);
//std::wstring xmkl = media.GetXml();
ReadAttributes1(oReader);
int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
......@@ -99,35 +102,61 @@ namespace PPTX
if (strName1 == L"trim")
{
ReadAttributes(oReader);
ReadAttributes2(oReader);
}
}
}
else if (strName == L"compatExt")
{
ReadAttributes3(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_Read_if ( oReader, _T("st"), st)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("end"), end)
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("r:embed"), link)
WritingElement_ReadAttributes_End( oReader )
}
virtual void fromXML(XmlUtils::CXmlNode& node)
void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader)
{
XmlUtils::CXmlNode media;
if (node.GetNode(_T("p14:media"), media))
WritingElement_ReadAttributes_Start( oReader )
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;
if (media.GetNode(_T("p14:trim"), trim))
XmlUtils::CXmlNode trim = media.ReadNodeNoNS(_T("trim"));
if (trim.IsValid())
{
trim.ReadAttributeBase(_T("st"), st);
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
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
link.toPPTY(0, pWriter);
if (link.IsInit())
link->toPPTY(0, pWriter);
pWriter->WriteDouble2(1, st);
pWriter->WriteDouble2(2, end);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
OOX::RId link;
// trim
//-------------------------------------------------------
nullable_string uri;
//media
nullable<OOX::RId> link;
nullable_double st;
nullable_double end;
//compatExt
nullable_string spid;
//dataModelExt
//table
//sparklineGroups
protected:
virtual void FillParentPointersForChilds()
{
......
......@@ -143,22 +143,18 @@ namespace PPTX
}
std::wstring Blip::GetFullOleName(const OOX::RId& oRId, FileContainer* pRels)const
{
if (pRels != NULL)
{
smart_ptr<OOX::OleObject> p = pRels->GetOleObject(oRId);
if (p.is_init())
return p->filename().m_strFilename;
}
if(parentFileIs<Slide>())
return parentFileAs<Slide>().GetOleFromRId(oRId);
else if(parentFileIs<SlideLayout>())
return parentFileAs<SlideLayout>().GetOleFromRId(oRId);
else if(parentFileIs<SlideMaster>())
return parentFileAs<SlideMaster>().GetOleFromRId(oRId);
else if(parentFileIs<Theme>())
return parentFileAs<Theme>().GetOleFromRId(oRId);
return _T("");
smart_ptr<OOX::OleObject> pOleObject;
if (pRels != NULL) pOleObject = pRels->GetOleObject(oRId);
else if(parentFileIs<Slide>()) pOleObject = parentFileAs<Slide>().GetOleObject(oRId);
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 (pOleObject.IsInit())
return pOleObject->filename().m_strFilename;
return L"";
}
} // namespace Logic
} // namespace PPTX
\ No newline at end of file
......@@ -62,11 +62,9 @@ namespace PPTX
embed = oSrc.embed;
link = oSrc.link;
m_namespace = oSrc.m_namespace;
oleRid = oSrc.oleRid;
oleFilepathBin = oSrc.oleFilepathBin;
oleFilepathImg = oSrc.oleFilepathImg;
oleRidImg = oSrc.oleRidImg;
m_namespace = oSrc.m_namespace;
oleRid = oSrc.oleRid;
oleFilepathBin = oSrc.oleFilepathBin;
return *this;
}
......@@ -115,15 +113,6 @@ namespace PPTX
pWriter->WriteLimit2(0, cstate);
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())
pWriter->WriteString1(10, embed->get());
if (link.is_init())
......@@ -161,7 +150,17 @@ namespace PPTX
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();
pWriter->StartRecord(3);
......@@ -172,23 +171,20 @@ namespace PPTX
pWriter->EndRecord();
}
public:
virtual std::wstring GetFullPicName(FileContainer* pRels = NULL)const;
virtual std::wstring GetFullOleName(const OOX::RId& pRId, FileContainer* pRels = NULL)const;
public:
std::vector<UniEffect> Effects;
nullable_limit<Limit::BlipCompression> cstate;
nullable<OOX::RId> embed;
nullable<OOX::RId> link;
public:
std::wstring m_namespace;
std::wstring oleRid;
std::wstring oleFilepathBin;
std::wstring oleFilepathImg;
std::wstring oleRidImg;
nullable<OOX::RId> embed;
nullable<OOX::RId> link;
std::wstring m_namespace;
std::wstring oleRid;
//internal
std::wstring oleFilepathBin;
std::wstring oleFilepathImage;
protected:
virtual void FillParentPointersForChilds();
};
......
......@@ -333,21 +333,23 @@ namespace PPTX
pReader->Skip(6); // len + start attributes + type
// -------------------
std::wstring strUrl = pReader->GetString2();
std::wstring strOrigBase64 = _T("");
std::wstring strImagePath = pReader->GetString2();
std::wstring strOrigBase64;
std::wstring strTempFile ;
std::wstring strTempFile = _T("");
bool bIsUrl = false;
if (0 == strUrl.find(_T("data:")))
if (0 == strImagePath.find(_T("data:")))
{
bool bBase64 = false;
strOrigBase64 = strUrl;
int nFind = (int)strUrl.find(_T(","));
strOrigBase64 = strImagePath;
int nFind = (int)strImagePath.find(_T(","));
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"));
if (nFind1 >=0 ) bBase64 = true;
......@@ -361,9 +363,9 @@ namespace PPTX
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();
BYTE* pDstBuffer = NULL;
int dstLen = 0;
......@@ -397,7 +399,7 @@ namespace PPTX
oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen);
oTempFile.CloseFile();
strUrl = strTempFile =pathTemp.GetPath(); // strTempFile для удаления
strImagePath = strTempFile =pathTemp.GetPath(); // strTempFile для удаления
if (bBase64)
{
RELEASEARRAYOBJECTS(pDstBuffer);
......@@ -405,18 +407,18 @@ namespace PPTX
}
else
{
if (0 != strUrl.find(_T("http:")) &&
0 != strUrl.find(_T("https:")) &&
0 != strUrl.find(_T("ftp:")) &&
0 != strUrl.find(_T("file:")))
if (0 != strImagePath.find(_T("http:")) &&
0 != strImagePath.find(_T("https:")) &&
0 != strImagePath.find(_T("ftp:")) &&
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
{
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
......@@ -426,11 +428,11 @@ namespace PPTX
//в случае url не надо нормализовать путь
if(!bIsUrl)
{
OOX::CPath pathUrl = strUrl;
strUrl = pathUrl.GetPath();
OOX::CPath pathUrl = strImagePath;
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(""))
......@@ -442,14 +444,13 @@ namespace PPTX
if (!blip.is_init())
blip = new PPTX::Logic::Blip();
blip->embed = new OOX::RId((size_t)oRelsGeneratorInfo.m_nImageRId);
if(oRelsGeneratorInfo.m_nOleRId > 0)
blip->embed = new OOX::RId((size_t)oRelsGeneratorInfo.nImageRId);
blip->oleFilepathImage = oRelsGeneratorInfo.sFilepathImage;
if(oRelsGeneratorInfo.nOleRId > 0)
{
blip->oleRid = OOX::RId((size_t)oRelsGeneratorInfo.m_nOleRId).get();
blip->oleFilepathBin = oRelsGeneratorInfo.m_sFilepathBin;
blip->oleFilepathImg = oRelsGeneratorInfo.m_sFilepathImg;
blip->oleRidImg = blip->embed->get();
blip->oleRid = OOX::RId((size_t)oRelsGeneratorInfo.nOleRId).get();
blip->oleFilepathBin = oRelsGeneratorInfo.sFilepathOle;
}
pReader->Skip(1); // end attribute
......@@ -494,8 +495,9 @@ namespace PPTX
pReader->Seek(_e);
}
mutable std::wstring m_namespace;
public:
nullable<Blip> blip;
nullable<Rect> srcRect;
nullable<Tile> tile;
......@@ -504,9 +506,9 @@ namespace PPTX
nullable_int dpi;
nullable_bool rotWithShape;
mutable std::wstring m_namespace;
//internal
std::wstring oleData;
//internal
smart_ptr<OOX::OleObject> oleFile;
std::wstring oleData;
protected:
virtual void FillParentPointersForChilds()
{
......
......@@ -61,6 +61,9 @@ namespace PPTX
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
......
......@@ -79,13 +79,6 @@ namespace PPTX
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
{
......
......@@ -378,8 +378,7 @@ namespace PPTX
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 const T& as() const { return m_geometry.as<T>(); }
//public:
private:
smart_ptr<WrapperWritingElement> m_geometry;
protected:
virtual void FillParentPointersForChilds(){};
......
......@@ -87,10 +87,32 @@ namespace PPTX
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)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), spid )
WritingElement_ReadAttributes_ReadSingle ( oReader, _T("spid"), oleSpid )
WritingElement_ReadAttributes_End( oReader )
}
void GraphicFrame::fromXML2(XmlUtils::CXmlLiteReader& oReader)
......@@ -135,7 +157,10 @@ namespace PPTX
else if (strName == L"oleObj")
{
ReadAttributes3(oReader);
ReadAttributes2(oReader);
if ( oReader.IsEmptyNode() )
continue;
int nCurDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth1 ) )
......@@ -144,11 +169,12 @@ namespace PPTX
if (strName1 == L"pic")
{
result = true;
pic = oReader;
//pic->fromXMLOle(oNode2);
if (!olePic.IsInit()) //создается уровнем выше
olePic.Init();
olePic->fromXML(oReader);
if (xfrm.IsInit())
xfrm->Merge(pic->spPr.xfrm);
xfrm->Merge(olePic->spPr.xfrm);
}
}
}
......@@ -169,6 +195,9 @@ namespace PPTX
}
else if (strName == L"AlternateContent")
{
if ( oReader.IsEmptyNode() )
continue;
int nCurDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth1 ) )
{
......@@ -197,7 +226,64 @@ namespace PPTX
}
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)
{
m_namespace = XmlUtils::GetNamespace(node.GetName());
......@@ -223,70 +309,7 @@ namespace PPTX
XmlUtils::CXmlNode oNodeData;
if (oNode.GetNode(L"a:graphicData", oNodeData))
{
XmlUtils::CXmlNode oNode1 = oNodeData.ReadNodeNoNS(L"tbl");
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);
}
fromXML3(oNodeData);
}
}
}
......@@ -338,23 +361,23 @@ namespace PPTX
void GraphicFrame::toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
if (pic.is_init())
if (olePic.is_init())
{
pic->toPPTY(pWriter);
olePic->toPPTY(pWriter);
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;
std::wstring xml_object_vml;
std::wstring xml_object_rels;
if (spid.is_init())
if (oleSpid.is_init())
{
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);
......@@ -437,7 +460,7 @@ namespace PPTX
pWriter->StartRecord(SPTREE_TYPE_GRFRAME);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString2(0, spid);
pWriter->WriteString2(0, oleSpid);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecord1(0, nvGraphicFramePr);
......@@ -470,7 +493,7 @@ namespace PPTX
{
case 0:
{
spid = pReader->GetString2();
oleSpid = pReader->GetString2();
break;
}
default:
......@@ -584,8 +607,8 @@ namespace PPTX
smartArt->SetParentPointer(this);
if (chartRec.is_init())
chartRec->SetParentPointer(this);
if (pic.is_init())
pic->SetParentPointer(this);
if (olePic.is_init())
olePic->SetParentPointer(this);
}
std::wstring GraphicFrame::GetVmlXmlBySpid(std::wstring & rels)const
{
......@@ -593,17 +616,17 @@ namespace PPTX
rels = L"";
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();
}
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();
}
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();
}
......
......@@ -63,10 +63,12 @@ namespace PPTX
const GraphicFrame& operator =(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlNode& node);
bool fromXML3(XmlUtils::CXmlNode& node);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
void fromXML2(XmlUtils::CXmlLiteReader& oReader);
bool fromXML3(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes2(XmlUtils::CXmlLiteReader& oReader);
void ReadAttributes3(XmlUtils::CXmlLiteReader& oReader);
virtual std::wstring toXML() const;
......@@ -86,11 +88,12 @@ namespace PPTX
nullable<Xfrm> xfrm;
nullable_string spid;
nullable_string oleSpid;
nullable<Pic> olePic;
nullable<Table> table;
nullable<SmartArt> smartArt;
nullable<ChartRec> chartRec;
nullable<Pic> pic;
nullable<SpTreeElem> element;
std::wstring GetVmlXmlBySpid(std::wstring & rels) const;
......
......@@ -46,7 +46,11 @@ namespace PPTX
{
public:
WritingElement_AdditionConstructors(Hyperlink)
PPTX_LOGIC_BASE2(Hyperlink)
Hyperlink(std::wstring name = L"hlinkClick")
{
m_name = name;
}
virtual OOX::EElementType getType () const
{
......@@ -54,6 +58,8 @@ namespace PPTX
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_name = XmlUtils::GetNameNoNS(oReader.GetName());
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
......@@ -100,23 +106,6 @@ namespace PPTX
node.ReadAttributeBase(L"highlightClick", highlightClick);
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
{
......@@ -225,35 +214,38 @@ namespace PPTX
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("a:") + m_name);
pWriter->StartNode(L"a:" + m_name);
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("r:id"), id);
pWriter->WriteAttribute2(_T("invalidUrl"), invalidUrl);
pWriter->WriteAttribute2(_T("action"), action);
pWriter->WriteAttribute2(_T("tgtFrame"), tgtFrame);
pWriter->WriteAttribute2(_T("tooltip"), tooltip);
pWriter->WriteAttribute(_T("history"), history);
pWriter->WriteAttribute(_T("highlightClick"), highlightClick);
pWriter->WriteAttribute(_T("endSnd"), endSnd);
pWriter->WriteAttribute (L"r:id", id);
pWriter->WriteAttribute2(L"invalidUrl", invalidUrl);
pWriter->WriteAttribute2(L"action", action);
pWriter->WriteAttribute2(L"tgtFrame", tgtFrame);
if (tooltip.IsInit())
pWriter->WriteAttribute(L"tooltip", XmlUtils::EncodeXmlString(*tooltip));
pWriter->WriteAttribute(L"history", history);
pWriter->WriteAttribute(L"highlightClick", highlightClick);
pWriter->WriteAttribute(L"endSnd", endSnd);
pWriter->EndAttributes();
pWriter->Write(snd);
pWriter->EndNode(_T("a:") + m_name);
pWriter->EndNode(L"a:" + m_name);
}
public:
nullable<WavAudioFile> snd;
nullable_string id;//<OOX::RId> id;// <xsd:attribute ref="r:id" use="optional"/>
nullable_string invalidUrl;//default=""
nullable_string action;//default=""
nullable_string tgtFrame;//default=""
nullable_string tooltip;//default=""
nullable_bool history;//default="true"
nullable_bool highlightClick;//default="false"
nullable_bool endSnd;//default="false"
nullable_string id; //<OOX::RId> id;// <xsd:attribute ref="r:id" use="optional"/>
nullable_string invalidUrl; //default=""
nullable_string action; //default=""
nullable_string tgtFrame; //default=""
nullable_string tooltip; //default=""
nullable_bool history; //default="true"
nullable_bool highlightClick; //default="false"
nullable_bool endSnd; //default="false"
//private:
public:
std::wstring m_name;
......
......@@ -165,7 +165,7 @@ namespace PPTX
pWriter->Write(ph);
media.toXmlWriter(pWriter);
pWriter->WriteArray(_T("p:extLst"), extLst);
pWriter->WriteArray(strNS + _T(":extLst"), extLst);
pWriter->EndNode(strNS + _T(":nvPr"));
}
......
......@@ -177,15 +177,6 @@ namespace PPTX
{
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
{
......
......@@ -82,17 +82,6 @@ namespace PPTX
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
{
pWriter->StartNode(_T("a:arcTo"));
......
......@@ -64,11 +64,6 @@ namespace PPTX
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("<a:close/>");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->WriteString(_T("<a:close/>"));
......
......@@ -115,14 +115,6 @@ namespace PPTX
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("y"), y )
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
{
......
......@@ -92,12 +92,6 @@ namespace PPTX
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
{
pWriter->StartNode(_T("a:lnTo"));
......
......@@ -92,11 +92,6 @@ namespace PPTX
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
{
pWriter->StartNode(_T("a:moveTo"));
......
......@@ -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
{
pWriter->StartNode(_T("a:quadBezTo"));
......
This diff is collapsed.
This diff is collapsed.
......@@ -77,13 +77,6 @@ namespace PPTX
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
{
......
......@@ -137,26 +137,6 @@ namespace PPTX
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
{
pWriter->StartNode(_T("a:fld"));
......
This diff is collapsed.
This diff is collapsed.
......@@ -192,7 +192,7 @@ namespace PPTX
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
{
......
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