init repo

This commit is contained in:
nikolay ivanov
2014-07-05 18:22:49 +00:00
commit a8be6b9e72
17348 changed files with 9229832 additions and 0 deletions

View File

@@ -0,0 +1,98 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_CONTENT_TYPES_DEFAULT_INCLUDE_H_
#define OOX_CONTENT_TYPES_DEFAULT_INCLUDE_H_
#include "./../WritingElement.h"
#include "ExtensionTable.h"
namespace OOX
{
namespace ContentTypes
{
class Default : public WritingElement
{
public:
Default()
{
m_extension = _T("");
}
Default(const CString& extension) : m_extension(extension)
{
}
virtual ~Default()
{
}
explicit Default(XmlUtils::CXmlNode& node)
{
fromXML(node);
}
const Default& operator =(XmlUtils::CXmlNode& node)
{
fromXML(node);
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_extension = node.GetAttribute(_T("Extension"));
}
virtual CString toXML() const
{
static const ExtensionTable table;
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("Extension"), m_extension);
oAttr.Write(_T("ContentType"), table[m_extension]);
return XmlUtils::CreateNode(_T("Default"), oAttr);
}
virtual EElementType getType() const
{
return et_Default;
}
public:
const bool operator ==(const CString& rhs) const
{
return m_extension == rhs;
}
private:
CString m_extension;
};
}
}
#endif // OOX_CONTENT_TYPES_DEFAULT_INCLUDE_H_

View File

@@ -0,0 +1,94 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_CONTENT_TYPES_DEFAULT_TABLE_INCLUDE_H_
#define OOX_CONTENT_TYPES_DEFAULT_TABLE_INCLUDE_H_
#include "./../WritingVector.h"
#include "Default.h"
namespace OOX
{
namespace ContentTypes
{
class DefaultTable : public WritingVector<Default>
{
public:
DefaultTable()
{
m_items.Add(Default(_T("rels")));
m_items.Add(Default(_T("xml")));
}
virtual ~DefaultTable()
{
}
explicit DefaultTable(XmlUtils::CXmlNode& node)
{
fromXML(node);
}
const DefaultTable& operator =(XmlUtils::CXmlNode& node)
{
fromXML(node);
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.LoadArray(_T("Default"), m_items);
}
public:
void add(const OOX::CPath& path)
{
CString ext = path.GetExtention();
const CString extension = ext.Mid(1);
size_t nCount = m_items.GetCount();
size_t nIndex = 0;
while (nIndex < nCount)
{
if (m_items[nIndex] == extension)
break;
++nIndex;
}
if (nIndex == nCount)
m_items.Add(Default(extension));
}
};
}
}
#endif // OOX_CONTENT)TYPES_DEFAULT_TABLE_INCLUDE_H_

View File

@@ -0,0 +1,92 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_CONTENT_TYPES_EXTENSION_TABLE_INCLUDE_H_
#define OOX_CONTENT_TYPES_EXTENSION_TABLE_INCLUDE_H_
#include "../../../../Common/DocxFormat/Source/Base/Base.h"
namespace OOX
{
namespace ContentTypes
{
class ExtensionTable
{
public:
ExtensionTable()
{
m_table.SetAt(_T("gif"), _T("image/gif"));
m_table.SetAt(_T("png"), _T("image/png"));
m_table.SetAt(_T("tif"), _T("image/tiff"));
m_table.SetAt(_T("tiff"), _T("image/tiff"));
m_table.SetAt(_T("jpeg"), _T("image/jpeg"));
m_table.SetAt(_T("jpg"), _T("image/jpeg"));
m_table.SetAt(_T("jpe"), _T("image/jpeg"));
m_table.SetAt(_T("jfif"), _T("image/jpeg"));
m_table.SetAt(_T("rels"), _T("application/vnd.openxmlformats-package.relationships+xml"));
m_table.SetAt(_T("bin"), _T("application/vnd.openxmlformats-officedocument.oleObject"));
m_table.SetAt(_T("xml"), _T("application/xml"));
m_table.SetAt(_T("emf"), _T("image/x-emf"));
m_table.SetAt(_T("emz"), _T("image/x-emz"));
m_table.SetAt(_T("wmf"), _T("image/x-wmf"));
m_table.SetAt(_T("svm"), _T("image/svm"));
m_table.SetAt(_T("wav"), _T("audio/wav"));
m_table.SetAt(_T("xls"), _T("application/vnd.ms-excel"));
m_table.SetAt(_T("xlsm"), _T("application/vnd.ms-excel.sheet.macroEnabled.12"));
m_table.SetAt(_T("xlsb"), _T("application/vnd.ms-excel.sheet.binary.macroEnabled.12"));
m_table.SetAt(_T("xlsx"), _T("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
m_table.SetAt(_T("ppt"), _T("application/vnd.ms-powerpoint"));
m_table.SetAt(_T("pptm"), _T("application/vnd.ms-powerpoint.presentation.macroEnabled.12"));
m_table.SetAt(_T("pptx"), _T("application/vnd.openxmlformats-officedocument.presentationml.presentation"));
m_table.SetAt(_T("sldm"), _T("application/vnd.ms-powerpoint.slide.macroEnabled.12"));
m_table.SetAt(_T("sldx"), _T("application/vnd.openxmlformats-officedocument.presentationml.slide"));
m_table.SetAt(_T("doc"), _T("application/msword"));
m_table.SetAt(_T("docm"), _T("aapplication/vnd.ms-word.document.macroEnabled.12"));
m_table.SetAt(_T("docx"), _T("application/vnd.openxmlformats-officedocument.wordprocessingml.document"));
m_table.SetAt(_T("vml"), _T("application/vnd.openxmlformats-officedocument.vmlDrawing"));
}
const CString operator[] (const CString& extension) const
{
const CAtlMap<CString, CString>::CPair* pPair = m_table.Lookup(extension);
if (NULL == pPair)
return _T("");
return pPair->m_value;
}
private:
CAtlMap<CString, CString> m_table;
};
}
}
#endif // OOX_CONTENT_TYPES_EXTENSION_TABLE_INCLUDE_H_

View File

@@ -0,0 +1,104 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_CONTENT_TYPES_FILE_INCLUDE_H_
#define OOX_CONTENT_TYPES_FILE_INCLUDE_H_
#include "OverrideTable.h"
#include "DefaultTable.h"
#include "./../FileType.h"
namespace OOX
{
namespace ContentTypes
{
static const CPath s_filename = L"[Content_Types].xml";
class File
{
public:
File()
{
}
File(const CPath& path)
{
read(path);
}
virtual ~File()
{
}
public:
virtual void read(const CPath& path)
{
OOX::CPath oPath = path / s_filename;
XmlUtils::CXmlNode oNode;
if (oNode.FromXmlFile(oPath.m_strFilename))
{
Default = oNode;
Override = oNode;
}
}
virtual void write(const CPath& path) const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("xmlns"), _T("http://schemas.openxmlformats.org/package/2006/content-types"));
XmlUtils::CNodeValue oValue;
oValue.Write(Default);
oValue.Write(Override);
OOX::CPath savepath = path / s_filename;
XmlUtils::SaveToFile(savepath.m_strFilename, XmlUtils::CreateNode(_T("Types"), oAttr, oValue));
}
virtual const bool isValid() const
{
return true;
}
public:
void registration(const CString& type, const CPath& directory, const CPath& filename)
{
Override.add(type, directory / filename.m_strFilename);
Default.add(directory / filename.m_strFilename);
}
public:
OverrideTable Override;
DefaultTable Default;
};
}
}
#endif // DOCX_CONTENT_TYPES_FILE_INCLUDE_H_

