Files
core/ASCOfficeOdtFile/Source/DocxFormat/Core.cpp
Elen.Subbotina 6138139c4e исправлен проект - подключен "старый" DocxFormat (тот который с AVS - без вытирания буста)
git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53593 954022d7-b5bf-4e40-9824-e11837661b57
2016-05-20 22:37:54 +03:00

86 lines
2.2 KiB
C++

// auto inserted precompiled begin
#include "precompiled_docxformat.h"
// auto inserted precompiled end
#include "Core.h"
#include "FileTypes.h"
namespace OOX
{
Core::Core()
{
}
Core::Core(const boost::filesystem::wpath& filename)
{
read(filename);
}
Core::~Core()
{
}
void Core::read(const boost::filesystem::wpath& filename)
{
const XML::XDocument document(filename);
m_title = document.Root.element("title").text();
m_subject = document.Root.element("subject").text();
m_creator = document.Root.element("creator").text();
m_keywords = document.Root.element("keywords").text();
m_description = document.Root.element("description").text();
m_lastModifiedBy = document.Root.element("lastModifiedBy").text();
m_revision = 1;
}
void Core::write(const boost::filesystem::wpath& filename, const boost::filesystem::wpath& directory, ContentTypes::File& content) const
{
XML::XElement(ns.cp + "coreProperties",
XML::XElement(ns.dc + "title", XML::XText(m_title)) +
XML::XElement(ns.dc + "subject", XML::XText(m_subject)) +
XML::XElement(ns.dc + "creator", XML::XText(m_creator)) +
XML::XElement(ns.cp + "keywords", XML::XText(m_keywords)) +
XML::XElement(ns.dc + "description", XML::XText(m_description)) +
XML::XElement(ns.cp + "lastModifiedBy", XML::XText(m_lastModifiedBy)) +
XML::XElement(ns.cp + "revision", XML::XText(m_revision)) +
XML::WriteIf(XML::XElement(ns.dcterms + "created",
XML::XAttribute(ns.xsi + "type", "dcterms:W3CDTF") +
XML::XText(m_created)),
m_created.is_init()
) +
XML::WriteIf(XML::XElement(ns.dcterms + "modified",
XML::XAttribute(ns.xsi + "type", "dcterms:W3CDTF") +
XML::XText(m_modified)),
m_modified.is_init()
)
).Save(filename);
content.registration(type().OverrideType(), directory, filename);
}
const FileType Core::type() const
{
return FileTypes::Core;
}
const boost::filesystem::wpath Core::DefaultDirectory() const
{
return type().DefaultDirectory();
}
const boost::filesystem::wpath Core::DefaultFileName() const
{
return type().DefaultFileName();
}
} // namespace OOX