View File

@@ -0,0 +1,101 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_CONTENT_TYPES_OVERRIDE_INCLUDE_H_
#define OOX_CONTENT_TYPES_OVERRIDE_INCLUDE_H_
#include "./../WritingElement.h"
#include "../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
namespace OOX
{
namespace ContentTypes
{
class Override : public WritingElement
{
public:
Override()
{
}
Override(const CString& type, const CPath& path) : m_type(type), m_part(path)
{
}
virtual ~Override()
{
}
explicit Override(XmlUtils::CXmlNode& node)
{
fromXML(node);
}
const Override& operator =(XmlUtils::CXmlNode& node)
{
fromXML(node);
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_part = node.GetAttribute(_T("PartName"));
m_type = node.GetAttribute(_T("ContentType"));
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("PartName"), _T("/") + m_part.m_strFilename);
oAttr.Write(_T("ContentType"), m_type);
return XmlUtils::CreateNode(_T("Override"), oAttr);
}
virtual EElementType getType() const
{
return et_Override;
}
public:
AVSINLINE const CString type() const
{
return m_type;
}
AVSINLINE const OOX::CPath filename() const
{
return m_part;
}
private:
CString m_type;
OOX::CPath m_part;
};
}
}
#endif // OOX_CONTENT_TYPES_OVERRIDE_INCLUDE_H_

View File

@@ -0,0 +1,77 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_CONTENT_TYPES_OVERRIDE_TABLE_INCLUDE_H_
#define OOX_CONTENT_TYPES_OVERRIDE_TABLE_INCLUDE_H_
#include "./../WritingVector.h"
#include "Override.h"
namespace OOX
{
namespace ContentTypes
{
class OverrideTable : public WritingVector<Override>
{
public:
OverrideTable()
{
}
virtual ~OverrideTable()
{
}
explicit OverrideTable(XmlUtils::CXmlNode& node)
{
fromXML(node);
}
const OverrideTable& operator =(XmlUtils::CXmlNode& node)
{
fromXML(node);
return *this;
}
public:
void fromXML(XmlUtils::CXmlNode& node)
{
node.LoadArray(_T("Override"), m_items);
}
public:
void add(const CString& type, const OOX::CPath& path)
{
m_items.Add(Override(type, path));
}
};
}
}
#endif // OOX_CONTENT_TYPES_OVERRIDE_TABLE_INCLUDE_H_

View File

@@ -0,0 +1,82 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_DATE_TIME_INCLUDE_H_
#define OOX_DATE_TIME_INCLUDE_H_
#include "../../../Common/DocxFormat/Source/Utility/Utility.h"
namespace OOX
{
class DateTime
{
public:
DateTime()
{
}
explicit DateTime(const CString& value) : m_datetime(value, s_pattern)
{
}
explicit DateTime(const ::DateTime& dt) : m_datetime(dt)
{
}
public:
CString ToString() const
{
return m_datetime.ToString(s_pattern);
}
static DateTime Parse(const CString& value)
{
return DateTime(value);
}
public:
::DateTime& datetime()
{
return m_datetime;
}
const ::DateTime& datetime() const
{
return m_datetime;
}
private:
static const CString s_pattern;
::DateTime m_datetime;
};
const CString DateTime::s_pattern = _T("%YYYY-%MM-%DDT%hh:%mm:%ssZ");
}
#endif // OOX_DATE_TIME_INCLUDE_H_

View File

@@ -0,0 +1,76 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_EXTERNAL_INCLUDE_H_
#define OOX_EXTERNAL_INCLUDE_H_
#include "../File.h"
#include "../FileTypes.h"
namespace OOX
{
class External : public File
{
public:
External()
{
}
External(const CPath& uri)
{
read(uri);
}
~External()
{
}
public:
virtual void read(const CPath& uri)
{
m_uri = uri;
}
virtual void write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const
{
}
public:
AVSINLINE CPath Uri() const
{
return m_uri;
}
protected:
CPath m_uri;
};
}
#endif // OOX_EXTERNAL_INCLUDE_H_

View File

@@ -0,0 +1,71 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_EXTERNALAUDIO_INCLUDE_H_
#define OOX_EXTERNALAUDIO_INCLUDE_H_
#include "External.h"
namespace OOX
{
class ExternalAudio : public External
{
public:
ExternalAudio()
{
}
ExternalAudio(const CPath& uri)
{
read(uri);
}
~ExternalAudio()
{
}
public:
virtual const FileType type() const
{
return FileTypes::ExternalAudio;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
}
#endif // OOX_EXTERNALAUDIO_INCLUDE_H_

View File

@@ -0,0 +1,71 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_EXTERNALIMAGE_INCLUDE_H_
#define OOX_EXTERNALIMAGE_INCLUDE_H_
#include "External.h"
namespace OOX
{
class ExternalImage : public External
{
public:
ExternalImage()
{
}
ExternalImage(const CPath& uri)
{
read(uri);
}
~ExternalImage()
{
}
public:
virtual const FileType type() const
{
return FileTypes::ExternalImage;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
}
#endif // OOX_EXTERNALIMAGE_INCLUDE_H_

View File

@@ -0,0 +1,71 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_EXTERNALVIDEO_INCLUDE_H_
#define OOX_EXTERNALVIDEO_INCLUDE_H_
#include "External.h"
namespace OOX
{
class ExternalVideo : public External
{
public:
ExternalVideo()
{
}
ExternalVideo(const CPath& uri)
{
read(uri);
}
~ExternalVideo()
{
}
public:
virtual const FileType type() const
{
return FileTypes::ExternalVideo;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
}
#endif // OOX_EXTERNALVIDEO_INCLUDE_H_

View File

@@ -0,0 +1,71 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_HYPERLINK_INCLUDE_H_
#define OOX_HYPERLINK_INCLUDE_H_
#include "External.h"
namespace OOX
{
class HyperLink : public External
{
public:
HyperLink()
{
}
HyperLink(const CPath& uri)
{
read(uri);
}
~HyperLink()
{
}
public:
virtual const FileType type() const
{
return FileTypes::HyperLink;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
}
#endif // OOX_HYPERLINK_INCLUDE_H_

View File

@@ -0,0 +1,61 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_FILE_INCLUDE_H_
#define OOX_FILE_INCLUDE_H_
#include "../../../Common/DocxFormat/Source/XML/XmlSimple.h"
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "FileType.h"
#include "ContentTypes/File.h"
namespace OOX
{
class File
{
public:
File(){}
virtual ~File(){}
public:
virtual void read(const CPath& filename) = 0;
virtual void write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const = 0;
public:
virtual const OOX::FileType type() const = 0;
virtual const CPath DefaultDirectory() const = 0;
virtual const CPath DefaultFileName() const = 0;
};
}
#endif // OOX_FILE_INCLUDE_H_

View File

@@ -0,0 +1,106 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_FILE_TYPE_INCLUDE_H_
#define OOX_FILE_TYPE_INCLUDE_H_
#include "../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
namespace OOX
{
class FileType
{
public:
FileType(const CPath& defaultDirectory, const CPath& defaultFileName,
const CString& overrideType,
const CString& relationType) : m_defaultDirectory(defaultDirectory),
m_defaultFileName(defaultFileName),
m_overrideType(overrideType),
m_relationType(relationType)
{
}
FileType(const WCHAR* defaultDirectory, const WCHAR* defaultFileName,
const CString& overrideType,
const CString& relationType) : m_defaultDirectory(defaultDirectory, false),
m_defaultFileName(defaultFileName, false),
m_overrideType(overrideType),
m_relationType(relationType)
{
}
~FileType()
{
}
public:
const bool operator ==(const FileType& rhs) const
{
return (m_relationType == rhs.m_relationType);
}
public:
inline const CString OverrideType() const
{
return m_overrideType;
}
inline const CString RelationType() const
{
return m_relationType;
}
inline const CPath DefaultDirectory() const
{
return m_defaultDirectory;
}
inline const CPath DefaultFileName() const
{
return m_defaultFileName;
}
private:
CString m_overrideType;
CString m_relationType;
CPath m_defaultDirectory;
CPath m_defaultFileName;
};
static const bool operator ==(const CString& type, const FileType& file)
{
return (type == file.RelationType());
}
static const bool operator ==(const FileType& file, const CString& type)
{
return (file.RelationType() == type);
}
}
#endif // OOX_FILE_TYPE_INCLUDE_H_

View File

@@ -0,0 +1,284 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_FILE_TYPES_INCLUDE_H_
#define OOX_FILE_TYPES_INCLUDE_H_
#include "FileType.h"
namespace OOX
{
namespace FileTypes
{
const FileType App(L"docProps", L"app.xml",
_T("application/vnd.openxmlformats-officedocument.extended-properties+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"));
const FileType Core(L"docProps", L"core.xml",
_T("application/vnd.openxmlformats-package.core-properties+xml"),
_T("http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"));
const FileType Document(L"word", L"document.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType Theme(L"theme", L"theme.xml",
_T("application/vnd.openxmlformats-officedocument.theme+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"));
const FileType Setting(L"", L"settings.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"));
const FileType FontTable(L"", L"fontTable.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"));
const FileType Style(L"", L"styles.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"));
const FileType Item(L"customXml", L"item.xml",
_T("WARNING not implement"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"));
const FileType FootNote(L"", L"footnotes.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"));
const FileType EndNote(L"", L"endnotes.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"));
const FileType WebSetting(L"", L"webSettings.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"));
const FileType Header(L"", L"header.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"));
const FileType Footer(L"", L"footer.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"));
const FileType Numbering(L"", L"numbering.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"));
const FileType CustomXml(L"customXml", L"itemProps.xml",
_T("application/vnd.openxmlformats-officedocument.customXmlProperties+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"));
const FileType HyperLink(L"", L"",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"));
const FileType ExternalImage(L"", L"",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"));
const FileType ExternalAudio(L"", L"",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"));
const FileType ExternalVideo(L"", L"",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"));
const FileType Image(L"media", L"image",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"));
const FileType Audio(L"media", L"audio",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"));
const FileType Video(L"media", L"video",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"));
const FileType Data(L"diagrams", L"data.xml",
_T("application/vnd.openxmlformats-officedocument.drawingml.diagramData+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData"));
const FileType DrawingDiag(L"diagrams", L"drawing.xml",
_T("application/vnd.openxmlformats-officedocument.drawingml.diagramDrawing+xml"),
_T("http://schemas.microsoft.com/office/2007/relationships/diagramDrawing"));
const FileType Layout(L"diagrams", L"layout.xml",
_T("application/vnd.openxmlformats-officedocument.drawingml.diagramLayout+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout"));
const FileType Colors(L"diagrams", L"colors.xml",
_T("application/vnd.openxmlformats-officedocument.drawingml.diagramColors+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors"));
const FileType QuickStyle(L"diagrams", L"quickStyle.xml",
_T("application/vnd.openxmlformats-officedocument.drawingml.diagramStyle+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle"));
const FileType Chart(L"charts", L"chart.xml",
_T("application/vnd.openxmlformats-officedocument.drawingml.chart+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"));
const FileType MicrosoftOfficeExcelWorksheet(L"embeddings", L"Microsoft_Office_Excel_Worksheet.xlsx",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
const FileType MicrosoftOfficeExcel_97_2003_Worksheet(L"embeddings", L"Microsoft_Office_Excel_97-2003_Worksheet.xls",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"));
const FileType MicrosoftOfficeExcelBinaryWorksheet(L"embeddings", L"Microsoft_Office_Excel_Binary_Worksheet.xlsb",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
const FileType MicrosoftOfficeExcelMacro_EnabledWorksheet(L"embeddings", L"Microsoft_Office_Excel_Macro-Enabled_Worksheet.xlsm",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
const FileType MicrosoftOfficeExcelChart(L"embeddings", L"Microsoft_Office_Excel_Chart.xlsx",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"));
const FileType MicrosoftOfficeWordDocument(L"embeddings", L"Microsoft_Office_Word_Document.docx",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
const FileType MicrosoftOfficeWord_97_2003_Document(L"embeddings", L"Microsoft_Office_Word_97_-_2003_Document.doc",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"));
const FileType MicrosoftOfficeWordMacro_EnabledDocument(L"embeddings", L"Microsoft_Office_Word_Macro-Enabled_Document.docm",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
const FileType MicrosoftOfficePowerPointPresentation(L"embeddings", L"Microsoft_Office_PowerPoint_Presentation.pptx",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
const FileType MicrosoftOfficePowerPoint_97_2003_Presentation(L"embeddings", L"Microsoft_Office_PowerPoint_97-2003_Presentation.xlsx",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"));
const FileType MicrosoftOfficePowerPointMacro_EnabledPresentation(L"embeddings", L"Microsoft_Office_PowerPoint_Macro-Enabled_Presentation.pptm",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
const FileType MicrosoftOfficePowerPointSlide(L"embeddings", L"Microsoft_Office_PowerPoint_Slide.sldx",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
const FileType MicrosoftOfficePowerPointMacro_EnabledSlide(L"embeddings", L"Microsoft_Office_PowerPoint_Macro-Enabled_Slide.sldm",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));
const FileType OleObject(L"embeddings", L"oleObject.bin",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"));
const FileType Glossary(L"glossary", L"document.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"));
const FileType Slide(L"ppt/slides", L"slide.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.slide+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"));
const FileType SlideLayout(L"ppt/slideLayouts", L"slideLayout.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"));
const FileType SlideComments(L"ppt/comments", L"comment.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.comment+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"));
const FileType CommentAuthors(L"ppt", L"commentAuthors.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.commentAuthors.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"));
const FileType SlideMaster(L"ppt/slideMasters", L"slideMaster.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"));
const FileType NotesSlide(L"ppt/notesSlides", L"notesSlide.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"));
const FileType NotesMaster(L"ppt/notesMasters", L"notesMaster.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"));
const FileType HandoutMaster(L"ppt/handoutMasters", L"handoutMaster.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.handoutMaster+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/handoutMaster"));
const FileType Presentation(L"ppt", L"presentation.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"));
const FileType PresProps(L"ppt", L"presProps.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"));
const FileType TableStyles(L"ppt", L"tableStyles.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles"));
const FileType ViewProps(L"ppt", L"viewProps.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps"));
const FileType ThemePPTX(L"ppt/theme", L"theme.xml",
_T("application/vnd.openxmlformats-officedocument.theme+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"));
const FileType VmlDrawing(L"ppt", L"vmlDrawing.vml",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"));
const FileType Media(L"ppt/media", L"", _T(""), _T("http://schemas.microsoft.com/office/2007/relationships/media"));
const FileType Unknow(L"", L"", _T(""), _T(""));
}
}
#endif // OOX_FILE_TYPES_INCLUDE_H_

View File

@@ -0,0 +1,53 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_FILE_BUILDER_INCLUDE_H_
#define OOX_FILE_BUILDER_INCLUDE_H_
#include "ContentTypes/File.h"
namespace OOX
{
class IFileBuilder
{
public:
IFileBuilder();
virtual ~IFileBuilder();
public:
virtual void Commit(const CPath& path) = 0;
virtual void Finalize(const CPath& path, const CPath& directory, ContentTypes::File& content) = 0;
};
}
#endif // OOX_FILE_BUILDER_INCLUDE_H_

View File

@@ -0,0 +1,365 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "./stdafx.h"
#include "IFileContainer.h"
#include "Rels/File.h"
#ifndef NODOCX
#endif
#include "ContentTypes/File.h"
#include "FileType.h"
#include "External\External.h"
#include "External\HyperLink.h"
#include "Media\Image.h"
#include "Media\OleObject.h"
#include "FileTypes.h"
namespace OOX
{
UnknowTypeFile IFileContainer::unknow;
void IFileContainer::read(const CPath& filename)
{
OOX::Rels::File rels(filename);
read(rels, filename.GetDirectory());
}
void IFileContainer::read(const Rels::File& rels, const CPath& path)
{
#ifndef NODOCX
size_t nCount = rels.Relations.m_items.GetCount();
for (size_t i = 0; i < nCount; ++i)
{
add(rels.Relations.m_items[i].rId(), OOX::CreateFile(path, rels.Relations.m_items[i]));
}
#endif
}
void IFileContainer::write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const
{
OOX::Rels::File rels;
CPath current = filename.GetDirectory();
write(rels, current, directory, content);
rels.write(filename);
}
void IFileContainer::write(Rels::File& rels, const CPath& curdir, const CPath& directory, ContentTypes::File& content) const
{
CAtlMap<CString, size_t> namepair;
POSITION pos = m_container.GetStartPosition();
while (NULL != pos)
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.GetNext(pos);
smart_ptr<OOX::File> pFile = pPair->m_value;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
if (!pExt.IsInit())
{
OOX::CPath defdir = pFile->DefaultDirectory();
OOX::CPath name = pFile->DefaultFileName();
CAtlMap<CString, size_t>::CPair* pNamePair = namepair.Lookup(name.m_strFilename);
if (NULL == pNamePair)
namepair.SetAt(name.m_strFilename, 1);
else
name = name + pNamePair->m_key;
OOX::CSystemUtility::CreateDirectories(curdir / defdir);
pFile->write(curdir / defdir / name, directory / defdir, content);
rels.registration(pPair->m_key, pFile->type(), defdir / name);
}
else
{
rels.registration(pPair->m_key, pExt);
}
}
}
void IFileContainer::Commit(const CPath& path)
{
CAtlMap<CString, size_t> namepair;
POSITION pos = m_container.GetStartPosition();
while (NULL != pos)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.GetNext(pos);
smart_ptr<OOX::File> pFile = pPair->m_value;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
if (!pExt.IsInit())
{
OOX::CPath defdir = pFile->DefaultDirectory();
OOX::CPath name = pFile->DefaultFileName();
CAtlMap<CString, size_t>::CPair* pNamePair = namepair.Lookup(name.m_strFilename);
if (NULL == pNamePair)
namepair.SetAt(name.m_strFilename, 1);
else
name = name + pNamePair->m_key;
OOX::CSystemUtility::CreateDirectories(path / defdir);
smart_ptr<OOX::IFileBuilder> fileBuilder = pPair->m_value.smart_dynamic_cast<OOX::IFileBuilder>();
if (fileBuilder.is_init())
fileBuilder->Commit(path / defdir / name);
}
}
}
void IFileContainer::Finalize(const CPath& filename, const CPath& directory, ContentTypes::File& content)
{
OOX::Rels::File rels;
CPath current = filename.GetDirectory();
Finalize(rels, current, directory, content);
rels.write(filename);
}
void IFileContainer::Finalize(Rels::File& rels, const OOX::CPath& curdir, const OOX::CPath& directory, ContentTypes::File& content)
{
CAtlMap<CString, size_t> namepair;
POSITION pos = m_container.GetStartPosition();
while (NULL != pos)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.GetNext(pos);
smart_ptr<OOX::File> pFile = pPair->m_value;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
if (!pExt.IsInit())
{
OOX::CPath defdir = pFile->DefaultDirectory();
OOX::CPath name = pFile->DefaultFileName();
CAtlMap<CString, size_t>::CPair* pNamePair = namepair.Lookup(name.m_strFilename);
if (NULL == pNamePair)
namepair.SetAt(name.m_strFilename, 1);
else
name = name + pNamePair->m_key;
OOX::CSystemUtility::CreateDirectories(curdir / defdir);
smart_ptr<OOX::IFileBuilder> fileBuilder = pFile.smart_dynamic_cast<OOX::IFileBuilder>();
if ( fileBuilder.is_init() )
{
fileBuilder->Finalize(curdir / defdir / name, directory / defdir, content);
}
else
{
pFile->write(curdir / defdir / name, directory / defdir, content);
}
rels.registration(pPair->m_key, pFile->type(), defdir / name);
}
else
{
rels.registration(pPair->m_key, pExt);
}
}
}
void IFileContainer::extractPictures(const OOX::CPath& path) const
{
POSITION pos = m_container.GetStartPosition();
while (NULL != pos)
{
smart_ptr<OOX::File> pFile = m_container.GetNextValue(pos);
smart_ptr<Image> pImage = pFile.smart_dynamic_cast<Image>();
if (pImage.is_init())
{
pImage->copy_to(path);
continue;
}
smart_ptr<IFileContainer> pExt = pFile.smart_dynamic_cast<IFileContainer>();
if (pExt.is_init())
{
pExt->extractPictures(path);
continue;
}
}
}
smart_ptr<Image> IFileContainer::image(const RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.Lookup(rId.get());
if (NULL == pPair)
return smart_ptr<Image>();
return pPair->m_value.smart_dynamic_cast<Image>();
}
smart_ptr<HyperLink> IFileContainer::hyperlink(const RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.Lookup(rId.get());
if (NULL == pPair)
return smart_ptr<HyperLink>();
return pPair->m_value.smart_dynamic_cast<HyperLink>();
}
smart_ptr<OleObject> IFileContainer::oleObject(const RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.Lookup(rId.get());
if (NULL == pPair)
return smart_ptr<OleObject>();
return pPair->m_value.smart_dynamic_cast<OleObject>();
}
const bool IFileContainer::exist(const FileType& type) const
{
POSITION pos = m_container.GetStartPosition();
while (NULL != pos)
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.GetNext(pos);
if (type == pPair->m_value->type())
return true;
}
return false;
}
const bool IFileContainer::exist(const RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.Lookup(rId.get());
return (NULL != pPair);
}
const bool IFileContainer::isExternal(const OOX::RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.Lookup(rId.get());
if (NULL != pPair)
{
CString type = pPair->m_value->type().RelationType();
CString name = pPair->m_value->type().DefaultFileName().m_strFilename;
return (((type == OOX::FileTypes::ExternalAudio.RelationType()) || (type == OOX::FileTypes::ExternalImage.RelationType())
|| (type == OOX::FileTypes::ExternalVideo.RelationType())) && (name == _T("")));
}
return true;
}
smart_ptr<OOX::File> IFileContainer::get(const FileType& type)
{
POSITION pos = m_container.GetStartPosition();
while (NULL != pos)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.GetNext(pos);
if (type == pPair->m_value->type())
return pPair->m_value;
}
return smart_ptr<OOX::File>(new UnknowTypeFile(unknow));
}
const RId IFileContainer::add(const smart_ptr<OOX::File>& file)
{
const RId rId = maxRId().next();
add(rId, file);
return rId;
}
void IFileContainer::add(const OOX::RId rId, const smart_ptr<OOX::File>& file)
{
m_container.SetAt(rId.get(), file);
}
smart_ptr<OOX::File> IFileContainer::find(const FileType& type) const
{
POSITION pos = m_container.GetStartPosition();
while (NULL != pos)
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.GetNext(pos);
if (type == pPair->m_value->type())
return pPair->m_value;
}
return smart_ptr<OOX::File>((OOX::File*)new UnknowTypeFile());
}
smart_ptr<OOX::File> IFileContainer::find(const OOX::RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.Lookup(rId.get());
if (NULL != pPair)
return pPair->m_value;
smart_ptr<OOX::File> pointer;
return pointer;
}
smart_ptr<OOX::File> IFileContainer::operator [](const OOX::RId rId)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.Lookup(rId.get());
if (NULL != pPair)
return pPair->m_value;
smart_ptr<OOX::File> pointer;
return pointer;
}
smart_ptr<OOX::File> IFileContainer::operator [](const FileType& type)
{
return find(type);
}
const RId IFileContainer::maxRId()
{
++m_lMaxRid;
return RId(m_lMaxRid);
}
} // namespace OOX

View File

@@ -0,0 +1,129 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_IFILE_CONTAINER_INCLUDE_H_
#define OOX_IFILE_CONTAINER_INCLUDE_H_
#include "RId.h"
#include "UnknowTypeFile.h"
#include "IFileBuilder.h"
namespace OOX {class File;}
namespace OOX {class FileType;}
namespace OOX {namespace Rels {class File;}}
namespace OOX {namespace ContentTypes {class File;}}
namespace OOX {class Image;}
namespace OOX {class HyperLink;}
namespace OOX {class OleObject;}
namespace OOX
{
class IFileContainer
{
public:
IFileContainer()
{
m_lMaxRid = 0;
}
virtual ~IFileContainer()
{
}
protected:
CAtlMap<CString, smart_ptr<OOX::File>> m_container;
size_t m_lMaxRid;
protected:
void read(const OOX::CPath& filename);
void read(const Rels::File& rels, const CPath& path);
void write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const;
void write(Rels::File& rels, const CPath& current, const CPath& directory, ContentTypes::File& content) const;
protected:
void Commit(const CPath& path);
void Finalize(const CPath& filename, const CPath& directory, ContentTypes::File& content);
void Finalize(Rels::File& rels, const CPath& current, const CPath& directory, ContentTypes::File& content);
public:
void extractPictures(const CPath& path) const;
public:
virtual smart_ptr<Image> image(const RId& rId) const;
virtual smart_ptr<HyperLink> hyperlink(const RId& rId) const;
virtual smart_ptr<OleObject> oleObject(const RId& rId) const;
public:
template<typename T> const bool exist() const;
const bool exist(const FileType& type) const;
const bool exist(const OOX::RId& rId) const;
const bool isExternal(const OOX::RId& rId) const;
smart_ptr<OOX::File> get(const FileType& type);
const RId add(const smart_ptr<OOX::File>& file);
void add(const OOX::RId rId, const smart_ptr<OOX::File>& file);
smart_ptr<OOX::File> find(const FileType& type) const;
smart_ptr<OOX::File> find(const OOX::RId& type) const;
smart_ptr<OOX::File> operator [](const OOX::RId rId);
smart_ptr<OOX::File> operator [](const FileType& type);
template<typename T> T& find();
protected:
static UnknowTypeFile unknow;
private:
const RId maxRId();
};
template<typename T>
const bool IFileContainer::exist() const
{
T file;
return exist(file.type());
}
template<typename T>
T& IFileContainer::find()
{
T file;
return dynamic_cast<T&>(find(file.type()));
}
}
#endif // OOX_IFILE_CONTAINER_INCLUDE_H_

View File

@@ -0,0 +1,70 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_AUDIO_INCLUDE_H_
#define OOX_AUDIO_INCLUDE_H_
#include "Media.h"
namespace OOX
{
class Audio : public Media
{
public:
Audio()
{
}
Audio(const CPath& filename)
{
read(filename);
}
virtual ~Audio()
{
}
public:
virtual const FileType type() const
{
return FileTypes::Audio;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return m_filename.GetFilename();
}
};
}
#endif // OOX_AUDIO_INCLUDE_H_

View File

@@ -0,0 +1,99 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_IMAGE_INCLUDE_H_
#define OOX_IMAGE_INCLUDE_H_
#include "Media.h"
namespace OOX
{
class Image : public Media
{
public:
Image()
{
}
Image(const CPath& filename)
{
read(filename);
}
virtual ~Image()
{
}
public:
virtual void write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const
{
CString newFilename = filename.GetFilename();
CPath newFilePath = filename.GetDirectory();
newFilename.Replace((TCHAR)' ', (TCHAR)'_');
if (CSystemUtility::IsFileExist(m_filename) && !CSystemUtility::IsFileExist(newFilePath/newFilename))
{
}
}
public:
virtual const FileType type() const
{
return FileTypes::Image;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return m_filename.GetFilename();
}
};
}
#endif // OOX_IMAGE_INCLUDE_H_

View File

@@ -0,0 +1,103 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_MEDIA_INCLUDE_H_
#define OOX_MEDIA_INCLUDE_H_
#include "..\File.h"
#include "..\FileTypes.h"
#ifdef AVS_OFFICE_SVM_FILE
#include "OfficeSvmFile.h"
#include "SvmConverter.h"
#endif
namespace OOX
{
class Media : public File
{
public:
Media()
{
}
Media(const CPath& filename)
{
read(filename);
}
virtual ~Media()
{
}
public:
virtual void read(const CPath& filename)
{
m_filename = filename;
}
virtual void write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const
{
}
public:
const CPath filename() const
{
return m_filename;
}
void copy_to(const CPath& path) const
{
}
protected:
CPath m_filename;
};
}
#endif // OOX_MEDIA_INCLUDE_H_

View File

@@ -0,0 +1,84 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_OLE_OBJECT_INCLUDE_H_
#define OOX_OLE_OBJECT_INCLUDE_H_
#include "Media.h"
namespace OOX
{
class OleObject : public Media
{
public:
OleObject()
{
}
OleObject(const OOX::CPath& filename)
{
read(filename);
}
virtual ~OleObject()
{
}
public:
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, ContentTypes::File& content) const
{
}
public:
virtual const FileType type() const
{
return FileTypes::OleObject;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return m_filename.GetFilename();
}
};
}
#endif // OOX_OLE_OBJECT_INCLUDE_H_

View File

@@ -0,0 +1,71 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_VIDEO_INCLUDE_H_
#define OOX_VIDEO_INCLUDE_H_
#include "Media.h"
namespace OOX
{
class Video : public Media
{
public:
Video()
{
}
Video(const CPath& filename)
{
read(filename);
}
virtual ~Video()
{
}
public:
virtual const FileType type() const
{
return FileTypes::Video;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return m_filename.GetFilename();
}
};
}
#endif // OOX_VIDEO_INCLUDE_H_

View File

@@ -0,0 +1,50 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_NAMESPACE_OWN_INCLUDE_H_
#define OOX_NAMESPACE_OWN_INCLUDE_H_
#include "Namespaces.h"
namespace OOX
{
class NamespaceOwn
{
protected:
};
static Namespaces g_Namespaces;
}
#endif // OOX_NAMESPACE_OWN_INCLUDE_H_

View File

@@ -0,0 +1,134 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_NAMESPACES_INCLUDE_H_
#define OOX_NAMESPACES_INCLUDE_H_
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#include <atlstr.h>
namespace OOX
{
class Namespace
{
public:
CString m_strName;
CString m_strLink;
public:
Namespace(LPCSTR sName, LPCSTR sLink) : m_strName(sName), m_strLink(sLink)
{
}
Namespace(LPCWSTR sName, LPCWSTR sLink) : m_strName(sName), m_strLink(sLink)
{
}
};
class Namespaces
{
public:
Namespaces() : a("a", "http://schemas.openxmlformats.org/drawingml/2006/main"),
b("b", "http://schemas.openxmlformats.org/officeDocument/2006/bibliography"),
cdr("cdr", "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"),
cp("cp", "http://schemas.openxmlformats.org/package/2006/metadata/core-properties"),
dc("dc", "http://purl.org/dc/elements/1.1/"),
dchrt("dchrt", "http://schemas.openxmlformats.org/drawingml/2006/chart"),
dcmitype("dcmitype", "http://purl.org/dc/dcmitype/"),
dcterms("dcterms", "http://purl.org/dc/terms/"),
ddgrm("ddgrm", "http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dgm("dgm", "http://schemas.openxmlformats.org/drawingml/2006/diagram"),
dlckcnv("dlckcnv", "http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"),
dpct("dpct", "http://schemas.openxmlformats.org/drawingml/2006/picture"),
ds("ds", "http://schemas.openxmlformats.org/officeDocument/2006/customXml"),
m("m", "http://schemas.openxmlformats.org/officeDocument/2006/math"),
o("o", "urn:schemas-microsoft-com:office:office"),
p("p", "http://schemas.openxmlformats.org/presentationml/2006/main"),
pic("pic", "http://schemas.openxmlformats.org/drawingml/2006/picture"),
pvml("pvml", "urn:schemas-microsoft-com:office:powerpoint"),
r("r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships"),
s("s", "http://schemas.openxmlformats.org/officeDocument/2006/sharedTypes"),
sl("sl", "http://schemas.openxmlformats.org/schemaLibrary/2006/main"),
v("v", "urn:schemas-microsoft-com:vml"),
ve("ve", "http://schemas.openxmlformats.org/markup-compatibility/2006"),
vp("vp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
vt("vt", "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"),
w("w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main"),
w10("w10", "urn:schemas-microsoft-com:office:word"),
wne("wne", "http://schemas.microsoft.com/office/word/2006/wordml"),
wp("wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"),
x("x", "urn:schemas-microsoft-com:office:excel"),
xdr("xdr", "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"),
xmlns("xmlns", "http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"),
xsd("xsd", "http://www.w3.org/2001/XMLSchema"),
xsi("xsi", "http://www.w3.org/2001/XMLSchema-instance")
{
}
public:
const Namespace a;
const Namespace b;
const Namespace cdr;
const Namespace cp;
const Namespace dc;
const Namespace dchrt;
const Namespace dcmitype;
const Namespace dcterms;
const Namespace ddgrm;
const Namespace dgm;
const Namespace dlckcnv;
const Namespace dpct;
const Namespace ds;
const Namespace m;
const Namespace o;
const Namespace p;
const Namespace pic;
const Namespace pvml;
const Namespace r;
const Namespace s;
const Namespace sl;
const Namespace v;
const Namespace ve;
const Namespace vp;
const Namespace vt;
const Namespace w;
const Namespace w10;
const Namespace wne;
const Namespace wp;
const Namespace x;
const Namespace xdr;
const Namespace xmlns;
const Namespace xsd;
const Namespace xsi;
};
}
#endif // OOX_NAMESPACES_INCLUDE_H_

View File

@@ -0,0 +1,134 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_RID_INCLUDE_H_
#define OOX_RID_INCLUDE_H_
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#include "../../../Common/DocxFormat/Source/XML/XmlUtils.h"
namespace OOX
{
class RId
{
public:
RId() : m_id(_T("rId0"))
{
}
RId(const size_t id)
{
m_id = _T("rId") + XmlUtils::UIntToString(id);
}
RId(const CString& rid)
{
m_id = rid;
}
RId(const RId& oSrc)
{
m_id = oSrc.m_id;
}
public:
const RId& operator= (const size_t id)
{
m_id = _T("rId") + XmlUtils::UIntToString(id);
return *this;
}
const RId& operator= (const CString& rid)
{
m_id = rid;
return *this;
}
const RId& operator= (const BSTR& rid)
{
m_id = (CString)rid;
return *this;
}
const RId& operator= (const RId& oSrc)
{
m_id = oSrc.m_id;
return *this;
}
public:
const bool operator ==(const RId& lhs) const
{
return m_id == lhs.m_id;
}
const bool operator !=(const RId& lhs) const
{
return m_id != lhs.m_id;
}
const bool operator < (const RId& lhs) const
{
return m_id < lhs.m_id;
}
const bool operator <=(const RId& lhs) const
{
return m_id <= lhs.m_id;
}
const bool operator >(const RId& lhs) const
{
return m_id > lhs.m_id;
}
const bool operator >=(const RId& lhs) const
{
return m_id >= lhs.m_id;
}
AVSINLINE CString get() const { return m_id; }
public:
const RId next() const
{
return RId(m_id + _T("1"));
}
public:
const CString ToString() const
{
return m_id;
}
template<typename T>
void toPPTY(BYTE type, T pWriter) const
{
pWriter->WriteBYTE(type);
pWriter->WriteStringW(m_id);
}
private:
CString m_id;
};
}
#endif // OOX_RID_INCLUDE_H_

View File

@@ -0,0 +1,159 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_RELS_FILE_INCLUDE_H_
#define OOX_RELS_FILE_INCLUDE_H_
#include "RelationTable.h"
#include "./../FileType.h"
#include "./../FileTypes.h"
#include "./../RId.h"
#include "./../External/External.h"
#include "../../../../Common/DocxFormat/Source/Base/SmartPtr.h"
#include "../../../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
namespace OOX
{
namespace Rels
{
class File
{
public:
File()
{
}
File(const CPath& filename)
{
read(filename);
}
~File()
{
}
public:
void read(const CPath& filename)
{
CPath strFile = createFileName(filename);
if (CSystemUtility::IsFileExist(strFile))
{
XmlUtils::CXmlNode oNode;
if (oNode.FromXmlFile2(strFile.GetPath()))
Relations = oNode;
}
}
void read2(const CPath& filename)
{
CPath strFile = filename;
if (CSystemUtility::IsFileExist(strFile))
{
XmlUtils::CXmlNode oNode;
if (oNode.FromXmlFile2(strFile.GetPath()))
Relations = oNode;
}
}
void write(const CPath& filename) const
{
if (0 < Relations.m_items.GetCount())
{
CPath file = createFileName(filename);
CSystemUtility::CreateDirectories(file.GetDirectory());
XmlUtils::CXmlWriter oWriter;
oWriter.WriteNodeBegin(_T("Relationship"), TRUE);
oWriter.WriteAttribute(_T("xmlns"), _T("http://schemas.openxmlformats.org/package/2006/relationships"));
oWriter.WriteNodeEnd(_T("Relationship"), FALSE, TRUE);
oWriter.WriteString(Relations.toXML());
oWriter.WriteNodeEnd(_T("Relationship"));
CDirectory::SaveToFile(file.GetPath(), oWriter.GetXmlString());
}
}
const bool isValid() const
{
return true;
}
public:
void registration(const RId& rId, const FileType& type, const CPath& filename)
{
if(!(type == FileTypes::Unknow))
{
CString strFileName = filename.m_strFilename;
CString strDir = filename.GetDirectory() + _T("");
if (_T("") == filename.GetExtention())
{
if (type.RelationType() == "http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject")
{
strFileName += L".bin";
Relations.registration(rId, type.RelationType(), strDir + strFileName);
}
else if (type.RelationType() =="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image")
{
strFileName += L".wmf" ;
Relations.registration(rId, type.RelationType(), strDir + strFileName);
}
}
else
{
}
}
}
void registration(const RId& rId, const smart_ptr<External> external)
{
Relations.registration(rId, external);
}
private:
const CPath createFileName(const CPath& filename) const
{
CString strTemp = filename.GetDirectory() + _T("\\_rels\\");
if (filename.GetFilename() == _T(""))
strTemp += _T(".rels");
else
strTemp += (filename.GetFilename() + _T(".rels"));
return strTemp;
}
public:
RelationTable Relations;
};
}
}
#endif // OOX_RELS_FILE_INCLUDE_H_

View File

@@ -0,0 +1,127 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_RELS_RELATION_SHIP_INCLUDE_H_
#define OOX_RELS_RELATION_SHIP_INCLUDE_H_
#include "./../WritingElement.h"
#include "./../RId.h"
#include "./../External/External.h"
namespace OOX
{
namespace Rels
{
class RelationShip : public WritingElement
{
public:
RelationShip(const OOX::RId& rId, const CString& type, const OOX::CPath& filename) : m_rId(rId), m_target(filename), m_type(type)
{
m_target.m_strFilename.Replace(_T(" "), _T("_"));
}
RelationShip(const OOX::RId& rId, const smart_ptr<External> external): m_rId(rId), m_target(external->Uri()),
m_type(external->type().RelationType())
{
m_mode = new CString(_T("External"));
}
virtual ~RelationShip()
{
}
explicit RelationShip(XmlUtils::CXmlNode& node)
{
fromXML(node);
}
const RelationShip& operator =(XmlUtils::CXmlNode& node)
{
fromXML(node);
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_rId = node.GetAttribute(_T("Id"));
m_target = node.GetAttribute(_T("Target"));
m_type = node.GetAttribute(_T("Type"));
m_mode = node.GetAttribute(_T("TargetMode"), _T("Internal"));
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("Id"), m_rId.ToString());
oAttr.Write(_T("Type"), m_type);
oAttr.Write(_T("Target"), m_target.m_strFilename);
oAttr.Write(_T("TargetMode"), m_mode);
return XmlUtils::CreateNode(_T("Relationship"), oAttr);
}
public:
const bool operator <(const RelationShip& rhs) const
{
return m_rId < rhs.m_rId;
}
public:
const CString type() const
{
return m_type;
}
const CPath filename() const
{
return m_target;
}
const CPath target() const
{
return m_target;
}
const bool isExternal()const
{
if (!m_mode.IsInit())
return false;
return (*m_mode == "External");
}
const RId rId() const
{
return m_rId;
}
private:
RId m_rId;
CPath m_target;
CString m_type;
nullable_string m_mode;
};
}
}
#endif // OOX_RELS_RELATION_SHIP_INCLUDE_H_

View File

@@ -0,0 +1,78 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_RELS_RELATION_TABLE_INCLUDE_H_
#define OOX_RELS_RELATION_TABLE_INCLUDE_H_
#include "./../WritingVector.h"
#include "RelationShip.h"
#include "./../RId.h"
namespace OOX {class External;}
namespace OOX
{
namespace Rels
{
class RelationTable : public WritingVector<RelationShip>
{
public:
RelationTable()
{
}
virtual ~RelationTable()
{
}
explicit RelationTable(XmlUtils::CXmlNode& node)
{
fromXML(node);
}
const RelationTable& operator =(XmlUtils::CXmlNode& node)
{
fromXML(node);
return *this;
}
public:
void registration(const RId& rId, const CString& type, const CPath& filename)
{
m_items.Add(RelationShip(rId, type, filename));
}
void registration(const RId& rId, const smart_ptr<OOX::External> external)
{
m_items.Add(RelationShip(rId, external));
}
};
}
}
#endif // OOX_RELS_RELATION_TABLE_INCLUDE_H_

View File

@@ -0,0 +1,76 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_UNKNOW_TYPE_FILE_INCLUDE_H_
#define OOX_UNKNOW_TYPE_FILE_INCLUDE_H_
#include "File.h"
#include "FileTypes.h"
namespace OOX
{
class UnknowTypeFile : public File
{
public:
UnknowTypeFile()
{
}
virtual ~UnknowTypeFile()
{
}
public:
virtual void read(const CPath& filename)
{
}
virtual void write(const CPath& filename, const CPath& directory, ContentTypes::File& content) const
{
}
public:
virtual const FileType type() const
{
return FileTypes::Unknow;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
};
}
#endif // OOX_UNKNOW_TYPE_FILE_INCLUDE_H_

View File

@@ -0,0 +1,214 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#include "NamespaceOwn.h"
#include "../../../Common/DocxFormat/Source/XML/XmlUtils.h"
#include "atlstr.h"
namespace OOX
{
#define WritingElement_AdditionConstructors(Class) \
Class(XmlUtils::CXmlNode& oNode)\
{\
fromXML( oNode );\
}\
const Class& operator =(const XmlUtils::CXmlNode &oNode)\
{\
fromXML( (XmlUtils::CXmlNode &)oNode );\
return *this;\
}
#define WritingElement_ReadNode( oRootNode, oChildNode, sNodeName, oValue ) \
if ( oRootNode.GetNode( sNodeName, oChildNode ) )\
oValue = oChildNode;
#define WritingElement_WriteNode_1( sStartNodeString, oValue ) \
if ( oValue.IsInit() )\
{\
sResult += sStartNodeString;\
sResult += oValue->ToString();\
sResult += _T("/>");\
}
#define WritingElement_WriteNode_2( oValue ) \
if ( oValue.IsInit() )\
sResult += oValue->toXML();
enum EElementType
{
et_Unknown,
et_Default,
et_Override,
et_a_graphic,
et_ds_schemaRef,
et_ds_schemaRefs,
et_p_pic,
et_w_abstractNum,
et_w_annotationRef,
et_w_background,
et_w_bdo,
et_w_bookmarkEnd,
et_w_bookmarkStart,
et_w_br,
et_w_checkBox,
et_w_cols,
et_w_comboBox,
et_w_commentRangeEnd,
et_w_commentRangeStart,
et_w_commentReference,
et_w_contentPart,
et_w_continuationSeparator,
et_w_customXmlDelRangeEnd,
et_w_customXmlDelRangeStart,
et_w_customXmlInsRangeEnd,
et_w_customXmlInsRangeStart,
et_w_customXmlMoveFromRangeEnd,
et_w_customXmlMoveFromRangeStart,
et_w_customXmlMoveToRangeEnd,
et_w_customXmlMoveToRangeStart,
et_w_cr,
et_w_date,
et_w_dayLong,
et_w_dayShort,
et_w_ddList,
et_w_delInstrText,
et_w_delText,
et_w_docDefaults,
et_w_docPartList,
et_w_dropDownList,
et_w_endnote,
et_w_endnotePr,
et_w_endnoteRef,
et_w_endnoteReference,
et_w_ffData,
et_w_fldChar,
et_w_fldSimple,
et_w_font,
et_w_footnote,
et_w_footnotePr,
et_w_footnoteRef,
et_w_footnoteReference,
et_w_ftr,
et_w_hdr,
et_w_headers,
et_w_hyperlink,
et_w_instrText,
et_w_latentStyles,
et_w_lastRenderedPageBreak,
et_w_lvl,
et_w_lvlOverride,
et_w_monthLong,
et_w_monthShort,
et_w_moveFromRangeEnd,
et_w_moveFromRangeStart,
et_w_moveToRangeEnd,
et_w_moveToRangeStart,
et_w_num,
et_w_numPr,
et_w_nonBreakHyphen,
et_w_object,
et_w_p,
et_w_pBdr,
et_w_permEnd,
et_w_permStart,
et_w_pgBorders,
et_w_pgNum,
et_w_placeholder,
et_w_pPr,
et_w_pPrChange,
et_w_proofErr,
et_w_ptab,
et_w_r,
et_w_ruby,
et_w_rPr,
et_w_rPrChange,
et_w_sdt,
et_w_sdtContent,
et_w_sdtEndPr,
et_w_sdtPr,
et_w_sectPr,
et_w_sectPrChange,
et_w_separator,
et_w_softHyphen,
et_w_style,
et_w_sym,
et_w_t,
et_w_tab,
et_w_tabs,
et_w_tbl,
et_w_tblBorders,
et_w_tblCellMar,
et_w_tblGrid,
et_w_tblGridChange,
et_w_tblPr,
et_w_tblPrChange,
et_w_tblPrEx,
et_w_tblPrExChange,
et_w_tblStylePr,
et_w_tc,
et_w_tcBorders,
et_w_tcMar,
et_w_tcPr,
et_w_tcPrChange,
et_w_textInput,
et_w_tr,
et_w_trPr,
et_w_trPrChange,
et_w_yearLong,
et_w_yearShort,
et_wp_docPr,
et_wp_effectExtent,
et_wp_extent,
et_wp_wrapPolygon,
};
class WritingElement
{
public:
WritingElement(){}
virtual ~WritingElement() {}
virtual void fromXML(XmlUtils::CXmlNode& node) = 0;
virtual CString toXML() const = 0;
virtual EElementType getType() const
{
return OOX::et_Unknown;
}
};
}

View File

@@ -0,0 +1,97 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_WRITING_VECTOR_INCLUDE_H_
#define OOX_WRITING_VECTOR_INCLUDE_H_
#include "WritingElement.h"
namespace OOX
{
template <typename T>
class WritingVector : public WritingElement
{
public:
CAtlArray<T> m_items;
public:
WritingVector() : m_items() {}
virtual ~WritingVector() {}
explicit WritingVector(XmlUtils::CXmlNode& node)
{
fromXML(node);
}
WritingVector& operator =(XmlUtils::CXmlNode& node)
{
fromXML(node);
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode nodeTemp;
oNodes.GetAt(i, nodeTemp);
m_items.Add(T(nodeTemp));
}
}
}
virtual CString toXML() const
{
CString strResult = _T("");
size_t nCount = m_items.GetCount();
for (size_t i = 0; i < nCount; ++i)
{
strResult += m_items[i].toXML();
}
return strResult;
}
virtual EElementType getType() const
{
return et_Unknown;
}
};
}
#endif // OOX_WRITING_VECTOR_INCLUDE_H_