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,96 @@
/*
* (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
#pragma warning( disable : 4996 )
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE 1
#endif
#ifndef _CRT_NONSTDC_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE 1
#endif
#ifndef STRICT
#define STRICT
#endif
#ifndef WINVER
#define WINVER 0x0501
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500
#endif
#ifndef _WIN32_WINDOWS
#define _WIN32_WINDOWS 0x0410
#endif
#ifndef _WIN32_IE
#define _WIN32_IE 0x0400
#endif
#ifndef _ATL_APARTMENT_THREADED
#define _ATL_APARTMENT_THREADED
#endif
#ifndef _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS
#endif
#ifndef _ATL_ALL_WARNINGS
#define _ATL_ALL_WARNINGS
#endif
#include <windows.h>
#include <atlbase.h>
#include <atlcoll.h>
#include <atlstr.h>
#include <atltypes.h>
#include "..\..\..\ASCUtils.h"
using namespace ATL;
#ifndef AVSINLINE
#if defined(_MSC_VER)
#define AVSINLINE __forceinline
#else
#define AVSINLINE inline
#endif
#endif

View File

@@ -0,0 +1,642 @@
/*
* (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 "SmartPtr.h"
#include "../XML/XmlUtils.h"
namespace NSCommon
{
template<typename Type>
class nullable_base
{
protected:
Type* m_pPointer;
public:
nullable_base()
{
m_pPointer = NULL;
}
nullable_base(const nullable_base<Type>& oOther)
{
m_pPointer = NULL;
if ( NULL != oOther.m_pPointer )
m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) );
}
virtual ~nullable_base()
{
RELEASEOBJECT(m_pPointer);
}
public:
AVSINLINE Type& operator*() { return *m_pPointer; }
AVSINLINE Type* operator->() { return m_pPointer; }
AVSINLINE Type& operator*() const { return *m_pPointer; }
AVSINLINE Type* operator->() const { return m_pPointer; }
AVSINLINE const Type& get()const { return *m_pPointer; }
AVSINLINE Type& get() { return *m_pPointer; }
public:
nullable_base<Type>& operator=(const nullable_base<Type> &oOther)
{
RELEASEOBJECT(m_pPointer);
if ( NULL != oOther.m_pPointer )
m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) );
return *this;
}
nullable_base<Type>& operator=(Type* pType)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = pType;
return *this;
}
nullable_base<Type>& operator=(const Type& oSrc)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new Type(oSrc);
return *this;
}
public:
AVSINLINE bool IsInit() const
{
return (NULL != m_pPointer);
}
AVSINLINE bool is_init() const
{
return IsInit();
}
AVSINLINE void reset(Type* pType = NULL)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = pType;
}
};
template<typename Type>
class nullable : public nullable_base<Type>
{
public:
nullable() : nullable_base<Type>()
{
}
nullable(const nullable<Type>& oOther)
{
if ( NULL == oOther.m_pPointer )
m_pPointer = NULL;
else
m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) );
}
AVSINLINE void operator=(XmlUtils::CXmlNode& oNode)
{
RELEASEOBJECT(m_pPointer);
if (oNode.IsValid())
m_pPointer = new Type(oNode);
}
#ifdef _USE_XMLLITE_READER_
AVSINLINE void operator=(XmlUtils::CXmlLiteReader& oReader)
{
RELEASEOBJECT(m_pPointer);
if (oReader.IsValid())
m_pPointer = new Type(oReader);
}
#endif
AVSINLINE void operator=(const wchar_t* &cwsValue)
{
RELEASEOBJECT(m_pPointer);
if (NULL != cwsValue)
m_pPointer = new Type( cwsValue );
}
AVSINLINE void operator=(const BSTR &value)
{
RELEASEOBJECT(m_pPointer);
if (NULL != value)
m_pPointer = new Type( value );
}
nullable<Type>& operator=(const nullable<Type> &oOther)
{
RELEASEOBJECT(m_pPointer);
if ( NULL != oOther.m_pPointer )
m_pPointer = new Type( (const Type&)*(oOther.m_pPointer) );
return *this;
}
nullable<Type>& operator=(Type* pType)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = pType;
return *this;
}
nullable<Type>& operator=(const Type& oSrc)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new Type(oSrc);
return *this;
}
const bool operator==(const nullable<Type>& oOther) const
{
if ( !m_pPointer && !oOther.m_pPointer )
return true;
else if ( !m_pPointer || !oOther.m_pPointer )
return false;
return (*m_pPointer) == (*(oOther.m_pPointer));
}
const bool operator==(const Type& oOther) const
{
if ( !m_pPointer )
return false;
return (*m_pPointer) == oOther;
}
AVSINLINE Type& operator*() { return *m_pPointer; }
AVSINLINE Type* operator->() { return m_pPointer; }
AVSINLINE Type& operator*() const { return *m_pPointer; }
AVSINLINE Type* operator->() const { return m_pPointer; }
AVSINLINE const Type& get()const { return *m_pPointer; }
AVSINLINE Type& get2()const { return *m_pPointer; }
template<class T> const bool is()const
{
if (NULL == m_pPointer)
return false;
T* pResult = dynamic_cast<T*>(const_cast<Type*>(m_pPointer));
return (NULL != pResult);
}
template<class T> const T& as()const
{
T* pResult = dynamic_cast<T*>(const_cast<Type*>(m_pPointer));
return *pResult;
}
template<class T> T& as()
{
T* pResult = dynamic_cast<T*>(const_cast<Type*>(m_pPointer));
return *pResult;
}
AVSINLINE bool Init()
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new Type;
return IsInit();
}
Type* GetPointer()
{
return m_pPointer;
}
Type* GetPointerEmptyNullable()
{
Type* pOldPointer = m_pPointer;
m_pPointer = NULL;
return pOldPointer;
}
};
template<typename Type>
class nullable_limit : public nullable_base<Type>
{
public:
nullable_limit() : nullable_base<Type>()
{
}
public:
AVSINLINE void operator=(const CString& value)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new Type();
m_pPointer->_set(value);
}
AVSINLINE void operator=(Type* pType)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = pType;
}
AVSINLINE void operator=(const BSTR& value)
{
RELEASEOBJECT(m_pPointer);
if (NULL != value)
{
m_pPointer = new Type();
m_pPointer->_set((CString)value);
}
}
AVSINLINE void operator=(const BYTE& value)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new Type();
m_pPointer->SetBYTECode(value);
}
AVSINLINE void operator=(const Type& value)
{
*this = value.get();
}
nullable_limit<Type>& operator=(const nullable_limit<Type>& oSrc)
{
RELEASEOBJECT(m_pPointer);
if ( NULL != oSrc.m_pPointer )
{
m_pPointer = new Type();
m_pPointer->set(oSrc->get());
}
return *this;
}
AVSINLINE const CString& get_value_or(const CString& value) const
{
if (NULL == m_pPointer)
return value;
return m_pPointer->get();
}
AVSINLINE const CString& get_value() const
{
return m_pPointer->get();
}
public:
AVSINLINE Type& operator*() { return *m_pPointer; }
AVSINLINE Type* operator->() { return m_pPointer; }
AVSINLINE Type& operator*() const { return *m_pPointer; }
AVSINLINE Type* operator->() const { return m_pPointer; }
AVSINLINE const Type& get()const { return *m_pPointer; }
};
class nullable_int : public nullable_base<int>
{
public:
nullable_int() : nullable_base<int>()
{
}
AVSINLINE void normalize(const int& min, const int& max)
{
if (IsInit())
{
if (*m_pPointer < min)
*m_pPointer = min;
else if (*m_pPointer > max)
*m_pPointer = max;
}
}
AVSINLINE void normalize_positive()
{
if (IsInit())
{
if (*m_pPointer < 0)
*m_pPointer = 0;
}
}
AVSINLINE void operator=(const BSTR& value)
{
RELEASEOBJECT(m_pPointer);
if (NULL != value)
m_pPointer = new int(XmlUtils::GetInteger(value));
}
AVSINLINE void operator=(const CString& value)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new int(XmlUtils::GetInteger(value));
}
AVSINLINE void operator=(const int& value)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new int(value);
}
nullable_int& operator=(const nullable_int& oSrc)
{
RELEASEOBJECT(m_pPointer);
if (NULL != oSrc.m_pPointer )
m_pPointer = new int(*oSrc);
return *this;
}
AVSINLINE int get_value_or(const int& value) const
{
if (NULL == m_pPointer)
{
int ret = value;
return ret;
}
return *m_pPointer;
}
public:
AVSINLINE int& operator*() { return *m_pPointer; }
AVSINLINE int* operator->() { return m_pPointer; }
AVSINLINE int& operator*() const { return *m_pPointer; }
AVSINLINE int* operator->() const { return m_pPointer; }
AVSINLINE const int& get()const { return *m_pPointer; }
public:
AVSINLINE CString toString() const
{
CString result;
return result;
}
};
class nullable_sizet : public nullable_base<size_t>
{
public:
nullable_sizet() : nullable_base<size_t>()
{
}
AVSINLINE void normalize(const size_t& max)
{
if (IsInit())
{
if (*m_pPointer > max)
*m_pPointer = max;
}
}
AVSINLINE void operator=(const BSTR& value)
{
RELEASEOBJECT(m_pPointer);
if (NULL != value)
m_pPointer = new size_t(XmlUtils::GetUInteger(value));
}
AVSINLINE void operator=(const size_t& value)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new size_t(value);
}
nullable_sizet& operator=(const nullable_sizet& oSrc)
{
RELEASEOBJECT(m_pPointer);
if ( NULL != oSrc.m_pPointer )
m_pPointer = new size_t(*oSrc);
return *this;
}
AVSINLINE size_t get_value_or(const size_t& value) const
{
if (NULL == m_pPointer)
{
size_t ret = value;
return ret;
}
return *m_pPointer;
}
public:
AVSINLINE size_t& operator*() { return *m_pPointer; }
AVSINLINE size_t* operator->() { return m_pPointer; }
AVSINLINE size_t& operator*() const { return *m_pPointer; }
AVSINLINE size_t* operator->() const { return m_pPointer; }
AVSINLINE const size_t& get()const { return *m_pPointer; }
};
class nullable_double : public nullable_base<double>
{
public:
nullable_double() : nullable_base<double>()
{
}
AVSINLINE void normalize(const double& min, const double& max)
{
if (IsInit())
{
if (*m_pPointer < min)
*m_pPointer = min;
else if (*m_pPointer > max)
*m_pPointer = max;
}
}
AVSINLINE void operator=(const BSTR& value)
{
RELEASEOBJECT(m_pPointer);
if (NULL != value)
m_pPointer = new double(XmlUtils::GetDouble(value));
}
AVSINLINE void operator=(const double& value)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new double(value);
}
nullable_double& operator=(const nullable_double& oSrc)
{
RELEASEOBJECT(m_pPointer);
if ( NULL != oSrc.m_pPointer )
m_pPointer = new double(*oSrc);
return *this;
}
AVSINLINE double get_value_or(const double& value) const
{
if (NULL == m_pPointer)
{
double ret = value;
return ret;
}
return *m_pPointer;
}
public:
AVSINLINE double& operator*() { return *m_pPointer; }
AVSINLINE double* operator->() { return m_pPointer; }
AVSINLINE double& operator*() const { return *m_pPointer; }
AVSINLINE double* operator->() const { return m_pPointer; }
AVSINLINE const double& get()const { return *m_pPointer; }
};
class nullable_bool : public nullable_base<bool>
{
public:
nullable_bool() : nullable_base<bool>()
{
}
protected:
bool set(const CString& value)
{
if ((_T("true") == value) || (_T("1") == value))
return true;
return false;
}
public:
AVSINLINE void operator=(const BSTR& value)
{
RELEASEOBJECT(m_pPointer);
if (NULL != value)
m_pPointer = new bool(set((CString)value));
}
AVSINLINE void operator=(const bool& value)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new bool(value);
}
nullable_bool& operator=(const nullable_bool& oSrc)
{
RELEASEOBJECT(m_pPointer);
if ( NULL != oSrc.m_pPointer )
m_pPointer = new bool(*oSrc);
return *this;
}
AVSINLINE bool get_value_or(const bool& value) const
{
if (NULL == m_pPointer)
{
bool ret = value;
return ret;
}
return *m_pPointer;
}
public:
AVSINLINE bool& operator*() { return *m_pPointer; }
AVSINLINE bool* operator->() { return m_pPointer; }
AVSINLINE bool& operator*() const { return *m_pPointer; }
AVSINLINE bool* operator->() const { return m_pPointer; }
AVSINLINE const bool& get()const { return *m_pPointer; }
public:
AVSINLINE CString toString() const
{
CString result;
return result;
}
};
class nullable_string : public nullable_base<CString>
{
public:
nullable_string() : nullable_base<CString>()
{
}
nullable_string(const nullable_string& oOther)
{
if ( NULL == oOther.m_pPointer )
m_pPointer = NULL;
else
m_pPointer = new CString( *oOther.m_pPointer );
}
AVSINLINE void operator=(const BSTR& value)
{
RELEASEOBJECT(m_pPointer);
if (NULL != value)
m_pPointer = new CString(value);
}
AVSINLINE void operator=(const CString& value)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = new CString(value);
}
AVSINLINE void operator=(CString* value)
{
RELEASEOBJECT(m_pPointer);
m_pPointer = value;
}
nullable_string& operator=(const nullable_string& oSrc)
{
RELEASEOBJECT(m_pPointer);
if ( NULL != oSrc.m_pPointer )
m_pPointer = new CString(*oSrc);
return *this;
}
AVSINLINE CString get_value_or(const CString& value) const
{
if (NULL == m_pPointer)
{
CString ret = value;
return ret;
}
return *m_pPointer;
}
public:
AVSINLINE CString& operator*() { return *m_pPointer; }
AVSINLINE CString* operator->() { return m_pPointer; }
AVSINLINE CString& operator*() const { return *m_pPointer; }
AVSINLINE CString* operator->() const { return m_pPointer; }
AVSINLINE CString& get()const { return *m_pPointer; }
};
}

View File

@@ -0,0 +1,196 @@
/*
* (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 "Base.h"
namespace NSCommon
{
template <typename Type>
class smart_ptr
{
protected:
Type* m_pData;
mutable LONG* m_pCountRef;
public:
smart_ptr()
{
m_pData = NULL;
m_pCountRef = NULL;
}
smart_ptr(Type* pPointer)
{
m_pData = pPointer;
m_pCountRef = new LONG(1);
}
smart_ptr(const smart_ptr<Type>& pPointer)
{
m_pData = NULL;
m_pCountRef = NULL;
*this = pPointer;
}
~smart_ptr()
{
Release();
}
AVSINLINE void Release()
{
if (!IsInit() || (NULL == m_pCountRef))
return;
*m_pCountRef -= 1;
if (0 >= *m_pCountRef)
{
delete m_pData;
delete m_pCountRef;
}
m_pData = NULL;
m_pCountRef = NULL;
}
AVSINLINE void AddRef()
{
if (!IsInit() || (NULL == m_pCountRef))
return;
*m_pCountRef += 1;
}
public:
smart_ptr<Type>& operator=(const Type& oSrc)
{
Release();
m_pData = new Type(oSrc);
m_pCountRef = new LONG(1);
return *this;
}
smart_ptr<Type>& operator=(Type* pType)
{
Release();
m_pData = pType;
m_pCountRef = new LONG(1);
return *this;
}
smart_ptr<Type>& operator=(const smart_ptr<Type>& oSrc)
{
Release();
if ((NULL == oSrc.m_pData) || (NULL == oSrc.m_pCountRef))
return *this;
*oSrc.m_pCountRef += 1;
Attach(oSrc.m_pData, oSrc.m_pCountRef);
return *this;
}
public:
AVSINLINE bool IsInit() const
{
return (NULL != m_pData);
}
AVSINLINE bool is_init() const
{
return IsInit();
}
template<class T> AVSINLINE const bool is()const
{
if (!IsInit())
return false;
T* pResult = dynamic_cast<T*>(const_cast<Type*>(m_pData));
return (NULL != pResult);
}
template<class T> AVSINLINE const T& as()const
{
T* pResult = dynamic_cast<T*>(const_cast<Type*>(m_pData));
return *pResult;
}
template<class T> AVSINLINE T& as()
{
T* pResult = dynamic_cast<T*>(const_cast<Type*>(m_pData));
return *pResult;
}
template <typename T>
AVSINLINE void Attach(T* pCast, const LONG* pCountRef)
{
m_pData = pCast;
m_pCountRef = const_cast<LONG*>(pCountRef);
}
template<typename T>
AVSINLINE smart_ptr<T> smart_dynamic_cast()const
{
smart_ptr<T> new_type;
if ((NULL == m_pData) || (NULL == m_pCountRef))
return new_type;
T* pCast = dynamic_cast<T*>(m_pData);
if (NULL == pCast)
return new_type;
*m_pCountRef += 1;
new_type.Attach(pCast, m_pCountRef);
return new_type;
}
AVSINLINE Type& operator*() { return *m_pData; }
AVSINLINE Type* operator->() { return m_pData; }
AVSINLINE const Type& operator*() const { return *m_pData; }
AVSINLINE const Type* operator->() const { return m_pData; }
AVSINLINE const Type& get() { return *m_pData; } const
AVSINLINE void reset(Type* pPointer = NULL)
{
*this = pPointer;
}
};
template <typename T>
static AVSINLINE void normalize_value(T& value, const T& min, const T& max)
{
if (value < min)
value = min;
else if (value > max)
value = max;
}
}

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 ABSTRACT_CONVERTER_INCLUDE_H_
#define ABSTRACT_CONVERTER_INCLUDE_H_
#include <boost/utility.hpp>
#include <boost/filesystem.hpp>
template<class Input, class Output>
class AbstractConverter : private boost::noncopyable
{
public:
AbstractConverter(const boost::filesystem::wpath& originPath)
{
m_origin.read(originPath);
}
public:
const bool isInputValid(const boost::filesystem::wpath& path) const
{
return m_input.isValid(path);
}
const bool isOriginValid(const boost::filesystem::wpath& path) const
{
return m_origin.isValid(path);
}
const bool isOutputValid(const boost::filesystem::wpath& path) const
{
return m_output.isValid(path);
}
void read(const boost::filesystem::wpath& path)
{
m_input.read(path);
}
void write(const boost::filesystem::wpath& path) const
{
m_output.write(path);
}
protected:
typedef AbstractConverter base;
protected:
Input m_input;
Output m_output;
Output m_origin;
};
#endif // ABSTRACT_CONVERTER_INCLUDE_H_

View File

@@ -0,0 +1,133 @@
/*
* (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 "Align.h"
namespace Common
{
Align::Align()
: m_type(right)
{
}
const Align::Type Align::type() const
{
return m_type;
}
const Align Align::Right()
{
return Align(right);
}
const Align Align::Left()
{
return Align(left);
}
const Align Align::Center()
{
return Align(center);
}
const Align Align::Both()
{
return Align(both);
}
const bool Align::isRight() const
{
return m_type == right;
}
const bool Align::isLeft() const
{
return m_type == left;
}
const bool Align::isCenter() const
{
return m_type == center;
}
const bool Align::isBoth() const
{
return m_type == both;
}
void Align::setRight()
{
m_type = right;
}
void Align::setLeft()
{
m_type = left;
}
void Align::setCenter()
{
m_type = center;
}
void Align::setBoth()
{
m_type = both;
}
Align::Align(const Align::Type type)
: m_type(type)
{
}
void Align::fromBase(const Align& align)
{
m_type = align.m_type;
}
} // namespace Common

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 COMMON_ALIGN_INCLUDE_H_
#define COMMON_ALIGN_INCLUDE_H_
namespace Common
{
class Align
{
public:
Align();
enum Type
{
right,
left,
center,
both
};
public:
const Type type() const;
public:
static const Align Right();
static const Align Left();
static const Align Center();
static const Align Both();
public:
const bool isRight() const;
const bool isLeft() const;
const bool isCenter() const;
const bool isBoth() const;
public:
void setRight();
void setLeft();
void setCenter();
void setBoth();
protected:
Type m_type;
protected:
Align(const Type type);
void fromBase(const Align& align);
};
}
#endif // COMMON_ALIGN_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
*
*/
#include "Color.h"
namespace Common
{
Color::Color()
: Red(0x00),
Green(0x00),
Blue(0x00)
{
}
Color::Color(const int red, const int green, const int blue)
: Red(red),
Green(green),
Blue(blue)
{
}
void Color::fromBase(const Color& color)
{
Red = color.Red;
Green = color.Green;
Blue = color.Blue;
}
} // namespace Common

View File

@@ -0,0 +1,54 @@
/*
* (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 COMMON_COLOR_INCLUDE_H_
#define COMMON_COLOR_INCLUDE_H_
namespace Common
{
class Color
{
public:
Color();
Color(const int red, const int green, const int blue);
public:
unsigned char Red;
unsigned char Green;
unsigned char Blue;
protected:
void fromBase(const Color& color);
};
}
#endif // COMMON_COLOR_INCLUDE_H_

View File

@@ -0,0 +1,47 @@
/*
* (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 COMMON_COMMON_INCLUDE_H_
#define COMMON_COMMON_INCLUDE_H_
#include "Align.h"
#include "Color.h"
#include "Index.h"
#include "Point.h"
#include "Size.h"
#include "NumFormat.h"
#include "Position.h"
#include "Wrap.h"
#include "ZIndex.h"
#endif // COMMON_COMMON_INCLUDE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,117 @@
/*
* (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 UTILITY_ENCODING_INCLUDE_H_
#define UTILITY_ENCODING_INCLUDE_H_
#include "../Base/Base.h"
class Encoding
{
public:
static __forceinline const CStringA Encoding::ansi2utf8 (const CStringA &sLine)
{
return wstring2string( string2wstring( sLine, CP_ACP ), CP_UTF8 );
}
static __forceinline const CStringW Encoding::ansi2unicode (const CStringA &sLine)
{
return string2wstring( sLine, CP_ACP );
}
static __forceinline const CStringA Encoding::utf82ansi (const CStringA &sLine)
{
return wstring2string( string2wstring( sLine, CP_UTF8 ), CP_ACP );
}
static __forceinline const CStringW Encoding::utf82unicode (const CStringA &sLine)
{
return string2wstring( sLine, CP_UTF8 );
}
static __forceinline const CStringA Encoding::unicode2ansi (const CStringW &sLine)
{
return wstring2string( sLine, CP_ACP );
}
static __forceinline const CStringA Encoding::unicode2utf8 (const CStringW &sLine)
{
return wstring2string( sLine, CP_UTF8 );
}
private:
static __forceinline const CStringA Encoding::wstring2string(const CStringW &sLine, const unsigned int unCodePage)
{
const int nSize = WideCharToMultiByte( unCodePage, 0, sLine.GetString(), sLine.GetLength(), NULL, 0, NULL, NULL );
char *sTemp = new char[nSize];
if ( !sTemp )
return "";
WideCharToMultiByte( unCodePage, 0, sLine.GetString(), sLine.GetLength(), sTemp, nSize, NULL, NULL );
CStringA sResult( sTemp );
delete []sTemp;
return sResult;
}
static __forceinline const CStringW Encoding::string2wstring(const CStringA &sLine, const unsigned int unCodePage)
{
const int nSize = MultiByteToWideChar( unCodePage, 0, sLine.GetString(), sLine.GetLength(), NULL, 0 );
wchar_t *sTemp = new wchar_t[nSize];
if ( !sTemp )
return _T("");
MultiByteToWideChar( unCodePage, 0, sLine.GetString(), sLine.GetLength(), sTemp, nSize );
CStringW sResult( sTemp );
delete []sTemp;
return sResult;
}
};
#endif // UTILITY_ENCODING_INCLUDE_H_

View File

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

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 COMMON_INDEX_INCLUDE_H_
#define COMMON_INDEX_INCLUDE_H_
namespace Common
{
class Index
{
public:
Index();
enum Type
{
super,
normal,
sub
};
public:
const Type type() const;
public:
static const Index Super();
static const Index Normal();
static const Index Sub();
public:
const bool isSuper() const;
const bool isNormal() const;
const bool isSub() const;
public:
void setSuper();
void setNormal();
void setSub();
protected:
Type m_type;
protected:
Index(const Type type);
void fromBase(const Index& index);
};
}
#endif // COMMON_INDEX_INCLUDE_H_

View File

@@ -0,0 +1,205 @@
/*
* (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 "NumFormat.h"
namespace Common
{
NumFormat::NumFormat()
: m_type(decimal)
{
}
const NumFormat::Type NumFormat::type() const
{
return m_type;
}
const NumFormat NumFormat::UpperLetter()
{
return NumFormat(upperLetter);
}
const NumFormat NumFormat::LowerLetter()
{
return NumFormat(lowerLetter);
}
const NumFormat NumFormat::UpperRoman()
{
return NumFormat(upperRoman);
}
const NumFormat NumFormat::LowerRoman()
{
return NumFormat(lowerRoman);
}
const NumFormat NumFormat::Decimal()
{
return NumFormat(decimal);
}
const NumFormat NumFormat::Symbol()
{
return NumFormat(symbol);
}
const NumFormat NumFormat::Bullet()
{
return NumFormat(bullet);
}
const NumFormat NumFormat::Chicago()
{
return NumFormat(chicago);
}
const bool NumFormat::isUpperLetter() const
{
return m_type == upperLetter;
}
const bool NumFormat::isLowerLetter() const
{
return m_type == lowerLetter;
}
const bool NumFormat::isUpperRoman() const
{
return m_type == upperRoman;
}
const bool NumFormat::isLowerRoman() const
{
return m_type == lowerRoman;
}
const bool NumFormat::isDecimal() const
{
return m_type == decimal;
}
const bool NumFormat::isSymbol() const
{
return m_type == symbol;
}
const bool NumFormat::isBullet() const
{
return m_type == bullet;
}
const bool NumFormat::isChicago() const
{
return m_type == chicago;
}
void NumFormat::setUpperLetter()
{
m_type = upperLetter;
}
void NumFormat::setLowerLetter()
{
m_type = lowerLetter;
}
void NumFormat::setUpperRoman()
{
m_type = upperRoman;
}
void NumFormat::setLowerRoman()
{
m_type = lowerRoman;
}
void NumFormat::setDecimal()
{
m_type = decimal;
}
void NumFormat::setSymbol()
{
m_type = symbol;
}
void NumFormat::setBullet()
{
m_type = bullet;
}
void NumFormat::setChicago()
{
m_type = chicago;
}
NumFormat::NumFormat(const NumFormat::Type type)
: m_type(type)
{
}
void NumFormat::fromBase(const NumFormat& numFormat)
{
m_type = numFormat.m_type;
}
} // namespace Common

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 COMMON_NUM_FORMAT_INCLUDE_H_
#define COMMON_NUM_FORMAT_INCLUDE_H_
namespace Common
{
class NumFormat
{
public:
NumFormat();
enum Type
{
upperLetter,
lowerLetter,
upperRoman,
lowerRoman,
decimal,
symbol,
bullet,
chicago
};
public:
const Type type() const;
public:
static const NumFormat UpperLetter();
static const NumFormat LowerLetter();
static const NumFormat UpperRoman();
static const NumFormat LowerRoman();
static const NumFormat Decimal();
static const NumFormat Symbol();
static const NumFormat Bullet();
static const NumFormat Chicago();
public:
const bool isUpperLetter() const;
const bool isLowerLetter() const;
const bool isUpperRoman() const;
const bool isLowerRoman() const;
const bool isDecimal() const;
const bool isSymbol() const;
const bool isBullet() const;
const bool isChicago() const;
public:
void setUpperLetter();
void setLowerLetter();
void setUpperRoman();
void setLowerRoman();
void setDecimal();
void setSymbol();
void setBullet();
void setChicago();
protected:
Type m_type;
protected:
NumFormat(const Type type);
void fromBase(const NumFormat& numFormat);
};
}
#endif // COMMON_NUM_FORMAT_INCLUDE_H_

View File

@@ -0,0 +1,102 @@
/*
* (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 COMMON_POINT_INCLUDE_H_
#define COMMON_POINT_INCLUDE_H_
#include "Unit.h"
#include "property.h"
#include "nullable_property.h"
#include "XML.h"
namespace Common
{
template<class Unit>
class Point
{
public:
Point() {};
template<typename XType, typename YType>
Point(const XType& x, const YType& y)
: X(x), Y(y)
{
}
template<typename OtherUnit>
Point(const OtherUnit& rhs)
: X(rhs.X), Y(rhs.Y)
{
}
template<typename OtherUnit>
const Point& operator =(const OtherUnit& rhs)
{
X = ths.X;
Y = ths.Y;
return *this;
}
public:
property<Unit> X;
property<Unit> Y;
};
}
namespace XML
{
template<class Unit>
const Common::Point<Unit> XElement2Point(const XML::XElement& element, const std::string& x, const std::string& y)
{
Common::Point<Unit> point;
point.X = element.attribute(x).value().ToString();
point.Y = element.attribute(y).value().ToString();
return point;
}
template<class Unit>
const nullable<Common::Point<Unit> > XElement2NullablePoint(const XML::XElement& element, const std::string& x, const std::string& y)
{
nullable<Common::Point<Unit> > point;
if (element.attribute(x).exist() || element.attribute(y).exist())
point.init();
if (element.attribute(x).exist())
point->X = element.attribute(x).value().ToString();
if (element.attribute(y).exist())
point->Y = element.attribute(y).value().ToString();
return point;
}
}
#endif // COMMON_POINT_INCLUDE_H_

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
*
*/
#include "Position.h"
namespace Common
{
Position::Position()
: m_type(foreground)
{
}
const Position::Type Position::type() const
{
return m_type;
}
const Position Position::Background()
{
return Position(background);
}
const Position Position::Foreground()
{
return Position(foreground);
}
const bool Position::isBackground() const
{
return m_type == background;
}
const bool Position::isForeground() const
{
return m_type == foreground;
}
void Position::setBackground()
{
m_type = background;
}
void Position::setForeground()
{
m_type = foreground;
}
Position::Position(const Position::Type type)
: m_type(type)
{
}
void Position::fromBase(const Position& position)
{
m_type = position.m_type;
}
} // namespace Common

View File

@@ -0,0 +1,74 @@
/*
* (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 COMMON_POSITION_INCLUDE_H_
#define COMMON_POSITION_INCLUDE_H_
namespace Common
{
class Position
{
public:
Position();
enum Type
{
background,
foreground
};
public:
const Type type() const;
public:
static const Position Background();
static const Position Foreground();
public:
const bool isBackground() const;
const bool isForeground() const;
public:
void setBackground();
void setForeground();
protected:
Type m_type;
protected:
Position(const Type type);
void fromBase(const Position& position);
};
}
#endif // COMMON_POSITION_INCLUDE_H_

View File

@@ -0,0 +1,445 @@
/*
* (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 "math.h"
#include "../Common/Unit.h"
#include "../XML/XmlUtils.h"
namespace SimpleTypes
{
#define SimpleType_FromString(Enum) \
virtual Enum FromString(const BSTR &bsValue)\
{\
CString sTemp( bsValue );\
return FromString( (CString &)sTemp );\
}\
virtual Enum FromString(const wchar_t* cwsStr)\
{\
CWCharWrapper wsTemp = cwsStr;\
return FromString( (const CWCharWrapper&)wsTemp );\
}\
virtual Enum FromString(const CWCharWrapper& wsStr)\
{\
CString sTemp( wsStr.m_cwsString );\
return FromString( (CString&)sTemp );\
}
#define SimpleType_FromString2(Enum) \
Enum FromString(const BSTR &bsValue)\
{\
CString sTemp( bsValue );\
return FromString( (CString &)sTemp );\
}\
Enum FromString(const wchar_t* cwsStr)\
{\
CWCharWrapper wsTemp = cwsStr;\
return FromString( (const CWCharWrapper&)wsTemp );\
}\
Enum FromString(const CWCharWrapper& wsStr)\
{\
CString sTemp( wsStr.m_cwsString );\
return FromString( (CString&)sTemp );\
}
#define SimpleTypes_AdditionalOpearators(Class) \
const bool operator==(const Class& oOther) const\
{\
if ( m_eValue == oOther.m_eValue )\
return true;\
return false;\
}
#define UniversalMeasure_AdditionalOpearators(Class) \
const bool operator==(const Class& oOther) const\
{\
if ( m_dValue == oOther.m_dValue )\
return true;\
return false;\
}
#define SimpleType_Operator_Equal(Class) \
Class(const BSTR &bsValue)\
{\
FromString( bsValue );\
}\
Class(CString &sValue)\
{\
FromString( sValue );\
}\
Class(const wchar_t* cwsValue)\
{\
FromString( cwsValue );\
}\
Class(const CWCharWrapper& wsStr)\
{\
FromString( wsStr );\
}\
const Class &operator =(CString &sValue)\
{\
FromString( sValue );\
return *this;\
}\
const Class &operator =(const BSTR &bsValue)\
{\
FromString( bsValue );\
return *this;\
}\
const Class &operator =(const wchar_t* cwsString)\
{\
FromString( cwsString );\
return *this;\
}\
const Class &operator =(const CWCharWrapper& wsStr)\
{\
FromString( wsStr );\
return *this;\
}
template<typename E, E DefValue = 0>
class CSimpleType
{
public:
CSimpleType()
{
m_eValue = DefValue;
}
virtual E GetValue () const
{
return m_eValue;
}
virtual void SetValue (E eValue)
{
m_eValue = eValue;
}
virtual E FromString(const BSTR &bsValue) = 0;
virtual E FromString(CString &sValue) = 0;
virtual CString ToString () const = 0;
protected:
E m_eValue;
};
class CUniversalMeasure
{
public:
CUniversalMeasure() {}
virtual double FromString(CString &sValue) = 0;
virtual double FromString(const BSTR &bsValue) = 0;
virtual CString ToString () const = 0;
double ToPoints() const
{
return m_dValue;
}
double ToInches() const
{
return m_dValue / 72.0;
}
double ToMm() const
{
return m_dValue * 25.4 / 72;
}
long ToTwips() const
{
return (long)Pt_To_Dx(m_dValue);
}
virtual double FromPoints(double dValue)
{
m_dValue = dValue;
return m_dValue;
}
virtual double FromTwips(double dValue)
{
m_dValue = Dx_To_Pt(dValue);
return m_dValue;
}
virtual double FromMm(double dValue)
{
m_dValue = Mm_To_Pt(dValue);
return m_dValue;
}
virtual double FromInches(double dValue)
{
m_dValue = Inch_To_Pt( dValue );
return m_dValue;
}
virtual double FromEmu (double dValue)
{
m_dValue = Emu_To_Pt( dValue );
return m_dValue;
}
protected:
void Parse(CString &sValue, double dKoef)
{
if ( sValue.GetLength() <= 2 )
{
m_bUnit = false;
m_dValue = _wtof( sValue ) / dKoef;
return;
}
CString sUnit = sValue.Mid( sValue.GetLength() - 2, 2 );
m_bUnit = true;
if ( _T("cm") == sUnit )
{
double dValue = _wtof( sValue.Mid( 0, sValue.GetLength() - 2 ) );
m_dValue = Cm_To_Pt( dValue );
}
else if ( _T("mm") == sUnit )
{
double dValue = _wtof( sValue.Mid( 0, sValue.GetLength() - 2 ) );
m_dValue = Mm_To_Pt( dValue );
}
else if ( _T("in") == sUnit )
{
double dValue = _wtof( sValue.Mid( 0, sValue.GetLength() - 2 ) );
m_dValue = Inch_To_Pt( dValue );
}
else if ( _T("pt") == sUnit )
{
m_dValue = _wtof( sValue.Mid( 0, sValue.GetLength() - 2 ) );
}
else if ( _T("pc") == sUnit )
{
double dValue = _wtof( sValue.Mid( 0, sValue.GetLength() - 2 ) );
m_dValue = dValue * 12.0;
}
else if ( _T("pi") == sUnit )
{
double dValue = _wtof( sValue.Mid( 0, sValue.GetLength() - 2 ) );
m_dValue = dValue * 12.0;
}
else
{
m_bUnit = false;
m_dValue = _wtof( sValue ) / dKoef;
return;
}
}
protected:
bool m_bUnit;
double m_dValue;
};
class CPoint : public CUniversalMeasure
{
public:
CPoint() {}
virtual double FromString(CString &sValue)
{
Parse(sValue, 1);
return m_dValue;
}
virtual CString ToString () const
{
CString sResult;
sResult.Format( _T("%fpt"), m_dValue);
return sResult;
}
virtual double FromPoints(double dValue)
{
m_dValue = dValue;
return m_dValue;
}
virtual double FromInches(double dValue)
{
m_dValue = dValue * 72;
return m_dValue;
}
void SetValue(double dValue)
{
m_dValue = dValue;
}
double GetValue () const
{
return m_dValue;
}
SimpleType_FromString (double)
SimpleType_Operator_Equal (CPoint)
UniversalMeasure_AdditionalOpearators(CPoint)
};
class CInch : public CUniversalMeasure
{
public:
CInch() {}
virtual double FromString(CString &sValue)
{
Parse(sValue, 1.0 / 72);
return m_dValue;
}
virtual CString ToString () const
{
CString sResult;
sResult.Format( _T("%fin"), ToInches());
return sResult;
}
SimpleType_FromString (double)
SimpleType_Operator_Equal (CInch)
UniversalMeasure_AdditionalOpearators(CInch)
};
class CEmu : public CUniversalMeasure
{
public:
CEmu() {}
virtual double FromString(CString &sValue)
{
Parse(sValue, 12700);
return m_dValue;
}
virtual CString ToString () const
{
CString sResult;
sResult.Format( _T("%fpt"), m_dValue);
return sResult;
}
virtual double FromPoints(double dValue)
{
m_dValue = dValue;
return m_dValue;
}
virtual double FromInches(double dValue)
{
m_dValue = dValue * 72;
return m_dValue;
}
virtual double FromEmu(double dValue)
{
m_dValue = Emu_To_Pt(dValue);
return m_dValue;
}
virtual double ToMm()
{
return Pt_To_Mm(m_dValue);
}
virtual __int64 ToEmu()
{
return (__int64)Pt_To_Emu(m_dValue);
}
void SetValue(double dValue)
{
m_dValue = dValue;
}
double GetValue () const
{
return m_dValue;
}
SimpleType_FromString (double)
SimpleType_Operator_Equal (CEmu)
UniversalMeasure_AdditionalOpearators(CEmu)
};
class CDouble
{
public:
CDouble() {}
virtual double FromString(CString &sValue)
{
m_dValue = _wtof( sValue );
return m_dValue;
}
virtual CString ToString () const
{
CString sResult;
sResult.Format( _T("%f"), m_dValue);
return sResult;
}
void SetValue(double dValue)
{
m_dValue = dValue;
}
double GetValue () const
{
return m_dValue;
}
SimpleType_FromString (double)
SimpleType_Operator_Equal (CDouble)
private:
double m_dValue;
};
} // SimpleTypes

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,593 @@
/*
* (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 "SimpleTypes_Base.h"
namespace SimpleTypes
{
enum EBreakBin
{
breakBinAfter = 0,
breakBinBefore = 1,
breakBinRepeat = 2
};
template<EBreakBin eDefValue = breakBinRepeat>
class CBreakBin : public CSimpleType<EBreakBin, eDefValue>
{
public:
CBreakBin() {}
virtual EBreakBin FromString(CString &sValue)
{
if ( _T("after") == sValue ) m_eValue = breakBinAfter;
else if ( _T("before") == sValue ) m_eValue = breakBinBefore;
else m_eValue = breakBinRepeat;
return m_eValue;
}
virtual CString ToString() const
{
switch(m_eValue)
{
case breakBinAfter : return _T("after");
case breakBinBefore : return _T("before");
case breakBinRepeat : return _T("repeat");
default : return _T("repeat");
}
}
SimpleType_FromString (EBreakBin)
SimpleType_Operator_Equal (CBreakBin)
};
enum EBreakBinSub
{
breakBinPlusMinus = 0,
breakBinMinusPlus = 1,
breakBinMinusMinus = 2
};
template<EBreakBinSub eDefValue = breakBinMinusMinus>
class CBreakBinSub : public CSimpleType<EBreakBinSub, eDefValue>
{
public:
CBreakBinSub() {}
virtual EBreakBinSub FromString(CString &sValue)
{
if ( _T("+-") == sValue ) m_eValue = breakBinPlusMinus;
else if ( _T("-+") == sValue ) m_eValue = breakBinMinusPlus;
else m_eValue = breakBinMinusMinus;
return m_eValue;
}
virtual CString ToString() const
{
switch(m_eValue)
{
case breakBinPlusMinus : return _T("+-");
case breakBinMinusPlus : return _T("-+");
case breakBinMinusMinus : return _T("--");
default : return _T("--");
}
}
SimpleType_FromString (EBreakBinSub)
SimpleType_Operator_Equal (CBreakBinSub)
};
class CMChar
{
public:
CMChar() {}
CString GetValue() const
{
return m_sValue;
}
void SetValue(CString &sValue)
{
m_sValue = sValue;
}
CString FromString(CString &sValue)
{
m_sValue = sValue;
return m_sValue;
}
CString ToString () const
{
return m_sValue;
}
SimpleType_FromString (CString)
SimpleType_Operator_Equal (CMChar)
private:
CString m_sValue;
};
enum EFType
{
fTypeBar = 0,
fTypeLin = 1,
fTypeNoBar = 2,
fTypeSkw = 3
};
template<EFType eDefValue = fTypeBar>
class CFType : public CSimpleType<EFType, eDefValue>
{
public:
CFType() {}
virtual EFType FromString(CString &sValue)
{
if ( _T("bar") == sValue ) m_eValue = fTypeBar;
else if ( _T("lin") == sValue ) m_eValue = fTypeLin;
else if ( _T("noBar") == sValue ) m_eValue = fTypeNoBar;
else m_eValue = fTypeSkw;
return m_eValue;
}
virtual CString ToString() const
{
switch(m_eValue)
{
case fTypeBar : return _T("bar");
case fTypeLin : return _T("lin");
case fTypeNoBar : return _T("noBar");
case fTypeSkw : return _T("skw");
default : return _T("bar");
}
}
SimpleType_FromString (EFType)
SimpleType_Operator_Equal (CFType)
};
template<int nDefValue = 0>
class CInteger2 : public CSimpleType<int, nDefValue>
{
public:
CInteger2() {}
virtual int FromString(CString &sValue)
{
m_eValue = _wtoi( sValue );
if (m_eValue < -2)
m_eValue = -2;
if (m_eValue > 2)
m_eValue = 2;
return m_eValue;
}
virtual CString ToString () const
{
CString sResult;
sResult.Format( _T("%d"), m_eValue);
return sResult;
}
SimpleType_FromString (int)
SimpleType_Operator_Equal (CInteger2)
};
template<int nDefValue = 1>
class CInteger255 : public CSimpleType<int, nDefValue>
{
public:
CInteger255() {}
virtual int FromString(CString &sValue)
{
m_eValue = _wtoi( sValue );
if (m_eValue < 1)
m_eValue = 1;
if (m_eValue > 255)
m_eValue = 255;
return m_eValue;
}
virtual CString ToString () const
{
CString sResult;
sResult.Format( _T("%d"), m_eValue);
return sResult;
}
SimpleType_FromString (int)
SimpleType_Operator_Equal (CInteger255)
};
enum EMJc
{
mjcCenter = 0,
mjcCenterGroup = 1,
mjcLeft = 2,
mjcRight = 3
};
template<EMJc eDefValue = mjcCenterGroup>
class CMJc : public CSimpleType<EMJc, eDefValue>
{
public:
CMJc() {}
virtual EMJc FromString(CString &sValue)
{
if ( _T("center") == sValue ) m_eValue = mjcCenter;
else if ( _T("centerGroup") == sValue ) m_eValue = mjcCenterGroup;
else if ( _T("left") == sValue ) m_eValue = mjcLeft;
else m_eValue = mjcRight;
return m_eValue;
}
virtual CString ToString() const
{
switch(m_eValue)
{
case mjcCenter : return _T("center");
case mjcCenterGroup : return _T("centerGroup");
case mjcLeft : return _T("left");
case mjcRight : return _T("right");
default : return _T("centerGroup");
}
}
SimpleType_FromString (EMJc)
SimpleType_Operator_Equal (CMJc)
};
enum ELimLoc
{
limLocSubSup = 0,
limLocUndOvr = 1
};
template<ELimLoc eDefValue = limLocSubSup>
class CLimLoc : public CSimpleType<ELimLoc, eDefValue>
{
public:
CLimLoc() {}
virtual ELimLoc FromString(CString &sValue)
{
if ( _T("subSup") == sValue ) m_eValue = limLocSubSup;
else m_eValue = limLocUndOvr;
return m_eValue;
}
virtual CString ToString() const
{
switch(m_eValue)
{
case limLocSubSup : return _T("subSup");
case limLocUndOvr : return _T("undOvr");
default : return _T("subSup");
}
}
SimpleType_FromString (ELimLoc)
SimpleType_Operator_Equal (CLimLoc)
};
enum EScript
{
scriptDoubleStruck = 0,
scriptFraktur = 1,
scriptMonospace = 2,
scriptRoman = 3,
scriptSansSerif = 4,
scriptScript = 5
};
template<EScript eDefValue = scriptRoman>
class CScript : public CSimpleType<EScript, eDefValue>
{
public:
CScript() {}
virtual EScript FromString(CString &sValue)
{
if ( _T("double-struck") == sValue ) m_eValue = scriptDoubleStruck;
else if ( _T("fraktur") == sValue ) m_eValue = scriptFraktur;
else if ( _T("monospace") == sValue ) m_eValue = scriptMonospace;
else if ( _T("roman") == sValue ) m_eValue = scriptRoman;
else if ( _T("sans-serif") == sValue ) m_eValue = scriptSansSerif;
else m_eValue = scriptScript;
return m_eValue;
}
virtual CString ToString() const
{
switch(m_eValue)
{
case scriptDoubleStruck : return _T("double-struck");
case scriptFraktur : return _T("fraktur");
case scriptMonospace : return _T("monospace");
case scriptRoman : return _T("roman");
case scriptSansSerif : return _T("sans-serif");
case scriptScript : return _T("script");
default : return _T("roman");
}
}
SimpleType_FromString (EScript)
SimpleType_Operator_Equal (CScript)
};
enum EShp
{
shpCentered = 0,
shpMatch = 1
};
template<EShp eDefValue = shpCentered>
class CShp : public CSimpleType<EShp, eDefValue>
{
public:
CShp() {}
virtual EShp FromString(CString &sValue)
{
if ( _T("centered") == sValue ) m_eValue = shpCentered;
else m_eValue = shpMatch;
return m_eValue;
}
virtual CString ToString() const
{
switch(m_eValue)
{
case shpCentered : return _T("centered");
case shpMatch : return _T("match");
default : return _T("centered");
}
}
SimpleType_FromString (EShp)
SimpleType_Operator_Equal (CShp)
};
template<int unDefValue = 0>
class CSpacingRule : public CSimpleType<int, unDefValue>
{
public:
CSpacingRule() {}
virtual int FromString(CString &sValue)
{
m_eValue = _wtoi( sValue );
return m_eValue;
}
virtual CString ToString () const
{
CString sResult;
sResult.Format( _T("%d"), m_eValue);
return sResult;
}
SimpleType_FromString (int)
SimpleType_Operator_Equal (CSpacingRule)
};
enum EStyle
{
styleBold = 0,
styleBoldItalic = 1,
styleItalic = 2,
stylePlain = 3
};
template<EStyle eDefValue = styleBoldItalic>
class CStyle : public CSimpleType<EStyle, eDefValue>
{
public:
CStyle() {}
virtual EStyle FromString(CString &sValue)
{
if ( _T("b") == sValue ) m_eValue = styleBold;
else if ( _T("bi") == sValue ) m_eValue = styleBoldItalic;
else if ( _T("i") == sValue ) m_eValue = styleItalic;
else m_eValue = stylePlain;
return m_eValue;
}
virtual CString ToString() const
{
switch(m_eValue)
{
case styleBold : return _T("b");
case styleBoldItalic : return _T("bi");
case styleItalic : return _T("i");
case stylePlain : return _T("p");
default : return _T("i");
}
}
SimpleType_FromString (EStyle)
SimpleType_Operator_Equal (CStyle)
};
enum ETopBot
{
tbBot = 0,
tbTop = 1
};
template<ETopBot eDefValue = tbBot>
class CTopBot : public CSimpleType<ETopBot, eDefValue>
{
public:
CTopBot() {}
virtual ETopBot FromString(CString &sValue)
{
if ( _T("bot") == sValue ) m_eValue = tbBot;
else m_eValue = tbTop;
return m_eValue;
}
virtual CString ToString() const
{
switch(m_eValue)
{
case tbBot : return _T("bot");
case tbTop : return _T("top");
default : return _T("bot");
}
}
SimpleType_FromString (ETopBot)
SimpleType_Operator_Equal (CTopBot)
};
template<unsigned int unDefValue = 0>
class CUnSignedInteger : public CSimpleType<unsigned int, unDefValue>
{
public:
CUnSignedInteger() {}
virtual unsigned int FromString(CString &sValue)
{
m_eValue = _wtoi( sValue );
return m_eValue;
}
virtual CString ToString () const
{
CString sResult;
sResult.Format( _T("%d"), m_eValue);
return sResult;
}
SimpleType_FromString (unsigned int)
SimpleType_Operator_Equal (CUnSignedInteger)
};
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,102 @@
/*
* (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 COMMON_SIZE_INCLUDE_H_
#define COMMON_SIZE_INCLUDE_H_
#include "Unit.h"
#include "property.h"
#include "nullable_property.h"
#include "XML.h"
namespace Common
{
template<class Unit>
class Size
{
public:
Size() {}
template<typename HeightType, typename WidthType>
Size(const HeightType& height, WidthType width)
: Height(height), Width(width)
{
}
template<typename OtherUnit>
Size(const OtherUnit& rhs)
: Height(rhs.Height), Width(rhs.Width)
{
}
template<typename OtherUnit>
const Size& operator =(const OtherUnit& rhs)
{
Height = ths.Height;
Width = ths.Width;
return *this;
}
public:
property<Unit> Height;
property<Unit> Width;
};
}
namespace XML
{
template<class Unit>
const Common::Size<Unit> XElement2Size(const XML::XElement& element, const std::string& height, const std::string& width)
{
Common::Size<Unit> size;
size.Height = element.attribute(height).value().ToString();
size.Width = element.attribute(width).value().ToString();
return size;
}
template<class Unit>
const nullable<Common::Size<Unit> > XElement2NullableSize(const XML::XElement& element, const std::string& height, const std::string& width)
{
nullable<Common::Size<Unit> > size;
if (element.attribute(height).exist() || element.attribute(width).exist())
size.init();
if (element.attribute(height).exist())
size->Height = element.attribute(height).value().ToString();
if (element.attribute(width).exist())
size->Width = element.attribute(width).value().ToString();
return size;
}
}
#endif // COMMON_SIZE_INCLUDE_H_

View File

@@ -0,0 +1,390 @@
/*
* (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 _UNIT_INCLUDE_H_
#define _UNIT_INCLUDE_H_
#include "../Base/Base.h"
AVSINLINE double Cm_To_Mm (const double &dValue)
{
return dValue * 10;
}
AVSINLINE double Cm_To_Pt (const double &dValue)
{
return dValue * 72 / 2.54;
}
AVSINLINE double Cm_To_Px (const double &dValue)
{
return dValue * 72 * 4 / 3 / 2.54;
}
AVSINLINE double Cm_To_Inch (const double &dValue)
{
return dValue / 2.54;
}
AVSINLINE double Cm_To_Dx (const double &dValue)
{
return dValue * 72 * 20 / 2.54;
}
AVSINLINE double Cm_To_Sx (const double &dValue)
{
return dValue * 72 * 100 * 1000 / 20;
}
AVSINLINE double Cm_To_Multi (const double &dValue)
{
return dValue * 72 * 20 / 2.54;
}
AVSINLINE double Cm_To_Emu (const double &dValue)
{
return dValue * 360000;
}
AVSINLINE double Mm_To_Cm (const double &dValue)
{
return dValue / 10;
}
AVSINLINE double Mm_To_Pt (const double &dValue)
{
return dValue * 72 / 10 / 2.54;
}
AVSINLINE double Mm_To_Px (const double &dValue)
{
return dValue * 72 * 4 / 3 / 10 / 2.54;
}
AVSINLINE double Mm_To_Inch (const double &dValue)
{
return dValue / 2.54 / 10;
}
AVSINLINE double Mm_To_Dx (const double &dValue)
{
return dValue * 72 * 20 / 10 / 2.54;
}
AVSINLINE double Mm_To_Sx (const double &dValue)
{
return dValue * 72 * 100 * 1000 / 10 / 20;
}
AVSINLINE double Mm_To_Multi (const double &dValue)
{
return dValue * 72 * 20 / 10 / 2.54;
}
AVSINLINE double Mm_To_Emu (const double &dValue)
{
return dValue * 36000;
}
AVSINLINE double Pt_To_Cm (const double &dValue)
{
return dValue * 2.54 / 72;
}
AVSINLINE double Pt_To_Mm (const double &dValue)
{
return dValue * 2.54 * 10 / 72;
}
AVSINLINE double Pt_To_Px (const double &dValue)
{
return dValue * 4 / 3;
}
AVSINLINE double Pt_To_Inch (const double &dValue)
{
return dValue / 72;
}
AVSINLINE double Pt_To_Dx (const double &dValue)
{
return dValue * 20;
}
AVSINLINE double Pt_To_Sx (const double &dValue)
{
return dValue * 2.54 * 100 * 1000 / 20;
}
AVSINLINE double Pt_To_Multi (const double &dValue)
{
return dValue * 20;
}
AVSINLINE double Pt_To_Emu (const double &dValue)
{
return dValue * 12700;
}
AVSINLINE double Px_To_Cm (const double &dValue)
{
return dValue * 2.54 * 3/ 72 / 4;
}
AVSINLINE double Px_To_Mm (const double &dValue)
{
return dValue * 2.54 * 10 * 3/ 72 /4;
}
AVSINLINE double Px_To_Pt (const double &dValue)
{
return dValue * 3 / 4;
}
AVSINLINE double Px_To_Inch (const double &dValue)
{
return dValue * 3 / 72 / 4;
}
AVSINLINE double Px_To_Dx (const double &dValue)
{
return dValue * 20 * 3 / 4;
}
AVSINLINE double Px_To_Sx (const double &dValue)
{
return dValue * 2.54 * 100 * 1000 * 3/ 20 / 4;
}
AVSINLINE double Px_To_Multi (const double &dValue)
{
return dValue * 20 * 3 / 4;
}
AVSINLINE double Px_To_Emu (const double &dValue)
{
return dValue * 9525;
}
AVSINLINE double Inch_To_Cm (const double &dValue)
{
return dValue * 2.54;
}
AVSINLINE double Inch_To_Mm (const double &dValue)
{
return dValue * 2.54 * 10;
}
AVSINLINE double Inch_To_Pt (const double &dValue)
{
return dValue * 72;
}
AVSINLINE double Inch_To_Px (const double &dValue)
{
return dValue * 72 * 4 / 3;
}
AVSINLINE double Inch_To_Dx (const double &dValue)
{
return dValue * 72 * 20;
}
AVSINLINE double Inch_To_Sx (const double &dValue)
{
return dValue * 1000 * 100 * 2.54 * 72 / 20;
}
AVSINLINE double Inch_To_Multi(const double &dValue)
{
return dValue * 72 * 20;
}
AVSINLINE double Inch_To_Emu (const double &dValue)
{
return dValue * 914400;
}
AVSINLINE double Dx_To_Cm (const double &dValue)
{
return dValue * 2.54 / 72 / 20;
}
AVSINLINE double Dx_To_Mm (const double &dValue)
{
return dValue * 2.54 * 10 / 72 / 20;
}
AVSINLINE double Dx_To_Pt (const double &dValue)
{
return dValue / 20;
}
AVSINLINE double Dx_To_Px (const double &dValue)
{
return dValue * 4 / 3 / 20;
}
AVSINLINE double Dx_To_Inch (const double &dValue)
{
return dValue / 20 / 72;
}
AVSINLINE double Dx_To_Sx (const double &dValue)
{
return dValue * 635;
}
AVSINLINE double Dx_To_Multi (const double &dValue)
{
return dValue;
}
AVSINLINE double Dx_To_Emu (const double &dValue)
{
return dValue * 635;
}
AVSINLINE double Sx_To_Cm (const double &dValue)
{
return dValue * 20 / 72 / 100 / 1000;
}
AVSINLINE double Sx_To_Mm (const double &dValue)
{
return dValue * 20 / 72 / 100 / 1000 * 10;
}
AVSINLINE double Sx_To_Pt (const double &dValue)
{
return dValue * 20 / 100 / 1000 / 2.54;
}
AVSINLINE double Sx_To_Px (const double &dValue)
{
return dValue * 20 * 4 / 3 / 100 / 1000 / 2.54;
}
AVSINLINE double Sx_To_Inch (const double &dValue)
{
return dValue * 20 / 2.54 / 72 / 100 / 1000;
}
AVSINLINE double Sx_To_Dx (const double &dValue)
{
return dValue * 20 * 20 / 2.54 / 100 / 1000;
}
AVSINLINE double Sx_To_Multi (const double &dValue)
{
return dValue * 20 * 20 / 2.54 / 100 / 1000;
}
AVSINLINE double Sx_To_Emu (const double &dValue)
{
return dValue;
}
AVSINLINE double Multi_To_Cm (const double &dValue)
{
return dValue * 2.54 / 72 / 20;
}
AVSINLINE double Multi_To_Mm (const double &dValue)
{
return dValue * 2.54 * 10 / 72 / 20;
}
AVSINLINE double Multi_To_Pt (const double &dValue)
{
return dValue / 20;
}
AVSINLINE double Multi_To_Px (const double &dValue)
{
return dValue * 4 / 3 / 20;
}
AVSINLINE double Multi_To_Inch(const double &dValue)
{
return dValue / 20 / 72;
}
AVSINLINE double Multi_To_Sx (const double &dValue)
{
return dValue * 635;
}
AVSINLINE double Multi_To_Dx (const double &dValue)
{
return dValue;
}
AVSINLINE double Multi_To_Emu (const double &dValue)
{
return dValue * 635;
}
AVSINLINE double Emu_To_Cm (const double &dValue)
{
return dValue / 360000;
}
AVSINLINE double Emu_To_Mm (const double &dValue)
{
return dValue / 36000;
}
AVSINLINE double Emu_To_Pt (const double &dValue)
{
return dValue / 12700;
}
AVSINLINE double Emu_To_Px (const double &dValue)
{
return dValue / 9525;
}
AVSINLINE double Emu_To_Inch (const double &dValue)
{
return dValue / 914400;
}
AVSINLINE double Emu_To_Sx (const double &dValue)
{
return dValue;
}
AVSINLINE double Emu_To_Dx (const double &dValue)
{
return dValue / 635;
}
AVSINLINE double Emu_To_Multi (const double &dValue)
{
return dValue / 635;
}
#endif // _UNIT_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
*
*/
#include "Utils.h"
#include "../XML/XmlUtils.h"
void Common::readAllShapeTypes(const OOX::CPath& oPath, CSimpleArray<CString>& aShapetypes)
{
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oPath.GetPath() ) )
return;
while ( FALSE != oReader.ReadNextNode() )
{
CString sName = oReader.GetName();
if(_T("v:shapetype") == sName)
{
CString sXml = oReader.GetOuterXml();
if(false == sXml.IsEmpty())
aShapetypes.Add(sXml);
}
}
}

View File

@@ -0,0 +1,43 @@
/*
* (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 COMMON_UTILS_INCLUDE_H_
#define COMMON_UTILS_INCLUDE_H_
#include "..\SystemUtility\SystemUtility.h"
namespace Common
{
void readAllShapeTypes(const OOX::CPath& oPath, CSimpleArray<CString>& aShapetypes);
}
#endif // COMMON_UTILS_INCLUDE_H_

View File

@@ -0,0 +1,133 @@
/*
* (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 "Wrap.h"
namespace Common
{
Wrap::Wrap()
: m_type(square)
{
}
const Wrap::Type Wrap::type() const
{
return m_type;
}
const Wrap Wrap::Square()
{
return Wrap(square);
}
const Wrap Wrap::Tight()
{
return Wrap(tight);
}
const Wrap Wrap::TopAndBottom()
{
return Wrap(topAndBottom);
}
const Wrap Wrap::None()
{
return Wrap(none);
}
const bool Wrap::isSquare() const
{
return m_type == square;
}
const bool Wrap::isTight() const
{
return m_type == tight;
}
const bool Wrap::isTopAndBottom() const
{
return m_type == topAndBottom;
}
const bool Wrap::isNone() const
{
return m_type == none;
}
void Wrap::setSquare()
{
m_type = square;
}
void Wrap::setTight()
{
m_type = tight;
}
void Wrap::setTopAndBottom()
{
m_type = topAndBottom;
}
void Wrap::setNone()
{
m_type = none;
}
Wrap::Wrap(const Wrap::Type type)
: m_type(type)
{
}
void Wrap::fromBase(const Wrap& wrap)
{
m_type = wrap.m_type;
}
} // namespace Common

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 COMMON_WRAP_INCLUDE_H_
#define COMMON_WRAP_INCLUDE_H_
namespace Common
{
class Wrap
{
public:
Wrap();
enum Type
{
square,
tight,
topAndBottom,
none
};
public:
const Type type() const;
public:
static const Wrap Square();
static const Wrap Tight();
static const Wrap TopAndBottom();
static const Wrap None();
public:
const bool isSquare() const;
const bool isTight() const;
const bool isTopAndBottom() const;
const bool isNone() const;
public:
void setSquare();
void setTight();
void setTopAndBottom();
void setNone();
protected:
Type m_type;
protected:
Wrap(const Type type);
void fromBase(const Wrap& wrap);
};
}
#endif // COMMON_WRAP_INCLUDE_H_

View File

@@ -0,0 +1,55 @@
/*
* (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 "ZIndex.h"
namespace Common
{
ZIndex::ZIndex()
: Index(0)
{
}
ZIndex::ZIndex(const int& index)
: Index(index)
{
}
void ZIndex::fromBase(const ZIndex& zIndex)
{
Index = zIndex.Index;
}
} // namespace Common

View File

@@ -0,0 +1,52 @@
/*
* (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 COMMON_Z_INDEX_INCLUDE_H_
#define COMMON_Z_INDEX_INCLUDE_H_
namespace Common
{
class ZIndex
{
public:
ZIndex();
ZIndex(const int& index);
public:
int Index;
protected:
void fromBase(const ZIndex& zIndex);
};
}
#endif // COMMON_Z_INDEX_INCLUDE_H_

View File

@@ -0,0 +1,466 @@
/*
* (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_APP_INCLUDE_H_
#define OOX_APP_INCLUDE_H_
#include "File.h"
#include "../Base/Nullable.h"
#include "../Common/SimpleTypes_Word.h"
#include "../Common/SimpleTypes_Shared.h"
namespace OOX
{
class CApp : public OOX::File
{
public:
CApp()
{
}
CApp(const CPath& oPath)
{
read( oPath );
}
virtual ~CApp()
{
}
public:
virtual void read(const CPath& oPath)
{
XmlUtils::CXmlNode oProperties;
oProperties.FromXmlFile( oPath.GetPath(), true );
if ( _T("Properties") == oProperties.GetName() )
{
XmlUtils::CXmlNode oItem;
if ( oProperties.GetNode( _T("Application"), oItem ) )
m_sApplication = oItem.GetText();
if ( oProperties.GetNode( _T("AppVersion"), oItem ) )
m_sAppVersion = oItem.GetText();
if ( oProperties.GetNode( _T("Characters"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nCharacters = oNum.GetValue();
}
if ( oProperties.GetNode( _T("CharactersWithSpaces"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nCharactersWithSpaces = oNum.GetValue();
}
if ( oProperties.GetNode( _T("Company"), oItem ) )
m_sCompany = oItem.GetText();
if ( oProperties.GetNode( _T("DocSecurity"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nDocSecurity = oNum.GetValue();
}
if ( oProperties.GetNode( _T("HiddenSlides"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nHiddenSlides = oNum.GetValue();
}
if ( oProperties.GetNode( _T("HyperlinkBase"), oItem ) )
m_sHyperlinkBase = oItem.GetText();
if ( oProperties.GetNode( _T("HyperlinksChanged"), oItem ) )
{
SimpleTypes::COnOff<> oBool = oItem.GetText();
m_bHyperlinksChanged = (oBool.GetValue() == SimpleTypes::onoffTrue);
}
if ( oProperties.GetNode( _T("Lines"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nLines = oNum.GetValue();
}
if ( oProperties.GetNode( _T("LinksUpToDate"), oItem ) )
{
SimpleTypes::COnOff<> oBool = oItem.GetText();
m_bLinksUpToDate = (oBool.GetValue() == SimpleTypes::onoffTrue);
}
if ( oProperties.GetNode( _T("Manager"), oItem ) )
m_sManager = oItem.GetText();
if ( oProperties.GetNode( _T("MMClips"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nMMClips = oNum.GetValue();
}
if ( oProperties.GetNode( _T("Notes"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nNotes = oNum.GetValue();
}
if ( oProperties.GetNode( _T("Pages"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nPages = oNum.GetValue();
}
if ( oProperties.GetNode( _T("Paragraphs"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nParagraphs = oNum.GetValue();
}
if ( oProperties.GetNode( _T("ScaleCrop"), oItem ) )
{
SimpleTypes::COnOff<> oBool = oItem.GetText();
m_bScaleCrop = (oBool.GetValue() == SimpleTypes::onoffTrue);
}
if ( oProperties.GetNode( _T("SharedDoc"), oItem ) )
{
SimpleTypes::COnOff<> oBool = oItem.GetText();
m_bSharedDoc = (oBool.GetValue() == SimpleTypes::onoffTrue);
}
if ( oProperties.GetNode( _T("Slides"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nSlides = oNum.GetValue();
}
if ( oProperties.GetNode( _T("Template"), oItem ) )
m_sTemplate = oItem.GetText();
if ( oProperties.GetNode( _T("TotalTime"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nTotalTime = oNum.GetValue();
}
if ( oProperties.GetNode( _T("Words"), oItem ) )
{
SimpleTypes::CDecimalNumber<> oNum = oItem.GetText();
m_nWords = oNum.GetValue();
}
}
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
CString sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Properties xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/extended-properties\" xmlns:vt=\"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes\">");
if ( m_sApplication.IsInit() )
{
sXml += _T("<Application>");
sXml += m_sApplication.get();
sXml += _T("</Application>");
}
if ( m_sAppVersion.IsInit() )
{
sXml += _T("<AppVersion>");
sXml += m_sAppVersion.get();
sXml += _T("</AppVersion>");
}
if ( m_nCharacters.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nCharacters.get() );
sXml += _T("<Characters>");
sXml += oNum.ToString();
sXml += _T("</Characters>");
}
if ( m_nCharactersWithSpaces.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nCharactersWithSpaces.get() );
sXml += _T("<CharactersWithSpaces>");
sXml += oNum.ToString();
sXml += _T("</CharactersWithSpaces>");
}
if ( m_sCompany.IsInit() )
{
sXml += _T("<Company>");
sXml += m_sCompany.get();
sXml += _T("</Company>");
}
if ( m_nDocSecurity.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nDocSecurity.get() );
sXml += _T("<DocSecurity>");
sXml += oNum.ToString();
sXml += _T("</DocSecurity>");
}
if ( m_nHiddenSlides.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nHiddenSlides.get() );
sXml += _T("<HiddenSlides>");
sXml += oNum.ToString();
sXml += _T("</HiddenSlides>");
}
if ( m_sHyperlinkBase.IsInit() )
{
sXml += _T("<HyperlinkBase>");
sXml += m_sHyperlinkBase.get();
sXml += _T("</HyperlinkBase>");
}
if ( m_bHyperlinksChanged.IsInit() )
{
SimpleTypes::COnOff<> oBool;
oBool.SetValue( m_bHyperlinksChanged.get() ? SimpleTypes::onoffTrue : SimpleTypes::onoffFalse );
sXml += _T("<HyperlinksChanged>");
sXml += oBool.ToString();
sXml += _T("</HyperlinksChanged>");
}
if ( m_nLines.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nLines.get() );
sXml += _T("<Lines>");
sXml += oNum.ToString();
sXml += _T("</Lines>");
}
if ( m_bLinksUpToDate.IsInit() )
{
SimpleTypes::COnOff<> oBool;
oBool.SetValue( m_bLinksUpToDate.get() ? SimpleTypes::onoffTrue : SimpleTypes::onoffFalse );
sXml += _T("<LinksUpToDate>");
sXml += oBool.ToString();
sXml += _T("</LinksUpToDate>");
}
if ( m_sManager.IsInit() )
{
sXml += _T("<Manager>");
sXml += m_sManager.get();
sXml += _T("</Manager>");
}
if ( m_nMMClips.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nMMClips.get() );
sXml += _T("<MMClips>");
sXml += oNum.ToString();
sXml += _T("</MMClips>");
}
if ( m_nNotes.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nNotes.get() );
sXml += _T("<Notes>");
sXml += oNum.ToString();
sXml += _T("</Notes>");
}
if ( m_nPages.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nPages.get() );
sXml += _T("<Pages>");
sXml += oNum.ToString();
sXml += _T("</Pages>");
}
if ( m_nParagraphs.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nParagraphs.get() );
sXml += _T("<Paragraphs>");
sXml += oNum.ToString();
sXml += _T("</Paragraphs>");
}
if ( m_bScaleCrop.IsInit() )
{
SimpleTypes::COnOff<> oBool;
oBool.SetValue( m_bScaleCrop.get() ? SimpleTypes::onoffTrue : SimpleTypes::onoffFalse );
sXml += _T("<ScaleCrop>");
sXml += oBool.ToString();
sXml += _T("</ScaleCrop>");
}
if ( m_bSharedDoc.IsInit() )
{
SimpleTypes::COnOff<> oBool;
oBool.SetValue( m_bSharedDoc.get() ? SimpleTypes::onoffTrue : SimpleTypes::onoffFalse );
sXml += _T("<SharedDoc>");
sXml += oBool.ToString();
sXml += _T("</SharedDoc>");
}
if ( m_nSlides.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nSlides.get() );
sXml += _T("<Slides>");
sXml += oNum.ToString();
sXml += _T("</Slides>");
}
if ( m_sTemplate.IsInit() )
{
sXml += _T("<Template>");
sXml += m_sTemplate.get();
sXml += _T("</Template>");
}
if ( m_nTotalTime.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nTotalTime.get() );
sXml += _T("<TotalTime>");
sXml += oNum.ToString();
sXml += _T("</TotalTime>");
}
if ( m_nWords.IsInit() )
{
SimpleTypes::CDecimalNumber<> oNum;
oNum.SetValue( m_nWords.get() );
sXml += _T("<Words>");
sXml += oNum.ToString();
sXml += _T("</Words>");
}
sXml += _T("</Properties>");
CDirectory::SaveToFile( oPath.GetPath(), sXml );
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::App;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
void SetDocSecurity(int nVal)
{
m_nDocSecurity = nVal;
}
void SetScaleCrop(bool bVal)
{
m_bScaleCrop = bVal;
}
void SetCompany(CString sVal)
{
m_sCompany = sVal;
}
void SetLinksUpToDate(bool bVal)
{
m_bLinksUpToDate = bVal;
}
void SetSharedDoc(bool bVal)
{
m_bSharedDoc = bVal;
}
void SetHyperlinksChanged(bool bVal)
{
m_bHyperlinksChanged = bVal;
}
private:
nullable<CString> m_sApplication;
nullable<CString> m_sAppVersion;
nullable<int> m_nCharacters;
nullable<int> m_nCharactersWithSpaces;
nullable<CString> m_sCompany;
nullable<int> m_nDocSecurity;
nullable<int> m_nHiddenSlides;
nullable<CString> m_sHyperlinkBase;
nullable<bool> m_bHyperlinksChanged;
nullable<int> m_nLines;
nullable<bool> m_bLinksUpToDate;
nullable<CString> m_sManager;
nullable<int> m_nMMClips;
nullable<int> m_nNotes;
nullable<int> m_nPages;
nullable<int> m_nParagraphs;
nullable<CString> m_sPresentationForm;
nullable<bool> m_bScaleCrop;
nullable<bool> m_bSharedDoc;
nullable<int> m_nSlides;
nullable<CString> m_sTemplate;
nullable<int> m_nTotalTime;
nullable<int> m_nWords;
};
}
#endif // OOX_APP_INCLUDE_H_

View File

@@ -0,0 +1,154 @@
/*
* (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_BIBLIOGRAPHY_INCLUDE_H_
#define OOX_BIBLIOGRAPHY_INCLUDE_H_
#include "../Base/Nullable.h"
#include "WritingElement.h"
#include "File.h"
namespace OOX
{
class CBibliography : public OOX::File
{
public:
CBibliography()
{
}
CBibliography(const CPath& oPath)
{
read( oPath );
}
virtual ~CBibliography()
{
}
public:
virtual void read(const CPath& oFilePath)
{
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oFilePath.GetPath() ) )
return;
if ( !oReader.ReadNextNode() )
return;
CWCharWrapper sName = oReader.GetName();
if ( _T("b:Sources") == sName && !oReader.IsEmptyNode() )
{
ReadAttributes( oReader );
}
}
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
CString sXml;
sXml = _T("<b:Sources");
if ( m_sSelectedStyle.IsInit() )
{
sXml += _T(" SelectedStyle=\"");
sXml += m_sSelectedStyle->GetString();
sXml += _T("\"");
}
if ( m_sStyleName.IsInit() )
{
sXml += _T(" StyleName=\"");
sXml += m_sStyleName->GetString();
sXml += _T("\"");
}
if ( m_sURI.IsInit() )
{
sXml += _T(" URI=\"");
sXml += m_sURI->GetString();
sXml += _T("\"");
}
sXml += _T(" xmlns:b=\"http://schemas.openxmlformats.org/officeDocument/2006/bibliography\" xmlns=\"http://schemas.openxmlformats.org/officeDocument/2006/bibliography\">");
sXml += _T("</a:Sources>");
CDirectory::SaveToFile( oFilePath.GetPath(), sXml );
oContent.Registration( type().OverrideType(), oDirectory, oFilePath );
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::Bibliography;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("SelectedStyle"), m_sSelectedStyle )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("StyleName"), m_sStyleName )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("URI"), m_sURI )
WritingElement_ReadAttributes_End( oReader )
}
private:
nullable<CString> m_sSelectedStyle;
nullable<CString> m_sStyleName;
nullable<CString> m_sURI;
};
}
#endif // OOX_BIBLIOGRAPHY_INCLUDE_H_

View File

@@ -0,0 +1,658 @@
/*
* (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_COMMENTS_FILE_INCLUDE_H_
#define OOX_COMMENTS_FILE_INCLUDE_H_
#include "File.h"
#include "../Base/Nullable.h"
#include "WritingElement.h"
#include "Logic/Annotations.h"
#include "Logic/Paragraph.h"
#include "Logic/Sdt.h"
#include "Logic/Table.h"
#include "Math/oMathPara.h"
#include "Math/oMath.h"
namespace OOX
{
class CComment : public WritingElement
{
public:
WritingElement_AdditionConstructors(CComment)
CComment()
{
}
virtual ~CComment()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CString sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bookmarkEnd") == sName )
pItem = new Logic::CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new Logic::CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new Logic::CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new Logic::CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new Logic::CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new Logic::CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new Logic::CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new Logic::CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new Logic::CDel( oReader );
else if ( _T("w:ins") == sName )
pItem = new Logic::CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new Logic::COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new Logic::COMathPara( oReader );
else if ( _T("w:p") == sName )
pItem = new Logic::CParagraph( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new Logic::CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new Logic::CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new Logic::CProofErr( oReader );
else if ( _T("w:sdt") == sName )
pItem = new Logic::CSdt( oReader );
else if ( _T("w:tbl") == sName )
pItem = new Logic::CTbl( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
virtual CString toXML() const
{
CString sResult = _T("");
return sResult;
}
virtual EElementType getType() const
{
return et_w_comment;
}
CString getText() const
{
bool bFirstPar = true;
CString sRes = getTextArr(m_arrItems, bFirstPar);
return sRes;
}
private:
CString getTextArr(const CSimpleArray<WritingElement* >& arrItems, bool& bFirstPar) const
{
CString sRes;
for(int i = 0, length = arrItems.GetSize(); i < length; ++i)
{
WritingElement* item = arrItems[i];
switch(item->getType())
{
case OOX::et_w_sdt:
{
OOX::Logic::CSdt* pStd = static_cast<OOX::Logic::CSdt*>(item);
if(pStd->m_oSdtContent.IsInit())
sRes += getTextArr(pStd->m_oSdtContent->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_smartTag:
{
OOX::Logic::CSmartTag* pSmartTag = static_cast<OOX::Logic::CSmartTag*>(item);
sRes += getTextArr(pSmartTag->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_dir:
{
OOX::Logic::CDir* pDir = static_cast<OOX::Logic::CDir*>(item);
sRes += getTextArr(pDir->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_bdo:
{
OOX::Logic::CBdo* pBdo = static_cast<OOX::Logic::CBdo*>(item);
sRes += getTextArr(pBdo->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_tbl:
{
OOX::Logic::CTbl* pTbl = static_cast<OOX::Logic::CTbl*>(item);
sRes += getTextArr(pTbl->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_tr:
{
OOX::Logic::CTr* pTr = static_cast<OOX::Logic::CTr*>(item);
sRes += getTextArr(pTr->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_tc:
{
OOX::Logic::CTc* pTc = static_cast<OOX::Logic::CTc*>(item);
sRes += getTextArr(pTc->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_hyperlink:
{
OOX::Logic::CHyperlink* pHyperlink = static_cast<OOX::Logic::CHyperlink*>(item);
sRes += getTextArr(pHyperlink->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_p:
{
if(bFirstPar)
bFirstPar = false;
else
sRes += "\n";
OOX::Logic::CParagraph* pParagraph = static_cast<OOX::Logic::CParagraph*>(item);
sRes += getTextArr(pParagraph->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_r:
{
OOX::Logic::CRun* pRun = static_cast<OOX::Logic::CRun*>(item);
sRes += getTextArr(pRun->m_arrItems, bFirstPar);
}
break;
case OOX::et_w_br:
sRes += "\n";
break;
case OOX::et_w_nonBreakHyphen:
case OOX::et_w_softHyphen:
sRes += "-";
break;
case OOX::et_w_tab:
sRes += " ";
break;
case OOX::et_w_sym:
{
OOX::Logic::CSym* oSym = static_cast<OOX::Logic::CSym*>(item);
sRes.AppendChar(0x0FFF & oSym->m_oChar->GetValue());
}
break;
case OOX::et_w_t:
{
CString& sText = static_cast<OOX::Logic::CText*>(item)->m_sText;
if(!sText.IsEmpty())
{
sRes += sText;
}
}
break;
}
}
return sRes;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:author"), m_oAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:initials"), m_oInitials )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString > m_oAuthor;
nullable<SimpleTypes::CDateTime > m_oDate;
nullable<SimpleTypes::CDecimalNumber<> > m_oId;
nullable<CString > m_oInitials;
CSimpleArray<WritingElement* > m_arrItems;
};
class CComments : public OOX::File
{
public:
CComments()
{
}
CComments(const CPath& oPath)
{
read( oPath );
}
virtual ~CComments()
{
for(int i = 0, length = m_arrComments.GetSize(); i < length; ++i)
delete m_arrComments[i];
m_arrComments.RemoveAll();
}
public:
virtual void read(const CPath& oFilePath)
{
#ifdef USE_LITE_READER
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oFilePath.GetPath() ) )
return;
if ( !oReader.ReadNextNode() )
return;
CWCharWrapper sName = oReader.GetName();
if ( _T("w:comments") == sName && !oReader.IsEmptyNode() )
{
int nNumberingDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
{
sName = oReader.GetName();
if ( _T("w:comment") == sName )
m_arrComments.Add( new CComment(oReader) );
}
}
#endif
}
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::Comments;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
public:
CSimpleArray<CComment*> m_arrComments;
};
class CCommentExt : public WritingElement
{
public:
WritingElement_AdditionConstructors(CCommentExt)
CCommentExt()
{
}
virtual ~CCommentExt()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult = _T("");
return sResult;
}
virtual EElementType getType() const
{
return et_w15_commentEx;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w15:paraId"), m_oParaId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w15:paraIdParent"), m_oParaIdParent )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w15:done"), m_oDone )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CLongHexNumber<> > m_oParaId;
nullable<SimpleTypes::CLongHexNumber<> > m_oParaIdParent;
nullable<SimpleTypes::COnOff<> > m_oDone;
};
class CCommentsExt : public OOX::File
{
public:
CCommentsExt()
{
}
CCommentsExt(const CPath& oPath)
{
read( oPath );
}
virtual ~CCommentsExt()
{
for(int i = 0, length = m_arrComments.GetSize(); i < length; ++i)
delete m_arrComments[i];
m_arrComments.RemoveAll();
}
public:
virtual void read(const CPath& oFilePath)
{
#ifdef USE_LITE_READER
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oFilePath.GetPath() ) )
return;
if ( !oReader.ReadNextNode() )
return;
CWCharWrapper sName = oReader.GetName();
if ( _T("w15:commentsEx") == sName && !oReader.IsEmptyNode() )
{
int nNumberingDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
{
sName = oReader.GetName();
if ( _T("w15:commentEx") == sName )
m_arrComments.Add( new CCommentExt(oReader) );
}
}
#endif
}
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::CommentsExt;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
public:
CSimpleArray<CCommentExt*> m_arrComments;
};
class CPresenceInfo : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPresenceInfo)
CPresenceInfo()
{
}
virtual ~CPresenceInfo()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult = _T("");
return sResult;
}
virtual EElementType getType() const
{
return et_w15_presenceInfo;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w15:providerId"), m_oProviderId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w15:userId"), m_oUserId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString > m_oProviderId;
nullable<CString > m_oUserId;
};
class CPerson : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPerson)
CPerson()
{
}
virtual ~CPerson()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CString sName = oReader.GetName();
if ( _T("w15:presenceInfo") == sName )
m_oPresenceInfo = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("");
return sResult;
}
virtual EElementType getType() const
{
return et_w15_person;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w15:author"), m_oAuthor )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString > m_oAuthor;
nullable<CPresenceInfo> m_oPresenceInfo;
};
class CPeople : public OOX::File
{
public:
CPeople()
{
}
CPeople(const CPath& oPath)
{
read( oPath );
}
virtual ~CPeople()
{
for(int i = 0, length = m_arrPeoples.GetSize(); i < length; ++i)
delete m_arrPeoples[i];
m_arrPeoples.RemoveAll();
}
public:
virtual void read(const CPath& oFilePath)
{
#ifdef USE_LITE_READER
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oFilePath.GetPath() ) )
return;
if ( !oReader.ReadNextNode() )
return;
CWCharWrapper sName = oReader.GetName();
if ( _T("w15:people") == sName && !oReader.IsEmptyNode() )
{
int nNumberingDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
{
sName = oReader.GetName();
if ( _T("w15:person") == sName )
m_arrPeoples.Add( new CPerson(oReader) );
}
}
#endif
}
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::People;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
public:
CSimpleArray<CPerson*> m_arrPeoples;
};
}
#endif // OOX_COMMENTS_FILE_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
*
*/
#pragma once
#ifndef OOX_CONTENT_TYPES_INCLUDE_H_
#define OOX_CONTENT_TYPES_INCLUDE_H_
#include "../SystemUtility/SystemUtility.h"
#include "FileType.h"
#include "WritingElement.h"
namespace OOX
{
namespace ContentTypes
{
class CExtensionTable
{
public:
CExtensionTable()
{
m_mTable.SetAt( _T("bmp"), _T("image/bmp"));
m_mTable.SetAt( _T("gif"), _T("image/gif"));
m_mTable.SetAt( _T("png"), _T("image/png"));
m_mTable.SetAt( _T("tif"), _T("image/tiff"));
m_mTable.SetAt( _T("tiff"), _T("image/tiff"));
m_mTable.SetAt( _T("jpeg"), _T("image/jpeg"));
m_mTable.SetAt( _T("jpg"), _T("image/jpeg"));
m_mTable.SetAt( _T("jpe"), _T("image/jpeg"));
m_mTable.SetAt( _T("jfif"), _T("image/jpeg"));
m_mTable.SetAt( _T("rels"), _T("application/vnd.openxmlformats-package.relationships+xml"));
m_mTable.SetAt( _T("bin"), _T("application/vnd.openxmlformats-officedocument.oleObject"));
m_mTable.SetAt( _T("xml"), _T("application/xml"));
m_mTable.SetAt( _T("emf"), _T("image/x-emf"));
m_mTable.SetAt( _T("emz"), _T("image/x-emz"));
m_mTable.SetAt( _T("wmf"), _T("image/x-wmf"));
m_mTable.SetAt( _T("svm"), _T("image/svm"));
m_mTable.SetAt( _T("wav"), _T("audio/wav"));
m_mTable.SetAt( _T("xls"), _T("application/vnd.ms-excel"));
m_mTable.SetAt( _T("xlsm"), _T("application/vnd.ms-excel.sheet.macroEnabled.12"));
m_mTable.SetAt( _T("xlsb"), _T("application/vnd.ms-excel.sheet.binary.macroEnabled.12"));
m_mTable.SetAt( _T("xlsx"), _T("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"));
m_mTable.SetAt( _T("ppt"), _T("application/vnd.ms-powerpoint"));
m_mTable.SetAt( _T("pptm"), _T("application/vnd.ms-powerpoint.presentation.macroEnabled.12"));
m_mTable.SetAt( _T("pptx"), _T("application/vnd.openxmlformats-officedocument.presentationml.presentation"));
m_mTable.SetAt( _T("sldm"), _T("application/vnd.ms-powerpoint.slide.macroEnabled.12"));
m_mTable.SetAt( _T("sldx"), _T("application/vnd.openxmlformats-officedocument.presentationml.slide"));
m_mTable.SetAt( _T("doc"), _T("application/msword"));
m_mTable.SetAt( _T("docm"), _T("aapplication/vnd.ms-word.document.macroEnabled.12"));
m_mTable.SetAt( _T("docx"), _T("application/vnd.openxmlformats-officedocument.wordprocessingml.document"));
m_mTable.SetAt( _T("vml"), _T("application/vnd.openxmlformats-officedocument.vmlDrawing"));
}
const CString operator[] (const CString& sExtension) const
{
const CAtlMap<CString, CString>::CPair* pPair = m_mTable.Lookup( sExtension );
if ( NULL == pPair )
return _T("");
return pPair->m_value;
}
private:
CAtlMap<CString, CString> m_mTable;
};
class CDefault : public WritingElement
{
public:
WritingElement_AdditionConstructors(CDefault)
CDefault()
{
m_sExtension = _T("");
}
CDefault(const CString& sExtension) : m_sExtension(sExtension)
{
}
virtual ~CDefault()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_sExtension = oNode.GetAttribute(_T("Extension"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
static const CExtensionTable oTable;
XmlUtils::CAttribute oAttr;
oAttr.Write( _T("Extension"), m_sExtension );
oAttr.Write( _T("ContentType"), oTable[m_sExtension] );
return XmlUtils::CreateNode(_T("Default"), oAttr );
}
virtual EElementType getType() const
{
return et_Default;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("Extension"), m_sExtension )
WritingElement_ReadAttributes_End( oReader )
}
public:
const bool operator ==(const CString& rhs) const
{
return m_sExtension == rhs;
}
private:
CString m_sExtension;
};
class COverride : public WritingElement
{
public:
WritingElement_AdditionConstructors(COverride)
COverride()
{
}
COverride(const CString& sType, const CPath& oPath) : m_sType(sType), m_oPart(oPath)
{
}
virtual ~COverride()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_oPart = oNode.GetAttribute(_T("PartName"));
m_sType = oNode.GetAttribute(_T("ContentType"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
XmlUtils::CAttribute oAttr;
CString sPartName = m_oPart.m_strFilename;
sPartName.Replace(_T("\\"), _T("/"));
oAttr.Write( _T("PartName"), _T("/") + sPartName);
oAttr.Write( _T("ContentType"), m_sType );
return XmlUtils::CreateNode(_T("Override"), oAttr);
}
virtual EElementType getType() const
{
return et_Override;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("PartName"), m_oPart )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("ContentType"), m_sType )
WritingElement_ReadAttributes_End( oReader )
}
public:
AVSINLINE const CString type() const
{
return m_sType;
}
AVSINLINE const OOX::CPath filename() const
{
return m_oPart;
}
private:
CString m_sType;
OOX::CPath m_oPart;
};
}
}
namespace OOX
{
static const CPath c_oContentTypeFileName = L"[Content_Types].xml";
class CContentTypes
{
public:
CContentTypes()
{
AddDefault(OOX::CPath(_T(".rels")));
AddDefault(OOX::CPath(_T(".bmp")));
AddDefault(OOX::CPath(_T(".jpg")));
AddDefault(OOX::CPath(_T(".jpeg")));
AddDefault(OOX::CPath(_T(".jpe")));
AddDefault(OOX::CPath(_T(".png")));
AddDefault(OOX::CPath(_T(".gif")));
AddDefault(OOX::CPath(_T(".emf")));
AddDefault(OOX::CPath(_T(".wmf")));
AddDefault(OOX::CPath(_T(".jpeg")));
}
CContentTypes(const CPath& oPath)
{
Read( oPath );
}
~CContentTypes()
{
}
public:
BOOL Read (const CPath& oDirPath)
{
OOX::CPath oFullPath = oDirPath / c_oContentTypeFileName;
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oFullPath.m_strFilename ) )
return FALSE;
return ReadFromReader(oReader);
}
BOOL ReadFromString (CString& sXml)
{
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromString( sXml ) )
return FALSE;
return ReadFromReader(oReader);
}
BOOL Write(const CPath& oDirPath) const
{
CString sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">");
for ( int nIndex = 0; nIndex < m_arrDefault.GetSize(); nIndex++ )
sXml += m_arrDefault[nIndex].toXML();
POSITION pos = m_arrOverride.GetStartPosition();
while ( NULL != pos )
{
const CAtlMap<CString, ContentTypes::COverride>::CPair* pPair = m_arrOverride.GetNext( pos );
sXml += pPair->m_value.toXML();
}
sXml += _T("</Types>");
OOX::CPath oFullPath = oDirPath / c_oContentTypeFileName;
XmlUtils::SaveToFile( oFullPath.m_strFilename, sXml );
return TRUE;
}
public:
void Registration(const CString& sType, const CPath& oDirectory, const CPath& oFilename)
{
const OOX::CPath oFullPath = oDirectory / oFilename;
AddOverride( sType, oFullPath.m_strFilename );
AddDefault ( oFullPath );
}
void AddDefault(const OOX::CPath& oPath)
{
CString sExt = oPath.GetExtention();
const CString sExtension = sExt.Mid( 1 );
size_t nCount = m_arrDefault.GetSize();
size_t nIndex = 0;
while ( nIndex < nCount )
{
if ( m_arrDefault[(int) nIndex] == sExtension )
break;
++nIndex;
}
if ( nIndex == nCount )
m_arrDefault.Add( ContentTypes::CDefault( sExtension ) );
}
private:
BOOL ReadFromReader (XmlUtils::CXmlLiteReader& oReader)
{
CWCharWrapper sName;
if ( !oReader.ReadNextNode() || _T("Types") != ( sName = oReader.GetName() ) || oReader.IsEmptyNode() )
return FALSE;
int nTypesDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nTypesDepth ) )
{
sName = oReader.GetName();
if ( _T("Default") == sName )
{
ContentTypes::CDefault oDefault = oReader;
m_arrDefault.Add( oDefault );
}
else if ( _T("Override") == sName )
{
ContentTypes::COverride oOverride = oReader;
m_arrOverride.SetAt( oOverride.filename().GetPath(), oOverride );
}
}
return TRUE;
}
void AddOverride(const CString& sType, const CString& sPath)
{
ContentTypes::COverride oOverride( sType, sPath );
m_arrOverride.SetAt( oOverride.filename().GetPath(), oOverride );
}
public:
CSimpleArray<ContentTypes::CDefault> m_arrDefault;
CAtlMap<CString, ContentTypes::COverride> m_arrOverride;
};
}
#endif // OOX_CONTENT_TYPES_INCLUDE_H_

View File

@@ -0,0 +1,270 @@
/*
* (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_CORE_INCLUDE_H_
#define OOX_CORE_INCLUDE_H_
#include "File.h"
#include "../Base/Nullable.h"
namespace OOX
{
class CCore : public OOX::File
{
public:
CCore()
{
}
CCore(const CPath& oPath)
{
read( oPath );
}
virtual ~CCore()
{
}
public:
virtual void read(const CPath& oPath)
{
XmlUtils::CXmlNode oProperties;
oProperties.FromXmlFile( oPath.GetPath(), true );
if ( _T("cp:coreProperties") == oProperties.GetName() )
{
XmlUtils::CXmlNode oItem;
if ( oProperties.GetNode( _T("cp:category"), oItem ) )
m_sCategory = oItem.GetText();
if ( oProperties.GetNode( _T("cp:contentStatus"), oItem ) )
m_sContentStatus = oItem.GetText();
if ( oProperties.GetNode( _T("dcterms:created"), oItem ) )
m_sCreated = oItem.GetText();
if ( oProperties.GetNode( _T("dc:creator"), oItem ) )
m_sCreator = oItem.GetText();
if ( oProperties.GetNode( _T("dc:description"), oItem ) )
m_sDescription = oItem.GetText();
if ( oProperties.GetNode( _T("dc:identifier"), oItem ) )
m_sIdentifier = oItem.GetText();
if ( oProperties.GetNode( _T("cp:keywords"), oItem ) )
m_sKeywords = oItem.GetText();
if ( oProperties.GetNode( _T("dc:language"), oItem ) )
m_sLanguage = oItem.GetText();
if ( oProperties.GetNode( _T("cp:lastModifiedBy"), oItem ) )
m_sLastModifiedBy = oItem.GetText();
if ( oProperties.GetNode( _T("cp:lastPrinted"), oItem ) )
m_sLastPrinted = oItem.GetText();
if ( oProperties.GetNode( _T("dcterms:modified"), oItem ) )
m_sModified = oItem.GetText();
if ( oProperties.GetNode( _T("cp:revision"), oItem ) )
m_sRevision = oItem.GetText();
if ( oProperties.GetNode( _T("dc:subject"), oItem ) )
m_sSubject = oItem.GetText();
if ( oProperties.GetNode( _T("dc:title"), oItem ) )
m_sTitle = oItem.GetText();
if ( oProperties.GetNode( _T("cp:version"), oItem ) )
m_sVersion = oItem.GetText();
}
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
CString sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><cp:coreProperties xmlns:cp=\"http://schemas.openxmlformats.org/package/2006/metadata/core-properties\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\" xmlns:dcterms=\"http://purl.org/dc/terms/\" xmlns:dcmitype=\"http://purl.org/dc/dcmitype/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">");
if ( m_sCategory.IsInit() )
{
sXml += _T("<cp:category>");
sXml += m_sCategory.get();
sXml += _T("</cp:category>");
}
if ( m_sContentStatus.IsInit() )
{
sXml += _T("<cp:contentStatus>");
sXml += m_sContentStatus.get();
sXml += _T("</cp:contentStatus>");
}
if ( m_sCreated.IsInit() )
{
sXml += _T("<dcterms:created xsi:type=\"dcterms:W3CDTF\">");
sXml += m_sCreated.get();
sXml += _T("</dcterms:created>");
}
if ( m_sCreator.IsInit() )
{
sXml += _T("<dc:creator>");
sXml += m_sCreator.get();
sXml += _T("</dc:creator>");
}
if ( m_sDescription.IsInit() )
{
sXml += _T("<dc:description>");
sXml += m_sDescription.get();
sXml += _T("</dc:description>");
}
if ( m_sIdentifier.IsInit() )
{
sXml += _T("<dc:identifier>");
sXml += m_sIdentifier.get();
sXml += _T("</dc:identifier>");
}
if ( m_sKeywords.IsInit() )
{
sXml += _T("<cp:keywords>");
sXml += m_sKeywords.get();
sXml += _T("</cp:keywords>");
}
if ( m_sLanguage.IsInit() )
{
sXml += _T("<dc:language>");
sXml += m_sLanguage.get();
sXml += _T("</dc:language>");
}
if ( m_sLastModifiedBy.IsInit() )
{
sXml += _T("<cp:lastModifiedBy>");
sXml += m_sLastModifiedBy.get();
sXml += _T("</cp:lastModifiedBy>");
}
if ( m_sLastPrinted.IsInit() )
{
sXml += _T("<cp:lastPrinted>");
sXml += m_sLastPrinted.get();
sXml += _T("</cp:lastPrinted>");
}
if ( m_sModified.IsInit() )
{
sXml += _T("<dcterms:modified xsi:type=\"dcterms:W3CDTF\">");
sXml += m_sModified.get();
sXml += _T("</dcterms:modified>");
}
if ( m_sRevision.IsInit() )
{
sXml += _T("<cp:revision>");
sXml += m_sRevision.get();
sXml += _T("</cp:revision>");
}
if ( m_sSubject.IsInit() )
{
sXml += _T("<dc:subject>");
sXml += m_sSubject.get();
sXml += _T("</dc:subject>");
}
if ( m_sTitle.IsInit() )
{
sXml += _T("<dc:title>");
sXml += m_sTitle.get();
sXml += _T("</dc:title>");
}
if ( m_sVersion.IsInit() )
{
sXml += _T("<cp:version>");
sXml += m_sVersion.get();
sXml += _T("</cp:version>");
}
sXml += _T("</cp:coreProperties>");
CDirectory::SaveToFile( oPath.GetPath(), sXml );
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
}
public:
virtual const FileType type() const
{
return FileTypes::Core;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
void SetCreator(CString sVal)
{
m_sCreator = sVal;
}
void SetLastModifiedBy(CString sVal)
{
m_sLastModifiedBy = sVal;
}
private:
nullable<CString> m_sCategory;
nullable<CString> m_sContentStatus;
nullable<CString> m_sCreated;
nullable<CString> m_sCreator;
nullable<CString> m_sDescription;
nullable<CString> m_sIdentifier;
nullable<CString> m_sKeywords;
nullable<CString> m_sLanguage;
nullable<CString> m_sLastModifiedBy;
nullable<CString> m_sLastPrinted;
nullable<CString> m_sModified;
nullable<CString> m_sRevision;
nullable<CString> m_sSubject;
nullable<CString> m_sTitle;
nullable<CString> m_sVersion;
};
}
#endif // OOX_CORE_INCLUDE_H_

View File

@@ -0,0 +1,222 @@
/*
* (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_CUSTOM_XML_INCLUDE_H_
#define OOX_CUSTOM_XML_INCLUDE_H_
#include "File.h"
#include "WritingElement.h"
#include "../Common/SimpleTypes_Shared.h"
namespace OOX
{
class CCustomXML : public OOX::File
{
public:
class CShemaRef : public WritingElement
{
public:
CShemaRef()
{
}
CShemaRef(const XmlUtils::CXmlNode& oNode)
{
fromXML( (XmlUtils::CXmlNode&)oNode );
}
virtual ~CShemaRef()
{
}
public:
const CShemaRef& operator =(const XmlUtils::CXmlNode& oNode)
{
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("ds:uri"), m_sUri );
}
virtual CString toXML() const
{
CString sResult;
sResult.Format( _T("<ds:schemaRef ds:uri=\"%s\" />"), m_sUri );
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_ds_schemaRef;
}
public:
CString m_sUri;
};
class CShemaRefs : public WritingElement
{
public:
CShemaRefs()
{
}
CShemaRefs(const XmlUtils::CXmlNode& oNode)
{
fromXML( (XmlUtils::CXmlNode&)oNode );
}
virtual ~CShemaRefs()
{
}
public:
const CShemaRefs& operator =(const XmlUtils::CXmlNode& oNode)
{
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNodes oNodes;
if ( oNode.GetNodes( _T("ds:schemaRef"), oNodes ) )
{
XmlUtils::CXmlNode oItem;
for ( int nIndex = 0; nIndex < oNodes.GetCount(); nIndex++ )
{
if ( oNodes.GetAt( nIndex, oItem ) )
{
CShemaRef oShemeRef = oItem;
m_arrShemeRef.Add( oShemeRef );
}
}
}
}
virtual CString toXML() const
{
CString sResult = _T("<ds:schemaRefs>");
for ( int nIndex = 0; nIndex < m_arrShemeRef.GetSize(); nIndex++ )
sResult += m_arrShemeRef[nIndex].toXML();
sResult += _T("</ds:schemaRefs>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_ds_schemaRefs;
}
public:
CSimpleArray<CShemaRef> m_arrShemeRef;
};
public:
CCustomXML()
{
}
CCustomXML(const CPath& oFilePath)
{
read( oFilePath );
}
virtual ~CCustomXML()
{
}
public:
virtual void read(const CPath& oFilePath)
{
XmlUtils::CXmlNode oCustomXml;
oCustomXml.FromXmlFile( oFilePath.GetPath(), true );
if ( _T("ds:datastoreItem") == oCustomXml.GetName() )
{
oCustomXml.ReadAttributeBase( _T("ds:itemID"), m_oItemID );
XmlUtils::CXmlNode oItem;
if ( oCustomXml.GetNode( _T("ds:schemaRefs"), oItem ) )
m_oShemaRefs = oItem;
}
}
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
CString sXml;
sXml.Format( _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><ds:datastoreItem ds:itemID=\"%s\" xmlns:ds=\"http://schemas.openxmlformats.org/officeDocument/2006/customXml\">"), m_oItemID.ToString() );
if ( m_oShemaRefs.IsInit() )
sXml += m_oShemaRefs->toXML();
sXml += _T("</ds:datastoreItem>");
CDirectory::SaveToFile( oFilePath.GetPath(), sXml );
oContent.Registration( type().OverrideType(), oDirectory, oFilePath );
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::CustomXml;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
private:
SimpleTypes::CGuid m_oItemID;
nullable<CShemaRefs> m_oShemaRefs;
};
}
#endif // OOX_CUSTOM_XML_INCLUDE_H_

View File

@@ -0,0 +1,617 @@
/*
* (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_DOCUMENT_FILE_INCLUDE_H_
#define OOX_DOCUMENT_FILE_INCLUDE_H_
#include "../Base/Nullable.h"
#include "../Common/SimpleTypes_Word.h"
#include "../Common/SimpleTypes_Shared.h"
#include "../Common/Utils.h"
#include "WritingElement.h"
#include "File.h"
#include "FileTypes.h"
#include "IFileContainer.h"
#include "Logic/SectionProperty.h"
#include "Logic/Annotations.h"
#include "Logic/Paragraph.h"
#include "Logic/Sdt.h"
#include "Logic/Table.h"
#include "Math/oMathPara.h"
#include "Math/oMath.h"
#include "External/Hyperlink.h"
namespace OOX
{
namespace Logic
{
class CBackground : public WritingElement
{
public:
WritingElement_AdditionConstructors(CBackground)
CBackground()
{
}
virtual ~CBackground()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:color"), m_oColor );
oNode.ReadAttributeBase( _T("w:themeColor"), m_oThemeColor );
oNode.ReadAttributeBase( _T("w:themeShade"), m_oThemeShade );
oNode.ReadAttributeBase( _T("w:themeTint"), m_oThemeTint );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("w:drawing") == sName )
m_oDrawing = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<w:background ");
if ( m_oColor.IsInit() )
{
sResult += "w:color=\"";
sResult += m_oColor->ToString();
sResult += "\" ";
}
if ( m_oThemeColor.IsInit() )
{
sResult += "w:themeColor=\"";
sResult += m_oThemeColor->ToString();
sResult += "\" ";
}
if ( m_oThemeShade.IsInit() )
{
sResult += "w:themeShade=\"";
sResult += m_oThemeShade->ToString();
sResult += "\" ";
}
if ( m_oThemeTint.IsInit() )
{
sResult += "w:themeTint=\"";
sResult += m_oThemeTint->ToString();
sResult += "\" ";
}
if ( m_oDrawing.IsInit() )
{
sResult += _T(">");
sResult += m_oDrawing->toXML();
sResult += _T("</w:background>");
}
else
sResult += _T("/>");
return sResult;
}
virtual EElementType getType () const
{
return et_w_background;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:color"), m_oColor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:themeColor"), m_oThemeColor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:themeShade"), m_oThemeShade )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:themeTint"), m_oThemeTint )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CHexColor<> > m_oColor;
nullable<SimpleTypes::CThemeColor<> > m_oThemeColor;
nullable<SimpleTypes::CUcharHexNumber<> > m_oThemeShade;
nullable<SimpleTypes::CUcharHexNumber<> > m_oThemeTint;
nullable<OOX::Logic::CDrawing > m_oDrawing;
};
}
}
namespace OOX
{
class CDocument : public OOX::File, public IFileContainer
{
public:
CDocument()
{
}
CDocument(const CPath& oPath)
{
read( oPath );
}
virtual ~CDocument()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
virtual void read(const CPath& oPath)
{
m_oReadPath = oPath;
IFileContainer::Read( oPath );
#ifdef USE_LITE_READER
Common::readAllShapeTypes(oPath, m_arrShapeTypes);
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oPath.GetPath() ) )
return;
if ( !oReader.ReadNextNode() )
return;
CWCharWrapper sName = oReader.GetName();
if ( _T("w:document") == sName )
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
{
int nDocumentDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nDocumentDepth ) )
{
sName = oReader.GetName();
if ( _T("w:body") == sName && !oReader.IsEmptyNode() )
{
int nBodyDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nBodyDepth ) )
{
sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bookmarkEnd") == sName )
pItem = new Logic::CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new Logic::CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new Logic::CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new Logic::CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new Logic::CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new Logic::CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new Logic::CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new Logic::CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new Logic::CDel( oReader );
else if ( _T("w:ins") == sName )
pItem = new Logic::CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new Logic::COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new Logic::COMathPara( oReader );
else if ( _T("w:p") == sName )
pItem = new Logic::CParagraph( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new Logic::CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new Logic::CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new Logic::CProofErr( oReader );
else if ( _T("w:sdt") == sName )
pItem = new Logic::CSdt( oReader );
else if ( _T("w:sectPr") == sName )
m_oSectPr = oReader;
else if ( _T("w:tbl") == sName )
pItem = new Logic::CTbl( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
else if ( _T("w:background") == sName )
m_oBackground = oReader;
}
}
}
#else
XmlUtils::CXmlNode oDocument;
oDocument.FromXmlFile2( oPath.GetPath() );
if ( _T("w:document") == oDocument.GetName() )
{
oDocument.ReadAttributeBase( _T("w:conformance"), m_oConformance );
XmlUtils::CXmlNode oBackground;
if ( oDocument.GetNode( _T("w:background"), oBackground ) )
m_oBackground = oBackground;
XmlUtils::CXmlNode oBody;
if ( oDocument.GetNode( _T("w:body"), oBody ) )
{
XmlUtils::CXmlNodes oBodyChilds;
if ( oBody.GetNodes( _T("*"), oBodyChilds ) )
{
XmlUtils::CXmlNode oItem;
for ( int nIndex = 0; nIndex < oBodyChilds.GetCount(); nIndex++ )
{
if ( oBodyChilds.GetAt( nIndex, oItem ) )
{
CString sName = oItem.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bookmarkEnd") == sName )
pItem = new Logic::CBookmarkEnd( oItem );
else if ( _T("w:bookmarkStart") == sName )
pItem = new Logic::CBookmarkStart( oItem );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new Logic::CCommentRangeEnd( oItem );
else if ( _T("w:commentRangeStart") == sName )
pItem = new Logic::CCommentRangeStart( oItem );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new Logic::CCustomXmlDelRangeEnd( oItem );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new Logic::CCustomXmlDelRangeStart( oItem );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new Logic::CCustomXmlInsRangeEnd( oItem );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new Logic::CCustomXmlInsRangeStart( oItem );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeEnd( oItem );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeStart( oItem );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveToRangeEnd( oItem );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveToRangeStart( oItem );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oItem );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oItem );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oItem );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oItem );
else if ( _T("m:oMath") == sName )
pItem = new Logic::COMath( oItem );
else if ( _T("m:oMathPara") == sName )
pItem = new Logic::COMathPara( oItem );
else if ( _T("w:p") == sName )
pItem = new Logic::CParagraph( oItem );
else if ( _T("w:permEnd") == sName )
pItem = new Logic::CPermEnd( oItem );
else if ( _T("w:permStart") == sName )
pItem = new Logic::CPermStart( oItem );
else if ( _T("w:proofErr") == sName )
pItem = new Logic::CProofErr( oItem );
else if ( _T("w:sdt") == sName )
pItem = new Logic::CSdt( oItem );
else if ( _T("w:sectPr") == sName )
m_oSectPr = oItem;
else if ( _T("w:tbl") == sName )
pItem = new Logic::CTbl( oItem );
if ( pItem )
m_arrItems.Add( pItem );
}
}
}
}
}
#endif
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
CString sXml;
if ( SimpleTypes::conformanceclassTransitional != m_oConformance.GetValue() )
{
sXml.Format( _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document w:conformance=\"%s\" xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">"), m_oConformance.ToString() );
}
else
{
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
}
if ( m_oBackground.IsInit() )
sXml += m_oBackground->toXML();
sXml += _T("<w:body>");
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
{
sXml += m_arrItems[nIndex]->toXML();
}
}
if ( m_oSectPr.IsInit() )
sXml += m_oSectPr->toXML();
sXml += _T("</w:body></w:document>");
CDirectory::SaveToFile( oPath.GetPath(), sXml );
oContent.Registration( type().OverrideType(), oDirectory, oPath );
IFileContainer::Write( oPath, oDirectory, oContent );
}
virtual const OOX::FileType type() const
{
return FileTypes::Document;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
const CPath& GetReadPath()
{
return m_oReadPath;
}
public:
void ClearItems()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
void AddImage(const CPath& oImagePath, const long lWidth, const long lHeight)
{
}
void AddImage(const CPath& oImagePath, const long lEmuX, const CString& sHRelativeFrom, const long lEmuY, const CString& sVRelativeFrom, const long lWidthEmu, const long lHeightEmu)
{
}
void AddImageInBegin(const CPath& oImagePath, const long lWidth, const long lHeight)
{
}
void AddSpaceToLast(const int nCount)
{
if ( m_arrItems.GetSize() > 0 && et_w_p == m_arrItems[m_arrItems.GetSize() - 1]->getType() )
{
OOX::Logic::CParagraph* pPara = (OOX::Logic::CParagraph*)m_arrItems[m_arrItems.GetSize() - 1];
pPara->AddSpace( nCount );
}
}
void AddPageBreak()
{
WritingElement *pNewElement = new Logic::CParagraph();
if ( !pNewElement )
return;
Logic::CParagraph* pPara = (Logic::CParagraph*)pNewElement;
pPara->AddBreak( SimpleTypes::brtypePage );
m_arrItems.Add( pNewElement );
}
void AddText(CString& sText)
{
WritingElement *pNewElement = new Logic::CParagraph();
if ( !pNewElement )
return;
Logic::CParagraph* pPara = (Logic::CParagraph*)pNewElement;
pPara->AddText( sText );
m_arrItems.Add( pNewElement );
}
void AddTextToLast(CString& sText)
{
if ( m_arrItems.GetSize() > 0 && et_w_p == m_arrItems[m_arrItems.GetSize() - 1]->getType() )
{
OOX::Logic::CParagraph* pPara = (OOX::Logic::CParagraph*)m_arrItems[m_arrItems.GetSize() - 1];
pPara->AddText( sText );
}
}
void AddHyperlink (CString& sNameHref, CString& sText)
{
WritingElement *pNewElement = new Logic::CParagraph;
if ( !pNewElement )
return;
Logic::CParagraph* pPara = (Logic::CParagraph*)pNewElement;
smart_ptr<OOX::File> oHyperlink = smart_ptr<OOX::File>( new OOX::HyperLink( sNameHref ) );
const OOX::RId rId = Add( oHyperlink );
m_arrItems.Add( pNewElement );
}
void AddHyperlinkToLast(CString& sNameHref, CString& sText)
{
if ( m_arrItems.GetSize() > 0 && et_w_p == m_arrItems[m_arrItems.GetSize() - 1]->getType() )
{
OOX::Logic::CParagraph* pPara = (OOX::Logic::CParagraph*)m_arrItems[m_arrItems.GetSize() - 1];
smart_ptr<OOX::File> oHyperlink = smart_ptr<OOX::File>( new OOX::HyperLink( sNameHref ) );
const OOX::RId rId = Add( oHyperlink );
}
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:conformance"), m_oConformance )
WritingElement_ReadAttributes_End( oReader )
}
public:
CPath m_oReadPath;
SimpleTypes::CConformanceClass<SimpleTypes::conformanceclassTransitional> m_oConformance;
nullable<OOX::Logic::CSectionProperty> m_oSectPr;
nullable<OOX::Logic::CBackground > m_oBackground;
CSimpleArray<WritingElement *> m_arrItems;
CSimpleArray<CString> m_arrShapeTypes;
};
}
#endif // OOX_DOCUMENT_FILE_INCLUDE_H_

View File

@@ -0,0 +1,143 @@
/*
* (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 "Docx.h"
namespace OOX {
BOOL CDocx::Read(const CPath& oFilePath) {
OOX::CRels oRels( oFilePath / L"/" );
IFileContainer::Read( oRels, oFilePath );
smart_ptr<OOX::File> pFile = Find(OOX::FileTypes::Document);
if (pFile.IsInit() && OOX::FileTypes::Document == pFile->type())
m_pDocument = (OOX::CDocument*)pFile.operator->();
else
m_pDocument = NULL;
if ( m_pDocument )
{
OOX::IFileContainer* pDocumentContainer = (OOX::IFileContainer*)m_pDocument;
pFile = pDocumentContainer->Find( OOX::FileTypes::FontTable );
if ( pFile.IsInit() && OOX::FileTypes::FontTable == pFile->type() )
m_pFontTable = (OOX::CFontTable*)pFile.operator->();
else
m_pFontTable = NULL;
pFile = pDocumentContainer->Find( OOX::FileTypes::Numbering );
if ( pFile.IsInit() && OOX::FileTypes::Numbering == pFile->type() )
m_pNumbering = (OOX::CNumbering*)pFile.operator->();
else
m_pNumbering = NULL;
pFile = pDocumentContainer->Find( OOX::FileTypes::Style );
if ( pFile.IsInit() && OOX::FileTypes::Style == pFile->type() )
m_pStyles = (OOX::CStyles*)pFile.operator->();
else
m_pStyles = NULL;
pFile = pDocumentContainer->Find( OOX::FileTypes::FootNote );
if ( pFile.IsInit() && OOX::FileTypes::FootNote == pFile->type() )
m_pFootnotes = (OOX::CFootnotes*)pFile.operator->();
else
m_pFootnotes = NULL;
pFile = pDocumentContainer->Find( OOX::FileTypes::EndNote );
if ( pFile.IsInit() && OOX::FileTypes::EndNote == pFile->type() )
m_pEndnotes = (OOX::CEndnotes*)pFile.operator->();
else
m_pEndnotes = NULL;
pFile = pDocumentContainer->Find( OOX::FileTypes::Setting );
if ( pFile.IsInit() && OOX::FileTypes::Setting == pFile->type() )
m_pSettings = (OOX::CSettings*)pFile.operator->();
else
m_pSettings = NULL;
pFile = pDocumentContainer->Find( OOX::FileTypes::Comments );
if ( pFile.IsInit() && OOX::FileTypes::Comments == pFile->type() )
m_pComments = (OOX::CComments*)pFile.operator->();
else
m_pComments = NULL;
pFile = pDocumentContainer->Find( OOX::FileTypes::CommentsExt );
if ( pFile.IsInit() && OOX::FileTypes::CommentsExt == pFile->type() )
m_pCommentsExt = (OOX::CCommentsExt*)pFile.operator->();
else
m_pCommentsExt = NULL;
pFile = pDocumentContainer->Find( OOX::FileTypes::People );
if ( pFile.IsInit() && OOX::FileTypes::People == pFile->type() )
m_pPeople = (OOX::CPeople*)pFile.operator->();
else
m_pPeople = NULL;
pFile = pDocumentContainer->Find(OOX::FileTypes::Theme);
if (pFile.IsInit() && OOX::FileTypes::Theme == pFile->type())
m_pTheme = (OOX::CTheme*)pFile.operator->();
else
m_pTheme = NULL;
}
pFile = Find( OOX::FileTypes::App );
if ( pFile.IsInit() && OOX::FileTypes::App == pFile->type() )
m_pApp = (OOX::CApp*)pFile.operator->();
else
m_pApp = NULL;
pFile = Find( OOX::FileTypes::Core );
if ( pFile.IsInit() && OOX::FileTypes::Core == pFile->type() )
m_pCore = (OOX::CCore*)pFile.operator->();
else
m_pCore = NULL;
return TRUE;
}
}

View File

@@ -0,0 +1,217 @@
/*
* (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_DOCX_INCLUDE_H_
#define OOX_DOCX_INCLUDE_H_
#include "../Base/SmartPtr.h"
#include "Rels.h"
#include "IFileContainer.h"
#include "FileTypes.h"
#include "App.h"
#include "Core.h"
#include "Document.h"
#include "FontTable.h"
#include "Numbering.h"
#include "Comments.h"
#include "Styles.h"
#include "Footnote.h"
#include "Endnote.h"
#include "Settings\WebSettings.h"
#include "Settings\Settings.h"
#include "External\HyperLink.h"
#include "Media\Image.h"
#include "Media\OleObject.h"
#include "HeaderFooter.h"
#include "Theme\Theme.h"
namespace OOX
{
class CDocx : public OOX::IFileContainer
{
public:
CDocx()
{
m_pDocument = NULL;
m_pFontTable = NULL;
m_pNumbering = NULL;
m_pStyles = NULL;
m_pApp = NULL;
m_pCore = NULL;
m_pEndnotes = NULL;
m_pFootnotes = NULL;
m_pSettings = NULL;
m_pTheme = NULL;
m_pComments = NULL;
m_pCommentsExt = NULL;
m_pPeople = NULL;
}
CDocx(const CPath& oFilePath)
{
m_pDocument = NULL;
m_pFontTable = NULL;
m_pNumbering = NULL;
m_pStyles = NULL;
m_pApp = NULL;
m_pCore = NULL;
m_pEndnotes = NULL;
m_pFootnotes = NULL;
m_pSettings = NULL;
m_pTheme = NULL;
m_pComments = NULL;
m_pCommentsExt = NULL;
m_pPeople = NULL;
Read( oFilePath );
}
public:
BOOL Read(const CPath& oFilePath);
BOOL Write(const CPath& oFilePath)
{
return FALSE;
CreateDirectoryW( oFilePath.GetPath(), NULL );
OOX::CRels oRels;
OOX::CContentTypes oContent;
IFileContainer::Write( oRels, oFilePath, OOX::CPath( L"" ), oContent );
oRels.Write( oFilePath / L"/" );
oContent.Write( oFilePath );
return TRUE;
}
public:
OOX::CDocument *GetDocument () const
{
return m_pDocument;
}
OOX::CFontTable *GetFontTable() const
{
return m_pFontTable;
}
OOX::CNumbering *GetNumbering() const
{
return m_pNumbering;
}
OOX::CStyles *GetStyles () const
{
return m_pStyles;
}
OOX::CEndnotes *GetEndnotes () const
{
return m_pEndnotes;
}
OOX::CFootnotes *GetFootnotes() const
{
return m_pFootnotes;
}
OOX::CApp *GetApp () const
{
return m_pApp;
}
OOX::CCore *GetCore () const
{
return m_pCore;
}
OOX::CSettings *GetSettings () const
{
return m_pSettings;
}
OOX::CComments *GetComments () const
{
return m_pComments;
}
OOX::CCommentsExt *GetCommentsExt () const
{
return m_pCommentsExt;
}
OOX::CPeople *GetPeople () const
{
return m_pPeople;
}
OOX::CTheme *GetTheme () const
{
return m_pTheme;
}
OOX::CHdrFtr *GetHeaderOrFooter(const OOX::RId& rId) const
{
if ( m_pDocument )
{
OOX::IFileContainer* pDocumentContainer = (OOX::IFileContainer*)m_pDocument;
smart_ptr<OOX::File> pFile = pDocumentContainer->Find( rId );
if ( pFile.IsInit() && ( OOX::FileTypes::Header == pFile->type() || OOX::FileTypes::Footer == pFile->type() ) )
return (OOX::CHdrFtr*)pFile.operator->();
else
return NULL;
}
return NULL;
}
public:
OOX::CApp *m_pApp;
OOX::CCore *m_pCore;
OOX::CDocument *m_pDocument;
OOX::CFontTable *m_pFontTable;
OOX::CNumbering *m_pNumbering;
OOX::CStyles *m_pStyles;
OOX::CFootnotes *m_pFootnotes;
OOX::CEndnotes *m_pEndnotes;
OOX::CSettings *m_pSettings;
OOX::CComments *m_pComments;
OOX::CCommentsExt *m_pCommentsExt;
OOX::CPeople *m_pPeople;
OOX::CTheme *m_pTheme;
};
}
#endif // OOX_DOCX_INCLUDE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,818 @@
/*
* (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_LOGIC_DRAWING_3D_INCLUDE_H_
#define OOX_LOGIC_DRAWING_3D_INCLUDE_H_
#include "DrawingExt.h"
#include "DrawingColors.h"
namespace OOX
{
namespace Drawing
{
enum EText3DType
{
text3dtypeUnknown = 0,
text3dtypeShape = 1,
text3dtypeFlat = 2,
};
class CPoint3D : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPoint3D)
CPoint3D()
{
}
virtual ~CPoint3D()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult = _T("<a:anchor x=\"") + m_oX.ToString()
+ _T("\" y=\"") + m_oY.ToString()
+ _T("\" z=\"") + m_oZ.ToString()
+ _T("\"/>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_anchor;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("x"), m_oX )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("y"), m_oY )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("z"), m_oZ )
WritingElement_ReadAttributes_End( oReader )
}
public:
SimpleTypes::CCoordinate m_oX;
SimpleTypes::CCoordinate m_oY;
SimpleTypes::CCoordinate m_oZ;
};
class CVector3D : public WritingElement
{
public:
WritingElement_AdditionConstructors(CVector3D)
CVector3D()
{
m_eType = et_Unknown;
}
virtual ~CVector3D()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("a:norm") == sName )
m_eType = et_a_norm;
else if ( _T("a:up") == sName )
m_eType = et_a_up;
else
return;
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult;
if ( et_a_norm == m_eType )
sResult = _T("<a:norm dx=\"") + m_oDx.ToString()
+ _T("\" dy=\"") + m_oDy.ToString()
+ _T("\" dz=\"") + m_oDz.ToString()
+ _T("\"/>");
if ( et_a_up == m_eType )
sResult = _T("<a:up dx=\"") + m_oDx.ToString()
+ _T("\" dy=\"") + m_oDy.ToString()
+ _T("\" dz=\"") + m_oDz.ToString()
+ _T("\"/>");
return sResult;
}
virtual EElementType getType() const
{
return m_eType;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("dx"), m_oDx )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dy"), m_oDy )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dz"), m_oDz )
WritingElement_ReadAttributes_End( oReader )
}
public:
EElementType m_eType;
SimpleTypes::CCoordinate m_oDx;
SimpleTypes::CCoordinate m_oDy;
SimpleTypes::CCoordinate m_oDz;
};
class CBackdrop : public WritingElement
{
public:
WritingElement_AdditionConstructors(CBackdrop)
CBackdrop()
{
}
virtual ~CBackdrop()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( !oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:anchor") == sName )
m_oAnchor = oReader;
else if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
else if ( _T("a:norm") == sName )
m_oNorm = oReader;
else if ( _T("a:up") == sName )
m_oUp = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:backdrop>");
sResult += m_oAnchor.toXML();
sResult += m_oNorm.toXML();
sResult += m_oUp.toXML();
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
sResult += _T("</a:backdrop>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_backdrop;
}
public:
OOX::Drawing::CPoint3D m_oAnchor;
OOX::Drawing::CVector3D m_oNorm;
OOX::Drawing::CVector3D m_oUp;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
};
class CBevel : public WritingElement
{
public:
WritingElement_AdditionConstructors(CBevel)
CBevel()
{
m_eType = et_Unknown;
}
virtual ~CBevel()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("a:bevel") == sName )
m_eType = et_a_bevel;
if ( _T("a:bevelB") == sName )
m_eType = et_a_bevelB;
else if ( _T("a:bevelT") == sName )
m_eType = et_a_bevelT;
else
return;
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult;
if ( et_a_bevel == m_eType )
sResult = _T("<a:bevel h=\"") + m_oH.ToString()
+ _T("\" prst=\"") + m_oPrst.ToString()
+ _T("\" w=\"") + m_oW.ToString()
+ _T("\"/>");
else if ( et_a_bevelB == m_eType )
sResult = _T("<a:bevelB h=\"") + m_oH.ToString()
+ _T("\" prst=\"") + m_oPrst.ToString()
+ _T("\" w=\"") + m_oW.ToString()
+ _T("\"/>");
else if ( et_a_bevelT == m_eType )
sResult = _T("<a:bevelT h=\"") + m_oH.ToString()
+ _T("\" prst=\"") + m_oPrst.ToString()
+ _T("\" w=\"") + m_oW.ToString()
+ _T("\"/>");
return sResult;
}
virtual EElementType getType() const
{
return m_eType;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("h"), m_oH )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("prst"), m_oPrst )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w"), m_oW )
WritingElement_ReadAttributes_End( oReader )
}
public:
EElementType m_eType;
SimpleTypes::CPositiveCoordinate<76200> m_oH;
SimpleTypes::CBevelPresetType<SimpleTypes::bevelpresettypeCircle> m_oPrst;
SimpleTypes::CPositiveCoordinate<76200> m_oW;
};
class CSphereCoords : public WritingElement
{
public:
WritingElement_AdditionConstructors(CSphereCoords)
CSphereCoords()
{
}
virtual ~CSphereCoords()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult = _T("<a:rot lat=\"") + m_oLat.ToString()
+ _T("\" lon=\"") + m_oLon.ToString()
+ _T("\" rev=\"") + m_oRev.ToString()
+ _T("\"/>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_rot;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("lat"), m_oLat )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lon"), m_oLon )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rev"), m_oRev )
WritingElement_ReadAttributes_End( oReader )
}
public:
SimpleTypes::CPositiveFixedAngle<> m_oLat;
SimpleTypes::CPositiveFixedAngle<> m_oLon;
SimpleTypes::CPositiveFixedAngle<> m_oRev;
};
class CCamera : public WritingElement
{
public:
WritingElement_AdditionConstructors(CCamera)
CCamera()
{
}
virtual ~CCamera()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:rot") == sName )
m_oRot = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:camera prst=\"") + m_oPrst.ToString() + _T("\" zoom=\"") + m_oZoom.ToString();
if ( m_oFov.IsInit() )
{
sResult += _T("\" fov=\"");
sResult += m_oFov->ToString();
sResult += _T("\">");
}
else
sResult += _T("\">");
if ( m_oRot.IsInit() )
sResult += m_oRot->toXML();
sResult += _T("</a:camera>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_camera;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
m_oZoom.SetValue( 100 );
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("fov"), m_oFov )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("prst"), m_oPrst )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("zoom"), m_oZoom )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CFOVAngle<>> m_oFov;
SimpleTypes::CPresetCameraType<> m_oPrst;
SimpleTypes::CPositivePercentage m_oZoom;
nullable<OOX::Drawing::CSphereCoords> m_oRot;
};
class CContourColor : public OOX::Drawing::CColor
{
public:
WritingElement_AdditionConstructors(CContourColor)
CContourColor()
{
}
virtual ~CContourColor()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
CColor::fromXML( oNode );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
CColor::fromXML( oReader );
}
virtual CString toXML() const
{
CString sResult = _T("<a:contourClr>");
sResult += CColor::toXML();
sResult += _T("</a:contourClr>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_contourClr;
}
};
class CExtrusionColor : public OOX::Drawing::CColor
{
public:
WritingElement_AdditionConstructors(CExtrusionColor)
CExtrusionColor()
{
}
virtual ~CExtrusionColor()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
CColor::fromXML( oNode );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
CColor::fromXML( oReader );
}
virtual CString toXML() const
{
CString sResult = _T("<a:extrusionClr>");
sResult += CColor::toXML();
sResult += _T("</a:extrusionClr>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_extrusionClr;
}
};
class CFlatText : public WritingElement
{
public:
WritingElement_AdditionConstructors(CFlatText)
CFlatText()
{
}
virtual ~CFlatText()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult = _T("<a:flatTx z=\"") + m_oZ.ToString() + _T("\"/>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_flatTx;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
m_oZ.SetValue( 0 );
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("z"), m_oZ )
WritingElement_ReadAttributes_End( oReader )
}
public:
SimpleTypes::CCoordinate m_oZ;
};
class CLightRig : public WritingElement
{
public:
WritingElement_AdditionConstructors(CLightRig)
CLightRig()
{
}
virtual ~CLightRig()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:rot") == sName )
m_oRot = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:lightRig dir=\"") + m_oDir.ToString() + _T("\" rig=\"") + m_oRig.ToString() + _T("\">");
if ( m_oRot.IsInit() )
sResult += m_oRot->toXML();
sResult += _T("</a:lightRig>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_lightRig;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("dir"), m_oDir )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rig"), m_oRig )
WritingElement_ReadAttributes_End( oReader )
}
public:
SimpleTypes::CLightRigDirection<> m_oDir;
SimpleTypes::CLightRigType<> m_oRig;
nullable<OOX::Drawing::CSphereCoords> m_oRot;
};
class CShape3D : public WritingElement
{
public:
WritingElement_AdditionConstructors(CShape3D)
CShape3D()
{
}
virtual ~CShape3D()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:bevelB") == sName )
m_oBevelB = oReader;
else if ( _T("a:bevelT") == sName )
m_oBevelT = oReader;
else if ( _T("a:contourClr") == sName )
m_oContourClr = oReader;
else if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
else if ( _T("a:extrusionClr") == sName )
m_oExtrusionClr = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:sp3d contourW=\"") + m_oContourW.ToString()
+ _T("\" extrusionH=\"") + m_oExtrusionH.ToString()
+ _T("\" prstMaterial=\"") + m_oPrstMaterial.ToString()
+ _T("\" z=\"") + m_oZ.ToString()
+ _T("\">");
if ( m_oBevelT.IsInit() )
sResult += m_oBevelT->toXML();
if ( m_oBevelB.IsInit() )
sResult += m_oBevelB->toXML();
if ( m_oContourClr.IsInit() )
sResult += m_oContourClr->toXML();
if ( m_oExtrusionClr.IsInit() )
sResult += m_oExtrusionClr->toXML();
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
sResult += _T("</a:sp3d>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_sp3d;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
m_oZ.SetValue( 0.0 );
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("contourW"), m_oContourW )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("extrusionH"), m_oExtrusionH )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("prstMaterial"), m_oPrstMaterial )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("z"), m_oZ )
WritingElement_ReadAttributes_End( oReader )
}
public:
SimpleTypes::CPositiveCoordinate<0> m_oContourW;
SimpleTypes::CPositiveCoordinate<0> m_oExtrusionH;
SimpleTypes::CPresetMaterialType<SimpleTypes::presetmaterialtypeWarmMatte> m_oPrstMaterial;
SimpleTypes::CCoordinate m_oZ;
nullable<OOX::Drawing::CBevel> m_oBevelB;
nullable<OOX::Drawing::CBevel> m_oBevelT;
nullable<OOX::Drawing::CContourColor> m_oContourClr;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
nullable<OOX::Drawing::CExtrusionColor> m_oExtrusionClr;
};
}
}
#endif // OOX_LOGIC_DRAWING_3D_INCLUDE_H_

View File

@@ -0,0 +1,516 @@
/*
* (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_LOGIC_DRAWING_BODY_INCLUDE_H_
#define OOX_LOGIC_DRAWING_BODY_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../../Common/SimpleTypes_Drawing.h"
#include "../../Common/SimpleTypes_Shared.h"
#include "../WritingElement.h"
#include "DrawingStyles2.h"
#include "DrawingEffects.h"
#include "Drawing3D.h"
#include "DrawingShape.h"
namespace OOX
{
namespace Drawing
{
enum ETextAutofitType
{
textautofitNone = 0,
textautofitNo = 1,
textautofitNormal = 2,
textautofitShape = 3,
};
class CTextNoAutofit : public WritingElement
{
public:
WritingElement_AdditionConstructors(CTextNoAutofit)
CTextNoAutofit()
{
}
virtual ~CTextNoAutofit()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
return _T("<a:noAutofit/>");
}
virtual EElementType getType() const
{
return et_a_noAutofit;
}
};
class CTextNormalAutofit : public WritingElement
{
public:
WritingElement_AdditionConstructors(CTextNormalAutofit)
CTextNormalAutofit()
{
}
virtual ~CTextNormalAutofit()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult = _T("<a:normAutofit fontScale=\"") + m_oFontScale.ToString()
+ _T("\" lnSpcReduction=\"") + m_oLnSpcReduction.ToString() + _T("\"/>");
return sResult;
}
virtual EElementType getType() const
{
return et_a_normAutofit;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
m_oFontScale.SetValue( 100 );
m_oLnSpcReduction.SetValue( 0 );
if ( oReader.GetAttributesCount() <= 0 )
return;
if ( !oReader.MoveToFirstAttribute() )
return;
CWCharWrapper wsName = oReader.GetName();
while( !wsName.IsNull() )
{
wchar_t wsChar0 = wsName[0];
switch ( wsChar0 )
{
case 'f':
if ( _T("fontScale") == wsName ) m_oFontScale = oReader.GetText();
break;
case 'l':
if ( _T("lnSpcReduction") == wsName ) m_oLnSpcReduction = oReader.GetText();
break;
}
if ( !oReader.MoveToNextAttribute() )
break;
wsName = oReader.GetName();
}
oReader.MoveToElement();
}
public:
SimpleTypes::CTextFontScalePercentOrPercentString m_oFontScale;
SimpleTypes::CTextSpacingPercentOrPercentString m_oLnSpcReduction;
};
class CTextShapeAutofit : public WritingElement
{
public:
WritingElement_AdditionConstructors(CTextShapeAutofit)
CTextShapeAutofit()
{
}
virtual ~CTextShapeAutofit()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
return _T("<a:spAutoFit/>");
}
virtual EElementType getType() const
{
return et_a_spAutoFit;
}
};
class CTextBodyProperties : public WritingElement
{
public:
WritingElement_AdditionConstructors(CTextBodyProperties)
CTextBodyProperties()
{
m_eAutoFitType = textautofitNone;
m_eText3DType = text3dtypeUnknown;
}
virtual ~CTextBodyProperties()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_eAutoFitType = textautofitNone;
m_eText3DType = text3dtypeUnknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eAutoFitType = textautofitNone;
m_eText3DType = text3dtypeUnknown;
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
else if ( _T("a:flatTx") == sName )
{
m_eText3DType = text3dtypeFlat;
m_oFlatTx = oReader;
}
else if ( _T("a:noAutofit") == sName )
{
m_eAutoFitType = textautofitNo;
m_oNoAutofit = oReader;
}
else if ( _T("a:normAutofit") == sName )
{
m_eAutoFitType = textautofitNormal;
m_oNormAutofit = oReader;
}
else if ( _T("a:prstTxWarp") == sName )
m_oPrstTxWrap = oReader;
else if ( _T("a:scene3d") == sName )
m_oScene3D = oReader;
else if ( _T("a:sp3d") == sName )
{
m_eText3DType = text3dtypeShape;
m_oSp3D = oReader;
}
else if ( _T("a:spAutoFit") == sName )
{
m_eAutoFitType = textautofitShape;
m_oSpAutoFit = oReader;
}
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:bodyPr");
if ( 0 != m_oRot.GetAngle() )
sResult += _T(" rot=\"") + m_oRot.ToString() + _T("\"");
if ( SimpleTypes::onoffFalse != m_oSpcFirstLastPara.GetValue() )
sResult += _T(" spcFirstLastPara=\"1\"");
if ( m_oVertOverflow.IsInit() )
sResult += _T(" vertOverflow=\"") + m_oVertOverflow->ToString() + _T("\"");
if ( m_oHorzOverflow.IsInit() )
sResult += _T(" horzOverflow=\"") + m_oHorzOverflow->ToString() + _T("\"");
if ( SimpleTypes::textverticaltypeHorz != m_oVert.GetValue() )
sResult += _T(" vert=\"") + m_oVert.ToString() + _T("\"");
if ( SimpleTypes::textwrappingtypeSquare != m_oWrap.GetValue() )
sResult += _T(" wrap=\"") + m_oWrap.ToString() + _T("\"");
if ( 91440 != m_oLIns.ToEmu() )
sResult += _T(" lIns=\"") + m_oLIns.ToString() + _T("\"");
if ( 45720 != m_oTIns.ToEmu() )
sResult += _T(" tIns=\"") + m_oTIns.ToString() + _T("\"");
if ( 91440 != m_oRIns.ToEmu() )
sResult += _T(" rIns=\"") + m_oRIns.ToString() + _T("\"");
if ( 45720 != m_oBIns.ToEmu() )
sResult += _T(" bIns=\"") + m_oBIns.ToString() + _T("\"");
if ( 1 != m_oNumCol.GetValue() )
sResult += _T(" numCol=\"") + m_oNumCol.ToString() + _T("\"");
if ( 0 != m_oSpcCol.GetValue() )
sResult += _T(" spcCol=\"") + m_oSpcCol.ToString() + _T("\"");
if ( SimpleTypes::onoffFalse != m_oRtlCol.GetValue() )
sResult += _T(" rtlCol=\"1\"");
if ( SimpleTypes::onoffFalse != m_oFromWordArt.GetValue() )
sResult += _T(" fromWordArt=\"1\"");
if ( SimpleTypes::textanchoringtypeT != m_oAnchor.GetValue() )
sResult += _T(" anchor=\"") + m_oAnchor.ToString() + _T("\"");
if ( SimpleTypes::onoffFalse != m_oAnchorCtr.GetValue() )
sResult += _T(" anchorCtr=\"1\"");
if ( SimpleTypes::onoffFalse != m_oForceAA.GetValue() )
sResult += _T(" forceAA=\"1\"");
if ( SimpleTypes::onoffFalse != m_oUpright.GetValue() )
sResult += _T(" upright=\"1\"");
if ( SimpleTypes::onoffFalse != m_oCompatLnSpc.GetValue() )
sResult += _T(" compatLnSpc=\"1\"");
sResult += _T(">");
if ( m_oPrstTxWrap.IsInit() )
sResult += m_oPrstTxWrap->toXML();
switch ( m_eAutoFitType )
{
case textautofitNo:
if ( m_oNoAutofit.IsInit() )
sResult += m_oNoAutofit->toXML();
break;
case textautofitNormal:
if ( m_oNormAutofit.IsInit() )
sResult += m_oNormAutofit->toXML();
break;
case textautofitShape:
if ( m_oSpAutoFit.IsInit() )
sResult += m_oSpAutoFit->toXML();
break;
}
if ( m_oScene3D.IsInit() )
sResult += m_oScene3D->toXML();
switch ( m_eText3DType )
{
case text3dtypeFlat:
if ( m_oFlatTx.IsInit() )
sResult += m_oFlatTx->toXML();
break;
case text3dtypeShape:
if ( m_oSp3D.IsInit() )
sResult += m_oSp3D->toXML();
break;
}
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
sResult += _T("</a:bodyPr>");
return sResult;
}
virtual EElementType getType() const
{
return et_a_bodyPr;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
m_oBIns.SetValue(45720);
m_oLIns.SetValue(91440);
m_oRIns.SetValue(91440);
m_oTIns.SetValue(45720);
if ( oReader.GetAttributesCount() <= 0 )
return;
if ( !oReader.MoveToFirstAttribute() )
return;
CWCharWrapper wsName = oReader.GetName();
while( !wsName.IsNull() )
{
wchar_t wsChar0 = wsName[0];
switch ( wsChar0 )
{
case 'a':
if ( _T("anchor") == wsName ) m_oAnchor = oReader.GetText();
else if ( _T("anchorCtr") == wsName ) m_oAnchorCtr = oReader.GetText();
break;
case 'b':
if ( _T("bIns") == wsName ) m_oBIns = oReader.GetText();
break;
case 'c':
if ( _T("compatLnSpc") == wsName ) m_oCompatLnSpc = oReader.GetText();
break;
case 'f':
if ( _T("forceAA") == wsName ) m_oForceAA = oReader.GetText();
else if ( _T("fromWordArt") == wsName ) m_oFromWordArt = oReader.GetText();
break;
case 'h':
if ( _T("horzOverflow") == wsName ) m_oHorzOverflow = oReader.GetText();
break;
case 'l':
if ( _T("lIns") == wsName ) m_oLIns = oReader.GetText();
break;
case 'n':
if ( _T("numCol") == wsName ) m_oNumCol = oReader.GetText();
break;
case 'r':
if ( _T("rIns") == wsName ) m_oRIns = oReader.GetText();
else if ( _T("rot") == wsName ) m_oRot = oReader.GetText();
else if ( _T("rtlCol") == wsName ) m_oRtlCol = oReader.GetText();
break;
case 's':
if ( _T("spcCol") == wsName ) m_oSpcCol = oReader.GetText();
else if ( _T("spcFirstLastPara") == wsName ) m_oSpcFirstLastPara = oReader.GetText();
break;
case 't':
if ( _T("tIns") == wsName ) m_oTIns = oReader.GetText();
break;
case 'u':
if ( _T("upright") == wsName ) m_oUpright = oReader.GetText();
break;
case 'v':
if ( _T("vert") == wsName ) m_oVert = oReader.GetText();
else if ( _T("vertOverflow") == wsName ) m_oVertOverflow = oReader.GetText();
break;
case 'w':
if ( _T("wrap") == wsName ) m_oWrap = oReader.GetText();
break;
}
if ( !oReader.MoveToNextAttribute() )
break;
wsName = oReader.GetName();
}
oReader.MoveToElement();
}
public:
SimpleTypes::CTextAnchoringType<SimpleTypes::textanchoringtypeT> m_oAnchor;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oAnchorCtr;
SimpleTypes::CCoordinate32 m_oBIns;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oCompatLnSpc;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oForceAA;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oFromWordArt;
nullable<SimpleTypes::CTextHorzOverflowType<>> m_oHorzOverflow;
SimpleTypes::CCoordinate32 m_oLIns;
SimpleTypes::CTextColumnCount<1> m_oNumCol;
SimpleTypes::CCoordinate32 m_oRIns;
SimpleTypes::CAngle<0> m_oRot;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oRtlCol;
SimpleTypes::CPositiveCoordinate32<0> m_oSpcCol;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oSpcFirstLastPara;
SimpleTypes::CCoordinate32 m_oTIns;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oUpright;
SimpleTypes::CTextVerticalType<SimpleTypes::textverticaltypeHorz> m_oVert;
nullable<SimpleTypes::CTextVertOverflowType<>> m_oVertOverflow;
SimpleTypes::CTextWrappingType<SimpleTypes::textwrappingtypeSquare> m_oWrap;
ETextAutofitType m_eAutoFitType;
EText3DType m_eText3DType;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
nullable<OOX::Drawing::CFlatText> m_oFlatTx;
nullable<OOX::Drawing::CTextNoAutofit> m_oNoAutofit;
nullable<OOX::Drawing::CTextNormalAutofit> m_oNormAutofit;
nullable<OOX::Drawing::CPresetTextShape> m_oPrstTxWrap;
nullable<OOX::Drawing::CScene3D> m_oScene3D;
nullable<OOX::Drawing::CShape3D> m_oSp3D;
nullable<OOX::Drawing::CTextShapeAutofit> m_oSpAutoFit;
};
}
}
#endif // OOX_LOGIC_DRAWING_BODY_INCLUDE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,286 @@
/*
* (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 "DrawingCoreInfo.h"
namespace OOX
{
namespace Drawing
{
void CNonVisualPictureProperties::fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
void CNonVisualPictureProperties::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("a:cNvPicPr") == sName )
m_eType = et_a_cNvPicPr;
else if ( _T("p:cNvPicPr") == sName )
m_eType = et_p_cNvPicPr;
else if ( _T("pic:cNvPicPr") == sName )
m_eType = et_pic_cNvPicPr;
else
return;
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
sName = oReader.GetName();
if ( _T("a:picLocks") == sName )
m_oPicLocks = oReader;
else if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
}
}
CString CNonVisualPictureProperties::toXML() const
{
CString sResult;
if ( et_a_cNvPicPr == m_eType )
sResult = _T("<a:cNvPicPr ");
else if ( et_p_cNvPicPr == m_eType )
sResult = _T("<p:cNvPicPr ");
else if ( et_pic_cNvPicPr == m_eType )
sResult = _T("<pic:cNvPicPr ");
else
return _T("");
sResult += _T("preferRelativeResize=\"") + m_oPreferRelativeResize.ToString() + _T("\">");
if ( m_oPicLocks.IsInit() )
sResult += m_oPicLocks->toXML();
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
if ( et_a_cNvPicPr == m_eType )
sResult += _T("</a:cNvPicPr>");
else if ( et_p_cNvPicPr == m_eType )
sResult += _T("</p:cNvPicPr>");
else if ( et_pic_cNvPicPr == m_eType )
sResult += _T("</pic:cNvPicPr>");
return sResult;
}
void CNonVisualDrawingProps::fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
void CNonVisualDrawingProps::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("wp:docPr") == sName )
m_eType = et_wp_docPr;
else if ( _T("p:cNvPr") == sName )
m_eType = et_p_cNvPr;
else if ( _T("pic:cNvPr") == sName )
m_eType = et_pic_cNvPr;
else
return;
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
sName = oReader.GetName();
if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
else if ( _T("a:hlinkClick") == sName )
m_oHlinkClick = oReader;
else if ( _T("a:hlinkHover") == sName )
m_oHlinkHover = oReader;
}
}
CString CNonVisualDrawingProps::toXML() const
{
CString sResult = _T("<wp:docPr ");
if ( et_wp_docPr == m_eType )
sResult = _T("<wp:docPr ");
else if ( et_p_cNvPr == m_eType )
sResult += _T("<p:cNvPr ");
else if ( et_pic_cNvPr == m_eType )
sResult = _T("<pic:cNvPr ");
else
return _T("");
if ( m_sDescr.IsInit() )
{
sResult += _T("descr=\"");
sResult += m_sDescr->GetString();
sResult += _T("\" ");
}
if ( m_oHidden.IsInit() ) sResult += _T("hidden=\"") + m_oHidden->ToString() + _T("\" ");
if ( m_oId.IsInit() ) sResult += _T("id=\"") + m_oId->ToString() + _T("\" ");
if ( m_sName.IsInit() )
{
sResult += _T("name=\"");
sResult += m_sName->GetString();
sResult += _T("\" ");
}
if ( m_sTitle.IsInit() )
{
sResult += _T("title=\"");
sResult += m_sTitle->GetString();
sResult += _T("\" ");
}
sResult += _T(">");
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
if ( m_oHlinkClick.IsInit() )
sResult += m_oHlinkClick->toXML();
if ( m_oHlinkHover.IsInit() )
sResult += m_oHlinkHover->toXML();
if ( et_wp_docPr == m_eType )
sResult += _T("</wp:docPr>");
else if ( et_p_cNvPr == m_eType )
sResult += _T("</p:cNvPr>");
else if ( et_pic_cNvPr == m_eType )
sResult += _T("</pic:cNvPr>");
return sResult;
}
void CHyperlink::fromXML(XmlUtils::CXmlNode& oNode)
{
}
void CHyperlink::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:hlinkClick") == sName )
m_eType = et_a_hlinkClick;
else if ( _T("a:hlinkHover") == sName )
m_eType = et_a_hlinkHover;
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
else if ( _T("a:snd") == sName )
m_oSnd = oReader;
}
}
CString CHyperlink::toXML() const
{
CString sResult;
if ( et_a_hlinkClick == m_eType )
sResult = _T("<a:hlinkClick ");
else if ( et_a_hlinkHover == m_eType )
sResult = _T("<a:hlinkHover ");
else
return _T("");
if ( m_sAction.IsInit() )
{
sResult += _T("action=\"");
sResult += m_sAction->GetString();
sResult += _T("\" ");
}
if ( m_oEndSnd.IsInit() ) sResult += _T("endSnd=\"") + m_oEndSnd->ToString() + _T("\" ");
if ( m_oHighlightClick.IsInit() ) sResult += _T("highlightClick=\"") + m_oHighlightClick->ToString() + _T("\" ");
if ( m_oHistory.IsInit() ) sResult += _T("history=\"") + m_oHistory->ToString() + _T("\" ");
if ( m_oId.IsInit() ) sResult += _T("r:id=\"") + m_oId->ToString() + _T("\" ");
if ( m_sInvalidUrl.IsInit() )
{
sResult += _T("invalidUrl=\"");
sResult += m_sInvalidUrl->GetString();
sResult += _T("\" ");
}
if ( m_sTgtFrame.IsInit() )
{
sResult += _T("tgtFrame=\"");
sResult += m_sTgtFrame->GetString();
sResult += _T("\" ");
}
if ( m_sTooltip.IsInit() )
{
sResult += _T("tooltip=\"");
sResult += m_sTooltip->GetString();
sResult += _T("\" ");
}
sResult += _T(">");
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
if ( m_oSnd.IsInit() )
sResult += m_oSnd->toXML();
if ( et_a_hlinkClick == m_eType )
sResult = _T("</a:hlinkClick>");
else if ( et_a_hlinkHover == m_eType )
sResult = _T("</a:hlinkHover>");
return sResult;
}
}
} // OOX

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,769 @@
/*
* (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 "DrawingEffects.h"
namespace OOX
{
namespace Drawing
{
CBlip::CBlip(const CBlip& oOther)
{
Clear();
m_oCState = oOther.m_oCState;
m_oEmbed = oOther.m_oEmbed;
m_oLink = oOther.m_oLink;
m_oExtLst = oOther.m_oExtLst;
for ( int nIndex = 0; nIndex < oOther.m_arrEffects.GetSize(); nIndex++ )
{
OOX::EElementType eType = oOther.m_arrEffects[nIndex]->getType();
WritingElement *pEffect = NULL;
switch ( eType )
{
case et_a_alphaBiLevel: pEffect = new CAlphaBiLevelEffect ( (const CAlphaBiLevelEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaCeiling: pEffect = new CAlphaCeilingEffect ( (const CAlphaCeilingEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaFloor: pEffect = new CAlphaFloorEffect ( (const CAlphaFloorEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaInv: pEffect = new CAlphaInverseEffect ( (const CAlphaInverseEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaMod: pEffect = new CAlphaModulateEffect ( (const CAlphaModulateEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaModFix: pEffect = new CAlphaModulateFixedEffect( (const CAlphaModulateFixedEffect&)*oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaRepl: pEffect = new CAlphaReplaceEffect ( (const CAlphaReplaceEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_biLevel: pEffect = new CBiLevelEffect ( (const CBiLevelEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_blur: pEffect = new CBlurEffect ( (const CBlurEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_clrChange: pEffect = new CColorChangeEffect ( (const CColorChangeEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_clrRepl: pEffect = new CColorReplaceEffect ( (const CColorReplaceEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_duotone: pEffect = new CDuotoneEffect ( (const CDuotoneEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_fillOverlay: pEffect = new CFillOverlayEffect ( (const CFillOverlayEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_grayscl: pEffect = new CGrayscaleEffect ( (const CGrayscaleEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_hsl: pEffect = new CHSLEffect ( (const CHSLEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_lum: pEffect = new CLuminanceEffect ( (const CLuminanceEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_tint: pEffect = new CTintEffect ( (const CTintEffect&) *oOther.m_arrEffects[nIndex] ); break;
}
if ( NULL != pEffect )
m_arrEffects.Add( pEffect );
}
}
void CBlip::fromXML(XmlUtils::CXmlNode& oNode)
{
}
void CBlip::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pEffect = NULL;
wchar_t wChar = sName[2];
switch(wChar)
{
case 'a':
if ( _T("a:alphaBiLevel") == sName )
pEffect = new CAlphaBiLevelEffect( oReader );
else if ( _T("a:alphaCeiling") == sName )
pEffect = new CAlphaCeilingEffect( oReader );
else if ( _T("a:alphaFloor") == sName )
pEffect = new CAlphaFloorEffect( oReader );
else if ( _T("a:alphaInv") == sName )
pEffect = new CAlphaInverseEffect( oReader );
else if ( _T("a:alphaMod") == sName )
pEffect = new CAlphaModulateEffect( oReader );
else if ( _T("a:alphaModFix") == sName )
pEffect = new CAlphaModulateFixedEffect( oReader );
else if ( _T("a:alphaRepl") == sName )
pEffect = new CAlphaReplaceEffect( oReader );
break;
case 'b':
if ( _T("a:biLevel") == sName )
pEffect = new CBiLevelEffect( oReader );
else if ( _T("a:blur") == sName )
pEffect = new CBlurEffect( oReader );
break;
case 'c':
if ( _T("a:clrChange") == sName )
pEffect = new CColorChangeEffect( oReader );
else if ( _T("a:clrRepl") == sName )
pEffect = new CColorReplaceEffect( oReader );
break;
case 'd':
if ( _T("a:duotone") == sName )
pEffect = new CDuotoneEffect( oReader );
break;
case 'e':
if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
break;
case 'f':
if ( _T("a:fillOverlay") == sName )
pEffect = new CFillOverlayEffect( oReader );
break;
case 'g':
if ( _T("a:grayscl") == sName )
pEffect = new CGrayscaleEffect( oReader );
break;
case 'h':
if ( _T("a:hsl") == sName )
pEffect = new CHSLEffect( oReader );
break;
case 'l':
if ( _T("a:lum") == sName )
pEffect = new CLuminanceEffect( oReader );
break;
case 't':
if ( _T("a:tint") == sName )
pEffect = new CTintEffect( oReader );
break;
}
if ( NULL != pEffect )
m_arrEffects.Add( pEffect );
}
}
CString CBlip::toXML() const
{
CString sResult = _T("<a:blip ");
sResult += _T("cstate=\"") + m_oCState.ToString() + _T("\" ");
if ( _T("") != m_oEmbed.GetValue() )
sResult += _T("r:embed=\"") + m_oEmbed.GetValue() + _T("\" ");
if ( _T("") != m_oLink.GetValue() )
sResult += _T("r:link=\"") + m_oLink.GetValue() + _T("\" ");
sResult += _T(">");
for ( int nIndex = 0; nIndex < m_arrEffects.GetSize(); nIndex++ )
sResult += m_arrEffects[nIndex]->toXML();
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
sResult = _T("</a:blip>");
return sResult;
}
void CBlipFillProperties::fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
void CBlipFillProperties::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("a:blipFill") == sName )
m_eType = et_a_blipFill;
else if ( _T("pic:blipFill") == sName )
m_eType = et_pic_blipFill;
else
return;
m_eFillModeType = fillmodepropertiesUnknown;
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:blip") == sName )
m_oBlip = oReader;
else if ( _T("a:srcRect") == sName )
m_oSrcRect = oReader;
else if ( _T("a:stretch") == sName )
{
m_oStretch = oReader;
m_eFillModeType = fillmodepropertiesStretch;
}
else if ( _T("a:tile") == sName )
{
m_oTile = oReader;
m_eFillModeType = fillmodepropertiesTile;
}
}
}
CString CBlipFillProperties::toXML() const
{
CString sResult;
if ( et_a_blipFill == m_eType )
sResult = _T("<a:blipFill ");
else if ( et_pic_blipFill == m_eType )
sResult = _T("<pic:blipFill ");
else
return _T("");
if ( m_oDpi.IsInit() )
{
sResult += _T("dpi=\"");
sResult += m_oDpi->ToString();
sResult += _T("\" ");
}
if ( m_oRotWithShape.IsInit() )
{
sResult += _T("rotWithShape=\"");
sResult += m_oRotWithShape->ToString();
sResult += _T("\" ");
}
sResult += _T(">");
if ( m_oBlip.IsInit() )
sResult += m_oBlip->toXML();
if ( m_oSrcRect.IsInit() )
sResult += m_oSrcRect->toXML();
if ( fillmodepropertiesStretch == m_eFillModeType && m_oStretch.IsInit() )
sResult += m_oStretch->toXML();
if ( fillmodepropertiesTile == m_eFillModeType && m_oTile.IsInit() )
sResult += m_oTile->toXML();
if ( et_a_blipFill == m_eType )
sResult += _T("</a:blipFill>");
else if ( et_pic_blipFill == m_eType )
sResult += _T("</pic:blipFill>");
return sResult;
}
CEffectContainer::CEffectContainer(const CEffectContainer& oOther)
{
Clear();
m_eType = oOther.m_eType;
m_sName = oOther.m_sName;
m_oType = oOther.m_oType;
for ( int nIndex = 0; nIndex < oOther.m_arrEffects.GetSize(); nIndex++ )
{
OOX::EElementType eType = oOther.m_arrEffects[nIndex]->getType();
WritingElement *pEffect = NULL;
switch ( eType )
{
case et_a_alphaBiLevel: pEffect = new CAlphaBiLevelEffect ( (const CAlphaBiLevelEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaCeiling: pEffect = new CAlphaCeilingEffect ( (const CAlphaCeilingEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaFloor: pEffect = new CAlphaFloorEffect ( (const CAlphaFloorEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaInv: pEffect = new CAlphaInverseEffect ( (const CAlphaInverseEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaMod: pEffect = new CAlphaModulateEffect ( (const CAlphaModulateEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaModFix: pEffect = new CAlphaModulateFixedEffect( (const CAlphaModulateFixedEffect&)*oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaOutset: pEffect = new CAlphaOutsetEffect ( (const CAlphaOutsetEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_alphaRepl: pEffect = new CAlphaReplaceEffect ( (const CAlphaReplaceEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_biLevel: pEffect = new CBiLevelEffect ( (const CBiLevelEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_blend: pEffect = new CBlendEffect ( (const CBlendEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_blur: pEffect = new CBlurEffect ( (const CBlurEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_clrChange: pEffect = new CColorChangeEffect ( (const CColorChangeEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_clrRepl: pEffect = new CColorReplaceEffect ( (const CColorReplaceEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_cont: pEffect = new CEffectContainer ( (const CEffectContainer&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_duotone: pEffect = new CDuotoneEffect ( (const CDuotoneEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_effect: pEffect = new CEffectReference ( (const CEffectReference&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_fill: pEffect = new CFillEffect ( (const CFillEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_fillOverlay: pEffect = new CFillOverlayEffect ( (const CFillOverlayEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_glow: pEffect = new CGlowEffect ( (const CGlowEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_grayscl: pEffect = new CGrayscaleEffect ( (const CGrayscaleEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_hsl: pEffect = new CHSLEffect ( (const CHSLEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_innerShdw: pEffect = new CInnerShadowEffect ( (const CInnerShadowEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_lum: pEffect = new CLuminanceEffect ( (const CLuminanceEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_outerShdw: pEffect = new COuterShadowEffect ( (const COuterShadowEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_prstShdw: pEffect = new CPresetShadowEffect ( (const CPresetShadowEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_reflection: pEffect = new CReflectionEffect ( (const CReflectionEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_relOff: pEffect = new CRelativeOffsetEffect ( (const CRelativeOffsetEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_softEdge: pEffect = new CSoftEdgesEffect ( (const CSoftEdgesEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_tint: pEffect = new CTintEffect ( (const CTintEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_xfrm: pEffect = new CTransformEffect ( (const CTransformEffect&) *oOther.m_arrEffects[nIndex] ); break;
}
if ( NULL != pEffect )
m_arrEffects.Add( pEffect );
}
}
void CEffectContainer::fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
void CEffectContainer::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:cont") == sName )
m_eType = et_a_cont;
else if ( _T("a:effectDag") == sName )
m_eType = et_a_effectDag;
else
{
oReader.ReadTillEnd();
return;
}
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
sName = oReader.GetName();
wchar_t wChar = sName[2];
WritingElement* pEffect = NULL;
switch(wChar)
{
case 'a':
if ( _T("a:alphaBiLevel") == sName )
pEffect = new CAlphaBiLevelEffect( oReader );
else if ( _T("a:alphaCeiling") == sName )
pEffect = new CAlphaCeilingEffect( oReader );
else if ( _T("a:alphaFloor") == sName )
pEffect = new CAlphaFloorEffect( oReader );
else if ( _T("a:alphaInv") == sName )
pEffect = new CAlphaInverseEffect( oReader );
else if ( _T("a:alphaMod") == sName )
pEffect = new CAlphaModulateEffect( oReader );
else if ( _T("a:alphaModFix") == sName )
pEffect = new CAlphaModulateFixedEffect( oReader );
else if ( _T("a:alphaOutset") == sName )
pEffect = new CAlphaOutsetEffect( oReader );
else if ( _T("a:alphaRepl") == sName )
pEffect = new CAlphaReplaceEffect( oReader );
break;
case 'b':
if ( _T("a:biLevel") == sName )
pEffect = new CBiLevelEffect( oReader );
else if ( _T("a:blend") == sName )
pEffect = new CBlendEffect( oReader );
else if ( _T("a:blur") == sName )
pEffect = new CBlurEffect( oReader );
break;
case 'c':
if ( _T("a:clrChange") == sName )
pEffect = new CColorChangeEffect( oReader );
else if ( _T("a:clrRepl") == sName )
pEffect = new CColorReplaceEffect( oReader );
else if ( _T("a:cont") == sName )
pEffect = new CEffectContainer( oReader );
break;
case 'd':
if ( _T("a:duotone") == sName )
pEffect = new CDuotoneEffect( oReader );
break;
case 'e':
if ( _T("a:effect") == sName )
pEffect = new CEffectReference( oReader );
break;
case 'f':
if ( _T("a:fill") == sName )
pEffect = new CFillEffect( oReader );
else if ( _T("a:fillOverlay") == sName )
pEffect = new CFillOverlayEffect( oReader );
break;
case 'g':
if ( _T("a:glow") == sName )
pEffect = new CGlowEffect( oReader );
else if ( _T("a:grayscl") == sName )
pEffect = new CGrayscaleEffect( oReader );
break;
case 'h':
if ( _T("a:hsl") == sName )
pEffect = new CHSLEffect( oReader );
break;
case 'i':
if ( _T("a:innerShdw") == sName )
pEffect = new CInnerShadowEffect( oReader );
break;
case 'l':
if ( _T("a:lum") == sName )
pEffect = new CLuminanceEffect( oReader );
break;
case 'o':
if ( _T("a:outerShdw") == sName )
pEffect = new COuterShadowEffect( oReader );
break;
case 'p':
if ( _T("a:prstShdw") == sName )
pEffect = new CPresetShadowEffect( oReader );
break;
case 'r':
if ( _T("a:reflection") == sName )
pEffect = new CReflectionEffect( oReader );
else if ( _T("a:relOff") == sName )
pEffect = new CRelativeOffsetEffect( oReader );
break;
case 's':
if ( _T("a:softEdge") == sName )
pEffect = new CSoftEdgesEffect( oReader );
break;
case 't':
if ( _T("a:tint") == sName )
pEffect = new CTintEffect( oReader );
break;
case 'x':
if ( _T("a:xfrm") == sName )
pEffect = new CTransformEffect( oReader );
break;
}
if ( NULL != pEffect )
m_arrEffects.Add( pEffect );
}
}
CString CEffectContainer::toXML() const
{
CString sResult;
if ( et_a_cont == m_eType )
sResult = _T("<a:cont ");
else if ( et_a_effectDag == m_eType )
sResult = _T("<a:effectDag ");
else
return _T("");
if ( m_sName.IsInit() )
{
sResult += _T("name=\"");
sResult += m_sName->GetString();
sResult += _T("\" ");
}
sResult += _T("type=\"") + m_oType.ToString() + _T("\">");
for ( int nIndex = 0; nIndex < m_arrEffects.GetSize(); nIndex++ )
sResult += m_arrEffects[nIndex]->toXML();
if ( et_a_cont == m_eType )
sResult += _T("</a:cont>");
else if ( et_a_effectDag == m_eType )
sResult = _T("</a:effectDag>");
return sResult;
}
CEffectList::CEffectList(const CEffectList& oOther)
{
Clear();
for ( int nIndex = 0; nIndex < oOther.m_arrEffects.GetSize(); nIndex++ )
{
OOX::EElementType eType = oOther.m_arrEffects[nIndex]->getType();
WritingElement *pEffect = NULL;
switch ( eType )
{
case et_a_blur: pEffect = new CBlurEffect ( (const CBlurEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_fillOverlay: pEffect = new CFillOverlayEffect ( (const CFillOverlayEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_glow: pEffect = new CGlowEffect ( (const CGlowEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_innerShdw: pEffect = new CInnerShadowEffect ( (const CInnerShadowEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_outerShdw: pEffect = new COuterShadowEffect ( (const COuterShadowEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_prstShdw: pEffect = new CPresetShadowEffect( (const CPresetShadowEffect&)*oOther.m_arrEffects[nIndex] ); break;
case et_a_reflection: pEffect = new CReflectionEffect ( (const CReflectionEffect&) *oOther.m_arrEffects[nIndex] ); break;
case et_a_softEdge: pEffect = new CSoftEdgesEffect ( (const CSoftEdgesEffect&) *oOther.m_arrEffects[nIndex] ); break;
}
if ( NULL != pEffect )
m_arrEffects.Add( pEffect );
}
}
void CEffectList::fromXML(XmlUtils::CXmlNode& oNode)
{
}
void CEffectList::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
wchar_t wChar = sName[2];
WritingElement* pEffect = NULL;
switch(wChar)
{
case 'b':
if ( _T("a:blur") == sName )
pEffect = new CBlurEffect( oReader );
break;
case 'f':
if ( _T("a:fillOverlay") == sName )
pEffect = new CFillOverlayEffect( oReader );
break;
case 'g':
if ( _T("a:glow") == sName )
pEffect = new CGlowEffect( oReader );
break;
case 'i':
if ( _T("a:innerShdw") == sName )
pEffect = new CInnerShadowEffect( oReader );
break;
case 'o':
if ( _T("a:outerShdw") == sName )
pEffect = new COuterShadowEffect( oReader );
break;
case 'p':
if ( _T("a:prstShdw") == sName )
pEffect = new CPresetShadowEffect( oReader );
break;
case 'r':
if ( _T("a:reflection") == sName )
pEffect = new CReflectionEffect( oReader );
break;
case 's':
if ( _T("a:softEdge") == sName )
pEffect = new CSoftEdgesEffect( oReader );
break;
}
if ( NULL != pEffect )
m_arrEffects.Add( pEffect );
}
}
CString CEffectList::toXML() const
{
CString sResult = _T("<a:effectLst>");
for ( int nIndex = 0; nIndex < m_arrEffects.GetSize(); nIndex++ )
sResult += m_arrEffects[nIndex]->toXML();
sResult += _T("</a:effectLst>");
return sResult;
}
void CGradientFillProperties::fromXML(XmlUtils::CXmlNode& oNode)
{
m_eGradType = gradfilltypeUnknown;
}
void CGradientFillProperties::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eGradType = gradfilltypeUnknown;
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:gsLst") == sName )
m_oGsLst = oReader;
else if ( _T("a:lin") == sName )
{
m_oLin = oReader;
m_eGradType = gradfilltypeLinear;
}
else if ( _T("a:path") == sName )
{
m_oPath = oReader;
m_eGradType = gradfilltypePath;
}
else if ( _T("a:tileRect") == sName )
m_oTileRect = oReader;
}
}
CString CGradientFillProperties::toXML() const
{
CString sResult = _T("<a:gradFill ");
if ( m_oFlip.IsInit() )
{
sResult += _T("flip=\"");
sResult += m_oFlip->ToString();
sResult += _T("\" ");
}
if ( m_oRotWithShape.IsInit() )
{
sResult += _T("rotWithShape=\"");
sResult += m_oRotWithShape->ToString();
sResult += _T("\" ");
}
sResult += _T(">");
if ( m_oGsLst.IsInit() )
sResult += m_oGsLst->toXML();
if ( m_oLin.IsInit() && gradfilltypeLinear == m_eGradType )
sResult += m_oLin->toXML();
if ( m_oPath.IsInit() && gradfilltypePath == m_eGradType )
sResult += m_oPath->toXML();
if ( m_oTileRect.IsInit() )
sResult += m_oTileRect->toXML();
sResult += _T("</a:gradFill>");
return sResult;
}
}
} // OOX

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,169 @@
/*
* (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_LOGIC_DRAWING_EXT_INCLUDE_H_
#define OOX_LOGIC_DRAWING_EXT_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../WritingElement.h"
namespace OOX
{
namespace Drawing
{
class COfficeArtExtension : public WritingElement
{
public:
WritingElement_AdditionConstructors(COfficeArtExtension)
COfficeArtExtension()
{
}
virtual ~COfficeArtExtension()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("uri"), m_oUri );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
}
virtual CString toXML() const
{
CString sResult = _T("<a:ext ");
if ( m_oUri.IsInit() )
{
sResult += _T("uri=\"");
sResult += m_oUri->GetString();
sResult += _T("\">");
}
else
sResult += _T(">");
sResult += _T("</a:ext>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_ext;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("uri"), m_oUri )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString> m_oUri;
};
class COfficeArtExtensionList : public WritingElement
{
public:
WritingElement_AdditionConstructors(COfficeArtExtensionList)
COfficeArtExtensionList()
{
}
virtual ~COfficeArtExtensionList()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:ext") == sName )
{
OOX::Drawing::COfficeArtExtension oExt = oReader;
m_arrExt.Add( oExt );
}
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:extLst>");
for ( int nIndex = 0; nIndex < m_arrExt.GetSize(); nIndex++ )
sResult += m_arrExt[nIndex].toXML();
sResult += _T("</a:extLst>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_extLst;
}
public:
CSimpleArray<OOX::Drawing::COfficeArtExtension> m_arrExt;
};
}
}
#endif // OOX_LOGIC_DRAWING_EXT_INCLUDE_H_

View File

@@ -0,0 +1,155 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_LOGIC_DRAWING_GAPHIC_INFO_INCLUDE_H_
#define OOX_LOGIC_DRAWING_GAPHIC_INFO_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../../Common/SimpleTypes_Drawing.h"
#include "../../Common/SimpleTypes_Shared.h"
#include "../WritingElement.h"
#include "../RId.h"
#include "DrawingExt.h"
#include "DrawingStyles.h"
#include "DrawingShape.h"
#include "DrawingTransform.h"
#include "DrawingPicture.h"
#include "DrawingCoreInfo.h"
namespace OOX
{
namespace Drawing
{
enum EGraphicType
{
graphictypePicture = 0,
graphictypeLockedCanvas = 1,
graphictypeChart = 2,
graphictypeDiagram = 3,
};
class CGraphic : public WritingElement
{
public:
WritingElement_AdditionConstructors(CGraphic)
CGraphic()
{
}
virtual ~CGraphic()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nGraphicDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nGraphicDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:graphicData") == sName )
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
break;
int nGraphicDataDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nGraphicDataDepth ) )
{
sName = oReader.GetName();
if ( _T("pic:pic") == sName )
{
m_oPicture = oReader;
m_eGraphicType = graphictypePicture;
}
else if ( _T("c:chart") == sName )
{
m_oChart = oReader;
m_eGraphicType = graphictypeChart;
}
}
}
}
}
virtual CString toXML() const
{
return _T("");
}
virtual EElementType getType() const
{
return OOX::et_a_graphic;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("uri"), m_sUri )
WritingElement_ReadAttributes_End( oReader )
}
public:
EGraphicType m_eGraphicType;
nullable<CString> m_sUri;
nullable<OOX::Drawing::CPicture> m_oPicture;
nullable<OOX::Drawing::CChart> m_oChart;
};
}
}
#endif // OOX_LOGIC_DRAWING_GAPHIC_INFO_INCLUDE_H_

View File

@@ -0,0 +1,228 @@
/*
* (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_LOGIC_DRAWING_PICTURE_INCLUDE_H_
#define OOX_LOGIC_DRAWING_PICTURE_INCLUDE_H_
#include "DrawingCoreInfo.h"
#include "DrawingEffects.h"
namespace OOX
{
namespace Drawing
{
class CPictureNonVisual : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPictureNonVisual)
CPictureNonVisual()
{
m_eType = et_Unknown;
}
virtual ~CPictureNonVisual()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("pic:nvPicPr") == sName )
m_eType = et_pic_nvPicPr;
else
return;
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
sName = oReader.GetName();
if ( _T("pic:cNvPicPr") == sName )
m_oCNvPicPr = oReader;
else if ( _T("pic:cNvPr") == sName )
m_oCNvPr = oReader;
}
}
virtual CString toXML() const
{
CString sResult;
if ( et_pic_nvPicPr == m_eType )
sResult = _T("<pic:nvPicPr>");
else
return _T("");
sResult += m_oCNvPr.toXML();
sResult += m_oCNvPicPr.toXML();
if ( et_pic_nvPicPr == m_eType )
sResult += _T("</pic:nvPicPr>");
return sResult;
}
virtual EElementType getType() const
{
return m_eType;
}
public:
EElementType m_eType;
OOX::Drawing::CNonVisualPictureProperties m_oCNvPicPr;
OOX::Drawing::CNonVisualDrawingProps m_oCNvPr;
};
class CPicture : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPicture)
CPicture()
{
}
virtual ~CPicture()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("pic:nvPicPr") == sName )
m_oNvPicPr = oReader;
else if ( _T("pic:blipFill") == sName )
m_oBlipFill = oReader;
else if ( _T("pic:spPr") == sName )
m_oSpPr = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<pic:pic>");
sResult += m_oNvPicPr.toXML();
sResult += m_oBlipFill.toXML();
sResult += m_oSpPr.toXML();
sResult += _T("</pic:pic>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_pic_pic;
}
public:
OOX::Drawing::CBlipFillProperties m_oBlipFill;
OOX::Drawing::CPictureNonVisual m_oNvPicPr;
OOX::Drawing::CShapeProperties m_oSpPr;
};
class CChart : public WritingElement
{
public:
WritingElement_AdditionConstructors(CChart)
CChart()
{
}
virtual ~CChart()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
return _T("");
}
virtual EElementType getType() const
{
return OOX::et_c_chart;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_oRId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CRelationshipId> m_oRId;
};
}
}
#endif // OOX_LOGIC_DRAWING_PICTURE_INCLUDE_H_

View File

@@ -0,0 +1,176 @@
/*
* (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_LOGIC_DRAWING_RUN_INCLUDE_H_
#define OOX_LOGIC_DRAWING_RUN_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../../Common/SimpleTypes_Drawing.h"
#include "../../Common/SimpleTypes_Shared.h"
#include "../WritingElement.h"
namespace OOX
{
namespace Drawing
{
class CTextFont : public WritingElement
{
public:
WritingElement_AdditionConstructors(CTextFont)
CTextFont()
{
m_eType = et_Unknown;
}
virtual ~CTextFont()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("a:cs") == sName )
m_eType = et_a_cs;
else if ( _T("a:ea") == sName )
m_eType = et_a_ea;
else if ( _T("a:latin") == sName )
m_eType = et_a_latin;
else if ( _T("a:sym") == sName )
m_eType = et_a_sym;
else
return;
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult;
switch ( m_eType )
{
case et_a_cs: sResult = _T("<a:cs"); break;
case et_a_ea: sResult = _T("<a:ea"); break;
case et_a_latin: sResult = _T("<a:latin"); break;
case et_a_sym: sResult = _T("<a:sym"); break;
default: return _T("");
}
if ( m_oTypeFace.IsInit() )
sResult += _T(" typeface=\"") + m_oTypeFace->ToString() + _T("\"");
if ( m_oPanose.IsInit() )
sResult += _T(" panose=\"") + m_oPanose->ToString() + _T("\"");
if ( SimpleTypes::pitchfamilyDefUnk != m_oPitchFamily.GetValue() )
sResult += _T(" pitchFamily=\"") + m_oPitchFamily.ToString() + _T("\"");
if ( SimpleTypes::fontcharsetDefault != m_oCharset.GetValue() )
sResult += _T(" charset=\"") + m_oCharset.ToString() + _T("\"");
sResult += _T("/>");
return sResult;
}
virtual EElementType getType() const
{
return m_eType;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.GetAttributesCount() <= 0 )
return;
if ( !oReader.MoveToFirstAttribute() )
return;
CWCharWrapper wsName = oReader.GetName();
while( !wsName.IsNull() )
{
wchar_t wsChar0 = wsName[0];
switch ( wsChar0 )
{
case 'c':
if ( _T("charset") == wsName ) m_oCharset = oReader.GetText();
break;
case 'p':
if ( _T("panose") == wsName ) m_oPanose = oReader.GetText();
else if ( _T("pitchFamily") == wsName ) m_oPitchFamily = oReader.GetText();
break;
case 't':
if ( _T("typeface") == wsName ) m_oTypeFace = oReader.GetText();
break;
}
if ( !oReader.MoveToNextAttribute() )
break;
wsName = oReader.GetName();
}
oReader.MoveToElement();
}
public:
EElementType m_eType;
SimpleTypes::CFontCharset<SimpleTypes::fontcharsetDefault> m_oCharset;
nullable<SimpleTypes::CPanose> m_oPanose;
SimpleTypes::CPitchFamily<SimpleTypes::pitchfamilyDefUnk> m_oPitchFamily;
nullable<SimpleTypes::CTextTypeface> m_oTypeFace;
};
}
}
#endif // OOX_LOGIC_DRAWING_RUN_INCLUDE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,696 @@
/*
* (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_LOGIC_DRAWING_SHARED_INCLUDE_H_
#define OOX_LOGIC_DRAWING_SHARED_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../../Common/SimpleTypes_Drawing.h"
#include "../../Common/SimpleTypes_Shared.h"
#include "../WritingElement.h"
#include "DrawingExt.h"
namespace OOX
{
namespace Drawing
{
class CColorMapping : public WritingElement
{
public:
WritingElement_AdditionConstructors(CColorMapping)
CColorMapping()
{
m_eType = et_Unknown;
}
virtual ~CColorMapping()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("a:clrMap") == sName )
m_eType = et_a_clrMap;
else if ( _T("a:overrideClrMapping") == sName )
m_eType = et_a_overrideClrMapping;
else
return;
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
}
}
virtual CString toXML() const
{
if ( et_a_clrMap == m_eType )
{
CString sResult = _T("<a:clrMap bg1=\"") + m_oBg1.ToString() +
_T("\" tx1=\"") + m_oTx1.ToString() +
_T("\" bg2=\"") + m_oBg2.ToString() +
_T("\" tx2=\"") + m_oTx2.ToString() +
_T("\" accent1=\"") + m_oAccent1.ToString() +
_T("\" accent2=\"") + m_oAccent2.ToString() +
_T("\" accent3=\"") + m_oAccent3.ToString() +
_T("\" accent4=\"") + m_oAccent4.ToString() +
_T("\" accent5=\"") + m_oAccent5.ToString() +
_T("\" accent6=\"") + m_oAccent6.ToString() + _T("\"");
if ( m_oExtLst.IsInit() )
{
sResult += _T(">");
sResult += m_oExtLst->toXML();
sResult += _T("</a:clrMap>");
}
else
sResult += _T("/>");
return sResult;
}
else if ( et_a_overrideClrMapping == m_eType )
{
CString sResult = _T("<a:overrideClrMapping bg1=\"") + m_oBg1.ToString() +
_T("\" tx1=\"") + m_oTx1.ToString() +
_T("\" bg2=\"") + m_oBg2.ToString() +
_T("\" tx2=\"") + m_oTx2.ToString() +
_T("\" accent1=\"") + m_oAccent1.ToString() +
_T("\" accent2=\"") + m_oAccent2.ToString() +
_T("\" accent3=\"") + m_oAccent3.ToString() +
_T("\" accent4=\"") + m_oAccent4.ToString() +
_T("\" accent5=\"") + m_oAccent5.ToString() +
_T("\" accent6=\"") + m_oAccent6.ToString() + _T("\"");
if ( m_oExtLst.IsInit() )
{
sResult += _T(">");
sResult += m_oExtLst->toXML();
sResult += _T("</a:overrideClrMapping>");
}
else
sResult += _T("/>");
return sResult;
}
return _T("");
}
virtual EElementType getType() const
{
return m_eType;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.GetAttributesCount() <= 0 )
return;
if ( !oReader.MoveToFirstAttribute() )
return;
CWCharWrapper wsName = oReader.GetName();
while( !wsName.IsNull() )
{
wchar_t wsChar0 = wsName[0];
switch ( wsChar0 )
{
case 'a':
if ( _T("accent1") == wsName ) m_oAccent1 = oReader.GetText();
else if ( _T("accent2") == wsName ) m_oAccent2 = oReader.GetText();
else if ( _T("accent3") == wsName ) m_oAccent3 = oReader.GetText();
else if ( _T("accent4") == wsName ) m_oAccent4 = oReader.GetText();
else if ( _T("accent5") == wsName ) m_oAccent5 = oReader.GetText();
else if ( _T("accent6") == wsName ) m_oAccent6 = oReader.GetText();
break;
case 'b':
if ( _T("bg1") == wsName ) m_oBg1 = oReader.GetText();
else if ( _T("bg2") == wsName ) m_oBg2 = oReader.GetText();
break;
case 'f':
if ( _T("folHlink") == wsName ) m_oFloHlink = oReader.GetText();
break;
case 'h':
if ( _T("hlink") == wsName ) m_oHlink = oReader.GetText();
break;
case 't':
if ( _T("tx1") == wsName ) m_oTx1 = oReader.GetText();
else if ( _T("tx2") == wsName ) m_oTx2 = oReader.GetText();
break;
}
if ( !oReader.MoveToNextAttribute() )
break;
wsName = oReader.GetName();
}
oReader.MoveToElement();
}
public:
EElementType m_eType;
SimpleTypes::CColorSchemeIndex<> m_oAccent1;
SimpleTypes::CColorSchemeIndex<> m_oAccent2;
SimpleTypes::CColorSchemeIndex<> m_oAccent3;
SimpleTypes::CColorSchemeIndex<> m_oAccent4;
SimpleTypes::CColorSchemeIndex<> m_oAccent5;
SimpleTypes::CColorSchemeIndex<> m_oAccent6;
SimpleTypes::CColorSchemeIndex<> m_oBg1;
SimpleTypes::CColorSchemeIndex<> m_oBg2;
SimpleTypes::CColorSchemeIndex<> m_oFloHlink;
SimpleTypes::CColorSchemeIndex<> m_oHlink;
SimpleTypes::CColorSchemeIndex<> m_oTx1;
SimpleTypes::CColorSchemeIndex<> m_oTx2;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
};
class CColorScheme : public WritingElement
{
public:
WritingElement_AdditionConstructors(CColorScheme)
CColorScheme()
{
}
virtual ~CColorScheme()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:accent1") == sName )
m_oAccent1 = oReader;
else if ( _T("a:accent2") == sName )
m_oAccent2 = oReader;
else if ( _T("a:accent3") == sName )
m_oAccent3 = oReader;
else if ( _T("a:accent4") == sName )
m_oAccent4 = oReader;
else if ( _T("a:accent5") == sName )
m_oAccent5 = oReader;
else if ( _T("a:accent6") == sName )
m_oAccent6 = oReader;
else if ( _T("a:dk1") == sName )
m_oDk1 = oReader;
else if ( _T("a:dk2") == sName )
m_oDk2 = oReader;
else if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
else if ( _T("a:folHlink") == sName )
m_oFolHlink = oReader;
else if ( _T("a:hlink") == sName )
m_oHlink = oReader;
else if ( _T("a:lt1") == sName )
m_oLt1 = oReader;
else if ( _T("a:lt2") == sName )
m_oLt2 = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:clrScheme name=\"") + m_sName + _T("\">");
sResult += m_oDk1.toXML();
sResult += m_oLt1.toXML();
sResult += m_oDk2.toXML();
sResult += m_oLt2.toXML();
sResult += m_oAccent1.toXML();
sResult += m_oAccent2.toXML();
sResult += m_oAccent3.toXML();
sResult += m_oAccent4.toXML();
sResult += m_oAccent5.toXML();
sResult += m_oAccent6.toXML();
sResult += m_oHlink.toXML();
sResult += m_oFolHlink.toXML();
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
sResult += _T("</a:clrScheme>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_clrScheme;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("name"), m_sName )
WritingElement_ReadAttributes_End( oReader )
}
public:
CString m_sName;
OOX::Drawing::CStyleColor m_oAccent1;
OOX::Drawing::CStyleColor m_oAccent2;
OOX::Drawing::CStyleColor m_oAccent3;
OOX::Drawing::CStyleColor m_oAccent4;
OOX::Drawing::CStyleColor m_oAccent5;
OOX::Drawing::CStyleColor m_oAccent6;
OOX::Drawing::CStyleColor m_oDk1;
OOX::Drawing::CStyleColor m_oDk2;
OOX::Drawing::CStyleColor m_oFolHlink;
OOX::Drawing::CStyleColor m_oHlink;
OOX::Drawing::CStyleColor m_oLt1;
OOX::Drawing::CStyleColor m_oLt2;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
};
class CCustomColorList : public WritingElement
{
public:
WritingElement_AdditionConstructors(CCustomColorList)
CCustomColorList()
{
}
virtual ~CCustomColorList()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:custClr") == sName )
{
OOX::Drawing::CCustomColor oCustClr = oReader;
m_arrCustClr.Add( oCustClr );
}
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:custClrLst>");
for ( int nIndex = 0; nIndex < m_arrCustClr.GetSize(); nIndex++ )
sResult += m_arrCustClr[nIndex].toXML();
sResult += _T("</a:custClrLst>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_custClrLst;
}
public:
CSimpleArray<OOX::Drawing::CCustomColor> m_arrCustClr;
};
class CColorSchemeAndMapping : public WritingElement
{
public:
WritingElement_AdditionConstructors(CColorSchemeAndMapping)
CColorSchemeAndMapping()
{
}
virtual ~CColorSchemeAndMapping()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:clrScheme") == sName )
m_oClrScheme = oReader;
else if ( _T("a:clrMap") == sName )
m_oClrMap = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:extraClrScheme>");
sResult += m_oClrScheme.toXML();
if ( m_oClrMap.IsInit() )
sResult += m_oClrMap->toXML();
sResult += _T("</a:extraClrScheme>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_extraClrScheme;
}
public:
OOX::Drawing::CColorScheme m_oClrScheme;
nullable<OOX::Drawing::CColorMapping> m_oClrMap;
};
class CColorSchemeList : public WritingElement
{
public:
WritingElement_AdditionConstructors(CColorSchemeList)
CColorSchemeList()
{
}
virtual ~CColorSchemeList()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:extraClrScheme") == sName )
{
OOX::Drawing::CColorSchemeAndMapping oExtra = oReader;
m_arrExtraClrScheme.Add( oExtra );
}
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:extraClrSchemeLst>");
for ( int nIndex = 0; nIndex < m_arrExtraClrScheme.GetSize(); nIndex++ )
sResult += m_arrExtraClrScheme[nIndex].toXML();
sResult += _T("</a:extraClrSchemeLst>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_extraClrSchemeLst;
}
public:
CSimpleArray<OOX::Drawing::CColorSchemeAndMapping> m_arrExtraClrScheme;
};
class CMasterColorMapping : public WritingElement
{
public:
WritingElement_AdditionConstructors(CMasterColorMapping)
CMasterColorMapping()
{
}
virtual ~CMasterColorMapping()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
return _T("<a:masterClrMapping/>");
}
virtual EElementType getType() const
{
return OOX::et_a_masterClrMapping;
}
};
class CObjectStyleDefaults : public WritingElement
{
public:
WritingElement_AdditionConstructors(CObjectStyleDefaults)
CObjectStyleDefaults()
{
}
virtual ~CObjectStyleDefaults()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
else if ( _T("a:lnDef") == sName )
m_oLnDef = oReader;
else if ( _T("a:spDef") == sName )
m_oSpDef = oReader;
else if ( _T("a:txDef") == sName )
m_oTxDef = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:objectDefaults>");
if ( m_oSpDef.IsInit() )
sResult += m_oSpDef->toXML();
if ( m_oLnDef.IsInit() )
sResult += m_oLnDef->toXML();
if ( m_oTxDef.IsInit() )
sResult += m_oTxDef->toXML();
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
sResult += _T("</a:objectDefaults>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_objectDefaults;
}
public:
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
nullable<OOX::Drawing::CDefaultShapeDefinition> m_oLnDef;
nullable<OOX::Drawing::CDefaultShapeDefinition> m_oSpDef;
nullable<OOX::Drawing::CDefaultShapeDefinition> m_oTxDef;
};
class CBaseStyles : public WritingElement
{
public:
WritingElement_AdditionConstructors(CBaseStyles)
CBaseStyles()
{
}
virtual ~CBaseStyles()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:clrScheme") == sName )
m_oClrScheme = oReader;
else if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
else if ( _T("a:fmtScheme") == sName )
m_oFmtScheme = oReader;
else if ( _T("a:fontScheme") == sName )
m_oFontScheme = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:themeElements>");
sResult += m_oClrScheme.toXML();
sResult += m_oFontScheme.toXML();
sResult += m_oFmtScheme.toXML();
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
sResult += _T("</a:themeElements>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_themeElements;
}
public:
OOX::Drawing::CColorScheme m_oClrScheme;
OOX::Drawing::CStyleMatrix m_oFmtScheme;
OOX::Drawing::CFontScheme m_oFontScheme;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
};
}
}
#endif // OOX_LOGIC_DRAWING_SHARED_INCLUDE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,267 @@
/*
* (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_LOGIC_DRAWING_STYLES2_INCLUDE_H_
#define OOX_LOGIC_DRAWING_STYLES2_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../../Common/SimpleTypes_Drawing.h"
#include "../../Common/SimpleTypes_Shared.h"
#include "../../Common/SimpleTypes_Word.h"
#include "../WritingElement.h"
#include "DrawingExt.h"
#include "Drawing3D.h"
namespace OOX
{
namespace Drawing
{
class CFontReference : public OOX::Drawing::CColor
{
public:
WritingElement_AdditionConstructors(CFontReference)
CFontReference()
{
}
virtual ~CFontReference()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
CColor::fromXML( oNode );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
CColor::fromXML( oReader );
}
virtual CString toXML() const
{
CString sResult = _T("<a:fontRef idx=\"") + m_oIdx.ToString() + _T("\">");
sResult += CColor::toXML();
sResult += _T("</a:fontRef>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_fontRef;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("idx"), m_oIdx )
WritingElement_ReadAttributes_End( oReader )
}
public:
SimpleTypes::CFontCollectionIndex<> m_oIdx;
};
class CScene3D : public WritingElement
{
public:
WritingElement_AdditionConstructors(CScene3D)
CScene3D()
{
}
virtual ~CScene3D()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:backdrop") == sName )
m_oBackdrop = oReader;
else if ( _T("a:camera") == sName )
m_oCamera = oReader;
else if ( _T("a:extLst") == sName )
m_oExtLst = oReader;
else if ( _T("a:lightRig") == sName )
m_oLightRig = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<a:scene3d>");
sResult += m_oCamera.toXML();
sResult += m_oLightRig.toXML();
if ( m_oBackdrop.IsInit() )
sResult += m_oBackdrop->toXML();
if ( m_oExtLst.IsInit() )
sResult += m_oExtLst->toXML();
sResult += _T("</a:scene3d>");
return sResult;
}
virtual EElementType getType() const
{
return OOX::et_a_scene3d;
}
public:
OOX::Drawing::CCamera m_oCamera;
OOX::Drawing::CLightRig m_oLightRig;
nullable<OOX::Drawing::CBackdrop> m_oBackdrop;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
};
}
namespace Drawing
{
class CStyleMatrixReference : public OOX::Drawing::CColor
{
public:
WritingElement_AdditionConstructors(CStyleMatrixReference)
CStyleMatrixReference()
{
}
virtual ~CStyleMatrixReference()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
CColor::fromXML( oNode );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
CWCharWrapper sName = oReader.GetName();
if ( _T("a:effectRef") == sName )
m_eType = et_a_effectRef;
else if ( _T("a:fillRef") == sName )
m_eType = et_a_fillRef;
else if ( _T("a:lnRef") == sName )
m_eType = et_a_lnRef;
else
return;
ReadAttributes( oReader );
CColor::fromXML( oReader );
}
virtual CString toXML() const
{
CString sResult;
switch ( m_eType )
{
case et_a_effectRef: sResult = _T("<a:effectRef idx=\"") + m_oIdx.ToString() + _T("\">");
case et_a_fillRef : sResult = _T("<a:fillRef idx=\"") + m_oIdx.ToString() + _T("\">");
case et_a_lnRef : sResult = _T("<a:lnRef idx=\"") + m_oIdx.ToString() + _T("\">");
default: return _T("");
}
sResult += CColor::toXML();
switch ( m_eType )
{
case et_a_effectRef: sResult += _T("</a:effectRef>");
case et_a_fillRef : sResult += _T("</a:fillRef>");
case et_a_lnRef : sResult += _T("</a:lnRef>");
}
return sResult;
}
virtual EElementType getType() const
{
return m_eType;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("idx"), m_oIdx )
WritingElement_ReadAttributes_End( oReader )
}
public:
EElementType m_eType;
SimpleTypes::CDecimalNumber<> m_oIdx;
};
}
}
#endif // OOX_LOGIC_DRAWING_STYLES_INCLUDE2_H_

View File

@@ -0,0 +1,288 @@
/*
* (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_LOGIC_DRAWING_TRANSFORM_INCLUDE_H_
#define OOX_LOGIC_DRAWING_TRANSFORM_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../../Common/SimpleTypes_Drawing.h"
#include "../../Common/ComplexTypes.h"
#include "../WritingElement.h"
namespace OOX
{
namespace Drawing
{
class CGroupTransform2D : public WritingElement
{
public:
WritingElement_AdditionConstructors(CGroupTransform2D)
CGroupTransform2D()
{
m_eType = et_Unknown;
}
virtual ~CGroupTransform2D()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("a:xfrm") == sName )
m_eType = et_a_xfrm;
else
return;
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
sName = oReader.GetName();
if ( _T("a:chExt") == sName )
m_oChExt = oReader;
else if ( _T("a:chOff") == sName )
m_oChOff = oReader;
else if ( _T("a:ext") == sName )
m_oExt = oReader;
else if ( _T("a:off") == sName )
m_oOff = oReader;
}
}
virtual CString toXML() const
{
CString sResult;
switch ( m_eType )
{
case et_a_xfrm:
sResult = _T("<a:xfrm flipH=\"") + m_oFlipH.ToString()
+ _T("\" flipV=\"") + m_oFlipV.ToString()
+ _T("\" rot=\"") + m_oRot.ToString()
+ _T("\">");
break;
default:
return _T("");
}
if ( m_oOff.IsInit() )
sResult += _T("<a:off ") + m_oOff->ToString() + _T("/>");
if ( m_oExt.IsInit() )
sResult += _T("<a:ext ") + m_oExt->ToString() + _T("/>");
if ( m_oChOff.IsInit() )
sResult += _T("<a:chOff ") + m_oChOff->ToString() + _T("/>");
if ( m_oChExt.IsInit() )
sResult += _T("<a:chExt ") + m_oChExt->ToString() + _T("/>");
switch ( m_eType )
{
case et_a_xfrm: sResult = _T("</a:xfrm>"); break;
}
return sResult;
}
virtual EElementType getType() const
{
return m_eType;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("flipH"), m_oFlipH )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("flipV"), m_oFlipV )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rot"), m_oRot )
WritingElement_ReadAttributes_End( oReader )
}
public:
EElementType m_eType;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oFlipH;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oFlipV;
SimpleTypes::CAngle<0> m_oRot;
nullable<ComplexTypes::Drawing::CPositiveSize2D> m_oChExt;
nullable<ComplexTypes::Drawing::CPoint2D> m_oChOff;
nullable<ComplexTypes::Drawing::CPositiveSize2D> m_oExt;
nullable<ComplexTypes::Drawing::CPositiveSize2D> m_oOff;
};
class CTransform2D : public WritingElement
{
public:
WritingElement_AdditionConstructors(CTransform2D)
CTransform2D()
{
m_eType = et_Unknown;
}
virtual ~CTransform2D()
{
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
CWCharWrapper sName = oReader.GetName();
if ( _T("a:xfrm") == sName )
m_eType = et_a_xfrm;
else
return;
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nCurDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nCurDepth ) )
{
sName = oReader.GetName();
if ( _T("a:ext") == sName )
m_oExt = oReader;
else if ( _T("a:off") == sName )
m_oOff = oReader;
}
}
virtual CString toXML() const
{
CString sResult;
switch ( m_eType )
{
case et_a_xfrm:
sResult = _T("<a:xfrm flipH=\"") + m_oFlipH.ToString()
+ _T("\" flipV=\"") + m_oFlipV.ToString()
+ _T("\" rot=\"") + m_oRot.ToString()
+ _T("\">");
break;
default:
return _T("");
}
if ( m_oOff.IsInit() )
sResult += _T("<a:off ") + m_oOff->ToString() + _T("/>");
if ( m_oExt.IsInit() )
sResult += _T("<a:ext ") + m_oExt->ToString() + _T("/>");
switch ( m_eType )
{
case et_a_xfrm: sResult = _T("</a:xfrm>"); break;
}
return sResult;
}
virtual EElementType getType() const
{
return m_eType;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("flipH"), m_oFlipH )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("flipV"), m_oFlipV )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("rot"), m_oRot )
WritingElement_ReadAttributes_End( oReader )
}
public:
EElementType m_eType;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oFlipH;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oFlipV;
SimpleTypes::CAngle<0> m_oRot;
nullable<ComplexTypes::Drawing::CPositiveSize2D> m_oExt;
nullable<ComplexTypes::Drawing::CPositiveSize2D> m_oOff;
};
}
}
#endif // OOX_LOGIC_DRAWING_TRANSFORM_INCLUDE_H_

View File

@@ -0,0 +1,151 @@
/*
* (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_ENDNOTE_INCLUDE_H_
#define OOX_ENDNOTE_INCLUDE_H_
#include "File.h"
#include "IFileContainer.h"
#include "FtnEdn.h"
#include "Logic/RunContent.h"
namespace OOX
{
class CEndnotes : public OOX::File, public OOX::IFileContainer
{
public:
CEndnotes()
{
}
CEndnotes(const CPath& oPath)
{
read( oPath );
}
virtual ~CEndnotes()
{
for ( int nIndex = 0; nIndex < m_arrEndnote.GetSize(); nIndex++ )
{
if ( m_arrEndnote[nIndex] )
delete m_arrEndnote[nIndex];
}
m_arrEndnote.RemoveAll();
}
public:
virtual void read(const CPath& oPath)
{
IFileContainer::Read( oPath );
XmlUtils::CXmlNode oEndnotes;
oEndnotes.FromXmlFile( oPath.GetPath(), true );
if ( _T("w:endnotes") == oEndnotes.GetName() )
{
XmlUtils::CXmlNodes oEndnoteList;
oEndnotes.GetNodes( _T("w:endnote"), oEndnoteList );
for ( int nIndex = 0; nIndex < oEndnoteList.GetCount(); nIndex++ )
{
XmlUtils::CXmlNode oEndnoteNode;
if ( oEndnoteList.GetAt( nIndex, oEndnoteNode ) )
{
CFtnEdn *pEndnote = new CFtnEdn( oEndnoteNode );
m_arrEndnote.Add( pEndnote );
}
}
}
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
CString sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:endnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
for ( int nIndex = 0; nIndex < m_arrEndnote.GetSize(); nIndex++ )
{
if ( m_arrEndnote[nIndex] )
sXml += m_arrEndnote[nIndex]->toXML();
}
sXml += _T("</w:endnotes>");
CDirectory::SaveToFile( oPath.GetPath(), sXml );
oContent.Registration( type().OverrideType(), oDirectory, oPath );
IFileContainer::Write( oPath, oDirectory, oContent );
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::EndNote;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
public:
OOX::CFtnEdn *Find(const OOX::Logic::CEndnoteReference& oReference) const
{
if ( !oReference.m_oId.IsInit() )
return NULL;
for ( int nIndex = 0; nIndex < m_arrEndnote.GetSize(); nIndex++ )
{
if ( m_arrEndnote[nIndex]->m_oId.IsInit() && ( m_arrEndnote[nIndex]->m_oId == oReference.m_oId ) )
return m_arrEndnote[nIndex];
}
return NULL;
}
void Add(OOX::CFtnEdn* pEndnote)
{
m_arrEndnote.Add( pEndnote );
}
const int GetCount() const
{
return m_arrEndnote.GetSize();
}
public:
CSimpleArray<OOX::CFtnEdn*> m_arrEndnote;
};
}
#endif // OOX_ENDNOTE_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, CContentTypes& 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,83 @@
/*
* (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 "../XML/XmlSimple.h"
#include "../SystemUtility/SystemUtility.h"
#include "FileType.h"
#include "ContentTypes.h"
namespace OOX
{
class File
{
public:
File(){
m_bDoNotAddRels = false;
}
virtual ~File(){}
public:
virtual void read(const CPath& filename) = 0;
virtual void write(const CPath& filename, const CPath& directory, CContentTypes& content) const = 0;
public:
virtual const OOX::FileType type() const = 0;
virtual const CPath DefaultDirectory() const = 0;
virtual const CPath DefaultFileName() const = 0;
CString m_sFilename;
bool m_bDoNotAddRels;
};
class FileGlobalEnumerated : public File
{
private:
int m_nGlobalNumber;
public:
FileGlobalEnumerated()
{
m_nGlobalNumber = 0;
}
int GetGlobalNumber() const
{
return m_nGlobalNumber;
}
void SetGlobalNumber(int nValue)
{
m_nGlobalNumber = nValue;
}
};
}
#endif // OOX_FILE_INCLUDE_H_

View File

@@ -0,0 +1,124 @@
/*
* (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 "FileFactory.h"
#include "File.h"
#include "FileTypes.h"
#include "Rels.h"
#include "App.h"
#include "Core.h"
#include "Document.h"
#include "Theme/Theme.h"
#include "Theme/ThemeOverride.h"
#include "Settings/Settings.h"
#include "Settings/WebSettings.h"
#include "FontTable.h"
#include "Styles.h"
#include "Bibliography.h"
#include "FootNote.h"
#include "EndNote.h"
#include "Media\Image.h"
#include "Media\OleObject.h"
#include "Media\Audio.h"
#include "Media\Video.h"
#include "External\HyperLink.h"
#include "External\ExternalVideo.h"
#include "External\ExternalAudio.h"
#include "External\ExternalImage.h"
#include "HeaderFooter.h"
#include "Numbering.h"
#include "Comments.h"
#include "UnknowTypeFile.h"
namespace OOX
{
const smart_ptr<OOX::File> CreateFile(const OOX::CPath& oPath, const OOX::Rels::CRelationShip& oRelation)
{
const CPath oFileName = oPath / oRelation.Filename();
if ( oRelation.Type() == FileTypes::App )
return smart_ptr<OOX::File>(new CApp( oFileName ));
else if ( oRelation.Type() == FileTypes::Core)
return smart_ptr<OOX::File>(new CCore( oFileName ));
else if ( oRelation.Type() == FileTypes::Document)
return smart_ptr<OOX::File>(new CDocument( oFileName ));
else if ( oRelation.Type() == FileTypes::Theme)
return smart_ptr<OOX::File>(new CTheme( oFileName ));
else if ( oRelation.Type() == FileTypes::ThemeOverride)
return smart_ptr<OOX::File>(new CThemeOverride( oFileName ));
else if ( oRelation.Type() == FileTypes::Setting)
return smart_ptr<OOX::File>(new CSettings( oFileName ));
else if ( oRelation.Type() == FileTypes::FontTable)
return smart_ptr<OOX::File>(new CFontTable( oFileName ));
else if ( oRelation.Type() == FileTypes::Style)
return smart_ptr<OOX::File>(new CStyles( oFileName ));
else if ( oRelation.Type() == FileTypes::Bibliography)
return smart_ptr<OOX::File>(new CBibliography( oFileName ));
else if ( oRelation.Type() == FileTypes::FootNote)
return smart_ptr<OOX::File>(new CFootnotes( oFileName ));
else if ( oRelation.Type() == FileTypes::EndNote)
return smart_ptr<OOX::File>(new CEndnotes( oFileName ));
else if ( oRelation.Type() == FileTypes::WebSetting)
return smart_ptr<OOX::File>(new CWebSettings( oFileName ));
else if ( oRelation.Type() == FileTypes::HyperLink)
return smart_ptr<OOX::File>(new HyperLink( oRelation.Target()));
else if (( oRelation.Type() == FileTypes::ExternalVideo ) && ( oRelation.IsExternal() ))
return smart_ptr<OOX::File>(new ExternalVideo( oRelation.Target()));
else if (( oRelation.Type() == FileTypes::ExternalAudio ) && ( oRelation.IsExternal() ))
return smart_ptr<OOX::File>(new ExternalAudio( oRelation.Target()));
else if (( oRelation.Type() == FileTypes::ExternalImage ) && ( oRelation.IsExternal() ))
return smart_ptr<OOX::File>(new ExternalImage( oRelation.Target()));
else if ( oRelation.Type() == FileTypes::Image)
return smart_ptr<OOX::File>(new Image( oFileName ));
else if ( oRelation.Type() == FileTypes::OleObject)
return smart_ptr<OOX::File>(new OleObject( oFileName ));
else if ( oRelation.Type() == FileTypes::Audio)
return smart_ptr<OOX::File>(new Audio( oFileName ));
else if ( oRelation.Type() == FileTypes::Video)
return smart_ptr<OOX::File>(new Video( oFileName ));
else if ( oRelation.Type() == FileTypes::Numbering)
return smart_ptr<OOX::File>(new CNumbering( oFileName ));
else if ( oRelation.Type() == FileTypes::Header)
return smart_ptr<OOX::File>(new CHdrFtr( oFileName ));
else if ( oRelation.Type() == FileTypes::Footer)
return smart_ptr<OOX::File>(new CHdrFtr( oFileName ));
else if ( oRelation.Type() == FileTypes::Comments)
return smart_ptr<OOX::File>(new CComments( oFileName ));
else if ( oRelation.Type() == FileTypes::CommentsExt )
return smart_ptr<OOX::File>(new CCommentsExt( oFileName ));
else if ( oRelation.Type() == FileTypes::People )
return smart_ptr<OOX::File>(new CPeople( oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
}
} // namespace OOX

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_FACTORY_INCLUDE_H_
#define OOX_FILE_FACTORY_INCLUDE_H_
#include "../Base/SmartPtr.h"
#include "../SystemUtility/SystemUtility.h"
namespace OOX
{
class File;
namespace Rels
{
class CRelationShip;
}
}
namespace OOX
{
const NSCommon::smart_ptr<OOX::File> CreateFile(const CPath& oPath, const OOX::Rels::CRelationShip& oRelation);
}
#endif // OOX_FILE_FACTORY_INCLUDE_H_

View File

@@ -0,0 +1,119 @@
/*
* (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 "../SystemUtility/SystemUtility.h"
namespace OOX
{
class FileType
{
public:
FileType(const CPath& defaultDirectory, const CPath& defaultFileName,
const CString& overrideType,
const CString& relationType, bool bEnumerated = false, bool bEnumeratedGlobal = false ) : m_defaultDirectory(defaultDirectory),
m_defaultFileName(defaultFileName),
m_overrideType(overrideType),
m_relationType(relationType),
m_bEnumerated(bEnumerated),
m_bEnumeratedGlobal(bEnumeratedGlobal)
{
}
FileType(const WCHAR* defaultDirectory, const WCHAR* defaultFileName,
const CString& overrideType,
const CString& relationType, bool bEnumerated = false, bool bEnumeratedGlobal = false ) : m_defaultDirectory(defaultDirectory),
m_defaultFileName(defaultFileName),
m_overrideType(overrideType),
m_relationType(relationType),
m_bEnumerated(bEnumerated),
m_bEnumeratedGlobal(bEnumeratedGlobal)
{
}
~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;
}
inline const bool Enumerated() const
{
return m_bEnumerated;
}
inline const bool EnumeratedGlobal() const
{
return m_bEnumeratedGlobal;
}
private:
CString m_overrideType;
CString m_relationType;
CPath m_defaultDirectory;
CPath m_defaultFileName;
bool m_bEnumerated;
bool m_bEnumeratedGlobal;
};
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,285 @@
/*
* (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 ThemeOverride(L"themeOverride", L"themeOverride.xml",
_T("application/vnd.openxmlformats-officedocument.theme+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/themeOverride"));
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 Bibliography(L"customXml", L"item.xml",
_T("WARNING not implement"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/bibliography"));
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 Comments(L"", L"comments.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"));
const FileType CommentsExt(L"", L"commentsExtended.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml"),
_T("http://schemas.microsoft.com/office/2011/relationships/commentsExtended"));
const FileType People(L"", L"people.xml",
_T("application/vnd.openxmlformats-officedocument.wordprocessingml.people+xml"),
_T("http://schemas.microsoft.com/office/2011/relationships/people"));
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 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"", L"slide.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.slide+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"));
const FileType SlideLayout(L"", L"slideLayout.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.slideLayout+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"));
const FileType SlideMaster(L"", L"slideMaster.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.slideMaster+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"));
const FileType NotesSlide(L"", L"notesSlide.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.notesSlide+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"));
const FileType NotesMaster(L"", L"notesMaster.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.notesMaster+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"));
const FileType HandoutMaster(L"", 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"", L"presProps.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.presProps+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"));
const FileType TableStyles(L"", L"tableStyles.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles"));
const FileType ViewProps(L"", L"viewProps.xml",
_T("application/vnd.openxmlformats-officedocument.presentationml.viewProps+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/viewProps"));
const FileType ThemePPTX(L"", L"theme.xml",
_T("application/vnd.openxmlformats-officedocument.theme+xml"),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"));
const FileType VmlDrawing(L"", L"vmlDrawing.vml",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"));
const FileType Unknow(L"", L"", _T(""), _T(""));
}
}
#endif // OOX_FILE_TYPES_INCLUDE_H_

View File

@@ -0,0 +1,204 @@
/*
* (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_FONT_INCLUDE_H_
#define OOX_FONT_INCLUDE_H_
#include "../Base/nullable.h"
#include "WritingElement.h"
#include "../Common/SimpleTypes_Word.h"
#include "../Common/SimpleTypes_Shared.h"
namespace OOX
{
class CFont : public WritingElement
{
public:
CFont()
{
m_sName = _T("Arial");
}
virtual ~CFont() {}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
Reset();
if ( _T("w:font") == oNode.GetName() )
{
oNode.ReadAttributeBase( _T("w:name"), m_sName );
XmlUtils::CXmlNode oChild;
if ( oNode.GetNode( _T("w:altName"), oChild ) )
oChild.ReadAttributeBase( _T("w:val"), m_oAltName );
if ( oNode.GetNode( _T("w:charset"), oChild ) )
oChild.ReadAttributeBase( _T("w:val"), m_oCharset );
if ( oNode.GetNode( _T("w:family"), oChild ) )
oChild.ReadAttributeBase( _T("w:val"), m_oFamily );
if ( oNode.GetNode( _T("w:notTrueType"), oChild ) )
oChild.ReadAttributeBase( _T("w:val"), m_oNotTrueType );
if ( oNode.GetNode( _T("w:panose1"), oChild ) )
oChild.ReadAttributeBase( _T("w:val"), m_oPanose );
if ( oNode.GetNode( _T("w:pitch"), oChild ) )
oChild.ReadAttributeBase( _T("w:val"), m_oPitch );
if ( oNode.GetNode( _T("w:sig"), oChild ) )
{
oChild.ReadAttributeBase( _T("w:csb0"), m_oCsb0 );
oChild.ReadAttributeBase( _T("w:csb1"), m_oCsb1 );
oChild.ReadAttributeBase( _T("w:usb0"), m_oUsb0 );
oChild.ReadAttributeBase( _T("w:usb1"), m_oUsb1 );
oChild.ReadAttributeBase( _T("w:usb2"), m_oUsb2 );
oChild.ReadAttributeBase( _T("w:usb3"), m_oUsb3 );
}
}
}
virtual CString toXML () const
{
CString sResult = _T("<w:font w:name=\"");
sResult += m_sName;
sResult += _T("\">");
if ( m_oAltName.IsInit() )
{
sResult += _T("<w:altName w:val=\"");
sResult += m_oAltName.get();
sResult += _T("\"/>");
}
if(m_oCharset.IsInit())
{
sResult += _T("<w:charset w:val=\"");
sResult += m_oCharset->ToString();
sResult += _T("\"/>");
}
sResult += _T("<w:family w:val=\"");
sResult += m_oFamily.ToString();
sResult += _T("\"/>");
if ( m_oNotTrueType.IsInit() )
{
sResult += _T("<w:notTrueType w:val=\"");
sResult += m_oNotTrueType->ToString();
sResult += _T("\"/>");
}
if ( m_oPanose.IsInit() )
{
sResult += _T("<w:panose1 w:val=\"");
sResult += m_oPanose->ToString();
sResult += _T("\"/>");
}
sResult += _T("<w:pitch w:val=\"");
sResult += m_oPitch.ToString();
sResult += _T("\"/>");
if ( m_oCsb0.IsInit() && m_oCsb1.IsInit() && m_oUsb0.IsInit() && m_oUsb1.IsInit() && m_oUsb2.IsInit() && m_oUsb3.IsInit() )
{
sResult += _T("<w:sig w:usb0=\"");
sResult += m_oUsb0->ToString();
sResult += _T("\" w:usb1=\"");
sResult += m_oUsb1->ToString();
sResult += _T("\" w:usb2=\"");
sResult += m_oUsb2->ToString();
sResult += _T("\" w:usb3=\"");
sResult += m_oUsb3->ToString();
sResult += _T("\" w:csb0=\"");
sResult += m_oCsb0->ToString();
sResult += _T("\" w:csb1=\"");
sResult += m_oCsb1->ToString();
sResult += _T("\"/>");
}
sResult += _T("</w:font>");
return sResult;
}
virtual EElementType getType() const
{
return et_w_font;
}
private:
void Reset()
{
m_sName = _T("Arial");
m_oAltName.reset();
m_oNotTrueType.reset();
m_oPanose.reset();
m_oCsb0.reset();
m_oCsb1.reset();
m_oUsb0.reset();
m_oUsb1.reset();
m_oUsb2.reset();
m_oUsb3.reset();
}
public:
CString m_sName;
nullable<SimpleTypes::CFontCharset<SimpleTypes::fontcharsetANSI>> m_oCharset;
SimpleTypes::CFontFamily <SimpleTypes::fontfamilyAuto > m_oFamily;
SimpleTypes::CPitch <SimpleTypes::pitchDefault > m_oPitch;
nullable<CString > m_oAltName;
nullable<SimpleTypes::COnOff<> > m_oNotTrueType;
nullable<SimpleTypes::CPanose > m_oPanose;
nullable<SimpleTypes::CLongHexNumber<>> m_oCsb0;
nullable<SimpleTypes::CLongHexNumber<>> m_oCsb1;
nullable<SimpleTypes::CLongHexNumber<>> m_oUsb0;
nullable<SimpleTypes::CLongHexNumber<>> m_oUsb1;
nullable<SimpleTypes::CLongHexNumber<>> m_oUsb2;
nullable<SimpleTypes::CLongHexNumber<>> m_oUsb3;
};
}
#endif

View File

@@ -0,0 +1,139 @@
/*
* (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_FONTTABLE_INCLUDE_H_
#define OOX_FONTTABLE_INCLUDE_H_
#include "File.h"
#include "Font.h"
#include "FileTypes.h"
#include "../Common/SimpleTypes_Word.h"
#include "../Common/SimpleTypes_Shared.h"
namespace OOX
{
class CFontTable : public OOX::File
{
public:
CFontTable()
{
}
CFontTable(const CPath &oFilePath)
{
read( oFilePath );
}
virtual ~CFontTable()
{
}
bool Find(CString &sFontName, CFont &oFont)
{
for ( int nIndex = 0; nIndex < m_arrFonts.GetSize(); nIndex++ )
{
if ( sFontName == m_arrFonts[nIndex].m_sName )
{
oFont = m_arrFonts[nIndex];
return true;
}
}
return false;
}
public:
virtual void read(const CPath &oFilePath)
{
XmlUtils::CXmlNode oFonts;
oFonts.FromXmlFile( oFilePath.GetPath(), true );
if ( _T("w:fonts") == oFonts.GetName() )
{
XmlUtils::CXmlNodes oFontList;
oFonts.GetNodes( _T("w:font"), oFontList );
for ( int nFontIndex = 0; nFontIndex < oFontList.GetCount(); nFontIndex++ )
{
XmlUtils::CXmlNode oFontNode;
if ( oFontList.GetAt( nFontIndex, oFontNode ) )
{
CFont oFont;
oFont.fromXML( oFontNode );
m_arrFonts.Add( oFont );
}
}
}
}
virtual void write(const CPath &oFilePath, const CPath &oDirectoryPath, CContentTypes& content) const
{
CString sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:fonts xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">");
for ( int nIndex = 0; nIndex < m_arrFonts.GetSize(); nIndex++ )
{
const CFont &oFont = m_arrFonts[nIndex];
sXml += oFont.toXML();
}
sXml += _T("</w:fonts>");
CDirectory::SaveToFile( oFilePath.GetPath(), sXml );
}
public:
virtual const FileType type() const
{
return FileTypes::FontTable;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
public:
CSimpleArray<CFont> m_arrFonts;
};
}
#endif // OOX_FONTTABLE_INCLUDE_H_

View File

@@ -0,0 +1,152 @@
/*
* (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_FOOTNOTE_INCLUDE_H_
#define OOX_FOOTNOTE_INCLUDE_H_
#include "File.h"
#include "IFileContainer.h"
#include "FtnEdn.h"
#include "Logic/RunContent.h"
namespace OOX
{
class CFootnotes : public OOX::File, public OOX::IFileContainer
{
public:
CFootnotes()
{
}
CFootnotes(const CPath& oPath)
{
read( oPath );
}
virtual ~CFootnotes()
{
for ( int nIndex = 0; nIndex < m_arrFootnote.GetSize(); nIndex++ )
{
if ( m_arrFootnote[nIndex] )
delete m_arrFootnote[nIndex];
}
m_arrFootnote.RemoveAll();
}
public:
virtual void read(const CPath& oPath)
{
IFileContainer::Read( oPath );
XmlUtils::CXmlNode oFootnotes;
oFootnotes.FromXmlFile( oPath.GetPath(), true );
if ( _T("w:footnotes") == oFootnotes.GetName() )
{
XmlUtils::CXmlNodes oFootnoteList;
oFootnotes.GetNodes( _T("w:footnote"), oFootnoteList );
for ( int nIndex = 0; nIndex < oFootnoteList.GetCount(); nIndex++ )
{
XmlUtils::CXmlNode oFootnoteNode;
if ( oFootnoteList.GetAt( nIndex, oFootnoteNode ) )
{
CFtnEdn *pFootnote = new CFtnEdn( oFootnoteNode );
m_arrFootnote.Add( pFootnote );
}
}
}
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
{
CString sXml;
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:footnotes xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
for ( int nIndex = 0; nIndex < m_arrFootnote.GetSize(); nIndex++ )
{
if ( m_arrFootnote[nIndex] )
sXml += m_arrFootnote[nIndex]->toXML();
}
sXml += _T("</w:footnotes>");
CDirectory::SaveToFile( oPath.GetPath(), sXml );
oContent.Registration( type().OverrideType(), oDirectory, oPath );
IFileContainer::Write( oPath, oDirectory, oContent );
}
public:
virtual const OOX::FileType type() const
{
return FileTypes::FootNote;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
public:
OOX::CFtnEdn* Find(const OOX::Logic::CFootnoteReference& oReference) const
{
if ( !oReference.m_oId.IsInit() )
return NULL;
for ( int nIndex = 0; nIndex < m_arrFootnote.GetSize(); nIndex++ )
{
if ( m_arrFootnote[nIndex]->m_oId.IsInit() && ( m_arrFootnote[nIndex]->m_oId == oReference.m_oId ) )
return m_arrFootnote[nIndex];
}
return NULL;
}
void Add(OOX::CFtnEdn* pFootnote)
{
m_arrFootnote.Add( pFootnote );
}
const int GetCount() const
{
return m_arrFootnote.GetSize();
}
public:
CSimpleArray<OOX::CFtnEdn*> m_arrFootnote;
};
}
#endif // OOX_FOOTNOTE_INCLUDE_H_

View File

@@ -0,0 +1,456 @@
/*
* (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_FTNEDN_INCLUDE_H_
#define OOX_FTNEDN_INCLUDE_H_
#include "../Base/Nullable.h"
#include "WritingElement.h"
#include "Logic/Annotations.h"
#include "Logic/Paragraph.h"
#include "Logic/Sdt.h"
#include "Logic/Table.h"
#include "Math/oMathPara.h"
#include "Math/oMath.h"
namespace OOX
{
class CFtnEdn : public WritingElement
{
public:
CFtnEdn()
{
m_eType = et_Unknown;
}
CFtnEdn(const XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
fromXML( (XmlUtils::CXmlNode&)oNode );
}
virtual ~CFtnEdn()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
const CFtnEdn& operator =(const XmlUtils::CXmlNode& oNode)
{
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
void Clear()
{
m_eType = et_Unknown;
m_oId.reset();
m_oType.reset();
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
if ( _T("w:footnote") == oNode.GetName() )
m_eType = et_w_footnote;
else if ( _T("w:endnote") == oNode.GetName() )
m_eType = et_w_endnote;
else
return;
oNode.ReadAttributeBase( _T("w:id"), m_oId );
oNode.ReadAttributeBase( _T("w:type"), m_oType );
XmlUtils::CXmlNodes oChilds;
if ( oNode.GetNodes( _T("*"), oChilds ) )
{
XmlUtils::CXmlNode oItem;
for ( int nIndex = 0; nIndex < oChilds.GetCount(); nIndex++ )
{
if ( oChilds.GetAt( nIndex, oItem ) )
{
CString sName = oItem.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bookmarkEnd") == sName )
pItem = new Logic::CBookmarkEnd( oItem );
else if ( _T("w:bookmarkStart") == sName )
pItem = new Logic::CBookmarkStart( oItem );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new Logic::CCommentRangeEnd( oItem );
else if ( _T("w:commentRangeStart") == sName )
pItem = new Logic::CCommentRangeStart( oItem );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new Logic::CCustomXmlDelRangeEnd( oItem );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new Logic::CCustomXmlDelRangeStart( oItem );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new Logic::CCustomXmlInsRangeEnd( oItem );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new Logic::CCustomXmlInsRangeStart( oItem );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeEnd( oItem );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeStart( oItem );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveToRangeEnd( oItem );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveToRangeStart( oItem );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oItem );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oItem );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oItem );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oItem );
else if ( _T("m:oMath") == sName )
pItem = new Logic::COMath( oItem );
else if ( _T("m:oMathPara") == sName )
pItem = new Logic::COMathPara( oItem );
else if ( _T("w:p") == sName )
pItem = new Logic::CParagraph( oItem );
else if ( _T("w:permEnd") == sName )
pItem = new Logic::CPermEnd( oItem );
else if ( _T("w:permStart") == sName )
pItem = new Logic::CPermStart( oItem );
else if ( _T("w:proofErr") == sName )
pItem = new Logic::CProofErr( oItem );
else if ( _T("w:sdt") == sName )
pItem = new Logic::CSdt( oItem );
else if ( _T("w:tbl") == sName )
pItem = new Logic::CTbl( oItem );
if ( pItem )
m_arrItems.Add( pItem );
}
}
}
}
virtual CString toXML() const
{
CString sResult;
if ( m_eType == et_w_footnote )
sResult = _T("<w:footnote ");
else if ( m_eType == et_w_endnote )
sResult = _T("<w:endnote ");
else
return _T("");
ComplexTypes_WriteAttribute( _T("w:id=\""), m_oId );
ComplexTypes_WriteAttribute( _T("w:type=\""), m_oType );
sResult += _T(">");
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
{
sResult += m_arrItems[nIndex]->toXML();
}
}
if ( m_eType == et_w_footnote )
sResult += _T("</w:footnote>");
else if ( m_eType == et_w_endnote )
sResult += _T("</w:endnote>");
return sResult;
}
virtual EElementType getType() const
{
return m_eType;
}
public:
void AddParagraph(Logic::CParagraph *pPara)
{
m_arrItems.Add( (WritingElement*)pPara );
}
public:
OOX::EElementType m_eType;
nullable<SimpleTypes::CDecimalNumber<> > m_oId;
nullable<SimpleTypes::CFtnEdn<> > m_oType;
CSimpleArray<WritingElement* > m_arrItems;
};
class CFtnEdnSepRef : public WritingElement
{
public:
CFtnEdnSepRef()
{
m_eType = et_Unknown;
}
CFtnEdnSepRef(XmlUtils::CXmlNode& oNode)
{
m_eType = et_Unknown;
fromXML( (XmlUtils::CXmlNode&)oNode );
}
CFtnEdnSepRef(XmlUtils::CXmlLiteReader& oReader)
{
m_eType = et_Unknown;
fromXML( oReader );
}
virtual ~CFtnEdnSepRef()
{
}
public:
const CFtnEdnSepRef& operator =(const XmlUtils::CXmlNode& oNode)
{
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
const CFtnEdnSepRef& operator =(const XmlUtils::CXmlLiteReader& oReader)
{
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
if ( _T("w:footnote") == oNode.GetName() )
m_eType = et_w_footnote;
else if ( _T("w:endnote") == oNode.GetName() )
m_eType = et_w_endnote;
else
return;
oNode.ReadAttributeBase( _T("w:id"), m_oId );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
CWCharWrapper sName = oReader.GetName();
if ( _T("w:footnote") == sName )
m_eType = et_w_footnote;
else if ( _T("w:endnote") == sName )
m_eType = et_w_endnote;
else
return;
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual CString toXML() const
{
CString sResult;
if ( m_eType == et_w_footnote )
sResult = _T("<w:footnote ");
else if ( m_eType == et_w_endnote )
sResult = _T("<w:endnote ");
else
return _T("");
ComplexTypes_WriteAttribute( _T("w:id=\""), m_oId );
sResult += _T("/>");
return sResult;
}
virtual EElementType getType() const
{
return m_eType;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.GetAttributesCount() <= 0 )
return;
if ( !oReader.MoveToFirstAttribute() )
return;
CWCharWrapper wsName = oReader.GetName();
while( !wsName.IsNull() )
{
if ( _T("w:id") == wsName )
m_oId = oReader.GetText();
if ( !oReader.MoveToNextAttribute() )
break;
wsName = oReader.GetName();
}
oReader.MoveToElement();
}
public:
OOX::EElementType m_eType;
nullable<SimpleTypes::CDecimalNumber<> > m_oId;
};
}
#endif // OOX_FTNEDN_INCLUDE_H_

View File

@@ -0,0 +1,339 @@
/*
* (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_HEADER_FOOTER_INCLUDE_H_
#define OOX_HEADER_FOOTER_INCLUDE_H_
#include "File.h"
#include "../Base/Nullable.h"
#include "WritingElement.h"
#include "Logic/Annotations.h"
#include "Logic/Paragraph.h"
#include "Logic/Sdt.h"
#include "Logic/Table.h"
#include "Math/oMathPara.h"
#include "Math/oMath.h"
namespace OOX
{
class CHdrFtr : public OOX::File, public IFileContainer
{
public:
CHdrFtr()
{
m_eType = et_Unknown;
}
CHdrFtr(const CPath& oFilePath)
{
m_eType = et_Unknown;
read( oFilePath );
}
virtual ~CHdrFtr()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
virtual void read(const CPath& oFilePath)
{
m_oReadPath = oFilePath;
IFileContainer::Read( oFilePath );
#ifdef USE_LITE_READER
Common::readAllShapeTypes(oFilePath, m_arrShapeTypes);
XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oFilePath.GetPath() ) )
return;
if ( !oReader.ReadNextNode() )
return;
CWCharWrapper sName = oReader.GetName();
if ( _T("w:ftr") == sName )
m_eType = et_w_ftr;
else if ( _T("w:hdr") == sName )
m_eType = et_w_hdr;
else
return;
if ( !oReader.IsEmptyNode() )
{
int nDocumentDepth = oReader.GetDepth();
while ( oReader.ReadNextSiblingNode( nDocumentDepth ) )
{
CString sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bookmarkEnd") == sName )
pItem = new Logic::CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new Logic::CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new Logic::CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new Logic::CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new Logic::CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new Logic::CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new Logic::CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new Logic::CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new Logic::CDel( oReader );
else if ( _T("w:ins") == sName )
pItem = new Logic::CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new Logic::COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new Logic::COMathPara( oReader );
else if ( _T("w:p") == sName )
pItem = new Logic::CParagraph( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new Logic::CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new Logic::CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new Logic::CProofErr( oReader );
else if ( _T("w:sdt") == sName )
pItem = new Logic::CSdt( oReader );
else if ( _T("w:tbl") == sName )
pItem = new Logic::CTbl( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
#else
XmlUtils::CXmlNode oMainNode;
oMainNode.FromXmlFile( oFilePath.GetPath(), true );
if ( _T("w:ftr") == oMainNode.GetName() )
m_eType = et_w_ftr;
else if ( _T("w:hdr") == oMainNode.GetName() )
m_eType = et_w_hdr;
else
return;
XmlUtils::CXmlNodes oChilds;
if ( oMainNode.GetNodes( _T("*"), oChilds ) )
{
XmlUtils::CXmlNode oItem;
for ( int nIndex = 0; nIndex < oChilds.GetCount(); nIndex++ )
{
if ( oChilds.GetAt( nIndex, oItem ) )
{
CString sName = oItem.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bookmarkEnd") == sName )
pItem = new Logic::CBookmarkEnd( oItem );
else if ( _T("w:bookmarkStart") == sName )
pItem = new Logic::CBookmarkStart( oItem );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new Logic::CCommentRangeEnd( oItem );
else if ( _T("w:commentRangeStart") == sName )
pItem = new Logic::CCommentRangeStart( oItem );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new Logic::CCustomXmlDelRangeEnd( oItem );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new Logic::CCustomXmlDelRangeStart( oItem );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new Logic::CCustomXmlInsRangeEnd( oItem );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new Logic::CCustomXmlInsRangeStart( oItem );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeEnd( oItem );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveFromRangeStart( oItem );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new Logic::CCustomXmlMoveToRangeEnd( oItem );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new Logic::CCustomXmlMoveToRangeStart( oItem );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oItem );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oItem );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new Logic::CMoveToRangeEnd( oItem );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new Logic::CMoveToRangeStart( oItem );
else if ( _T("m:oMath") == sName )
pItem = new Logic::COMath( oItem );
else if ( _T("m:oMathPara") == sName )
pItem = new Logic::COMathPara( oItem );
else if ( _T("w:p") == sName )
pItem = new Logic::CParagraph( oItem );
else if ( _T("w:permEnd") == sName )
pItem = new Logic::CPermEnd( oItem );
else if ( _T("w:permStart") == sName )
pItem = new Logic::CPermStart( oItem );
else if ( _T("w:proofErr") == sName )
pItem = new Logic::CProofErr( oItem );
else if ( _T("w:sdt") == sName )
pItem = new Logic::CSdt( oItem );
else if ( _T("w:tbl") == sName )
pItem = new Logic::CTbl( oItem );
if ( pItem )
m_arrItems.Add( pItem );
}
}
}
#endif
}
virtual void write(const CPath& oFilePath, const CPath& oDirectory, CContentTypes& oContent) const
{
CString sXml;
if ( et_w_ftr == m_eType )
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:ftr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
else if ( et_w_hdr == m_eType )
sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:hdr xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\">");
else
return;
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
{
sXml += m_arrItems[nIndex]->toXML();
}
}
if ( et_w_ftr == m_eType )
sXml += _T("</w:ftr>");
else if ( et_w_hdr == m_eType )
sXml += _T("</w:hdr>");
CDirectory::SaveToFile( oFilePath.GetPath(), sXml );
oContent.Registration( type().OverrideType(), oDirectory, oFilePath );
IFileContainer::Write( oFilePath, oDirectory, oContent );
}
public:
virtual const OOX::FileType type() const
{
if ( et_w_hdr == m_eType )
return FileTypes::Header;
else if ( et_w_ftr == m_eType )
return FileTypes::Footer;
return FileTypes::Unknow;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
const CPath& GetReadPath()
{
return m_oReadPath;
}
public:
void AddParagraph(Logic::CParagraph *pPara)
{
m_arrItems.Add( (WritingElement*)pPara );
}
public:
CPath m_oReadPath;
OOX::EElementType m_eType;
CSimpleArray<WritingElement* > m_arrItems;
CSimpleArray<CString> m_arrShapeTypes;
};
}
#endif // OOX_HEADER_FOOTER_INCLUDE_H_

View File

@@ -0,0 +1,52 @@
/*
* (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.h"
namespace OOX
{
class IFileBuilder
{
public:
IFileBuilder() {}
virtual ~IFileBuilder() {}
public:
virtual void Commit (const CPath& oPath) = 0;
virtual void Finalize(const CPath& oPath, const CPath& oDirectory, OOX::CContentTypes& oContent) = 0;
};
}
#endif // OOX_FILE_BUILDER_INCLUDE_H_

View File

@@ -0,0 +1,372 @@
/*
* (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 "IFileContainer.h"
#include "Rels.h"
#include "FileFactory.h"
#include "ContentTypes.h"
#include "FileType.h"
#include "External\External.h"
#include "External\HyperLink.h"
#include "Media\Image.h"
#include "Media\OleObject.h"
#include "FileTypes.h"
#include "../XlsxFormat/FileFactory_Spreadsheet.h"
BOOL XmlUtils::CStringWriter::m_bInitTable = FALSE;
BYTE XmlUtils::CStringWriter::m_arTableUnicodes[65536];
namespace OOX
{
UnknowTypeFile IFileContainer::Unknown;
void IFileContainer::Read (const OOX::CPath& oPath)
{
OOX::CRels oRels( oPath );
Read( oRels, oPath.GetDirectory() );
}
void IFileContainer::Read (const OOX::CRels& oRels, const OOX::CPath& oPath)
{
int nCount = oRels.m_arrRelations.GetSize();
for ( int nIndex = 0; nIndex < nCount; ++nIndex )
{
const Rels::CRelationShip& oCurRels = oRels.m_arrRelations[nIndex];
smart_ptr<OOX::File> oFile = OOX::CreateFile( oPath, oCurRels );
if(oFile.IsInit() && FileTypes::Unknow == oFile->type())
oFile = OOX::Spreadsheet::CreateFile( oPath, oCurRels );
Add( oCurRels.rId(), oFile );
}
}
void IFileContainer::Write(const OOX::CPath& oFileName, const OOX::CPath& oDirectory, OOX::CContentTypes& oContent) const
{
OOX::CPath oCurrent = oFileName.GetDirectory();
OOX::CRels oRels;
Write( oRels, oCurrent, oDirectory, oContent );
oRels.Write( oFileName );
}
void IFileContainer::Write(OOX::CRels& oRels, const OOX::CPath& oCurrent, const OOX::CPath& oDir, OOX::CContentTypes& oContent) const
{
CAtlMap<CString, size_t> mNamePair;
POSITION pos = m_mContainer.GetStartPosition();
while ( NULL != pos )
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.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 oDefDir = pFile->DefaultDirectory();
OOX::CPath oName = pFile->DefaultFileName();
CAtlMap<CString, size_t>::CPair* pNamePair = mNamePair.Lookup( oName.m_strFilename );
if ( NULL == pNamePair )
mNamePair.SetAt( oName.m_strFilename, 1 );
else
oName = oName + pNamePair->m_key;
OOX::CSystemUtility::CreateDirectories( oCurrent / oDefDir );
pFile->write( oCurrent / oDefDir / oName, oDir / oDefDir, oContent );
oRels.Registration( pPair->m_key, pFile->type(), oDefDir / oName );
}
else
{
oRels.Registration( pPair->m_key, pExt );
}
}
}
void IFileContainer::Commit (const OOX::CPath& oPath)
{
CAtlMap<CString, size_t> mNamepair;
POSITION pos = m_mContainer.GetStartPosition();
while ( NULL != pos )
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.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 oDefDir = pFile->DefaultDirectory();
OOX::CPath oName = pFile->DefaultFileName();
CAtlMap<CString, size_t>::CPair* pNamePair = mNamepair.Lookup( oName.m_strFilename );
if (NULL == pNamePair)
mNamepair.SetAt( oName.m_strFilename, 1 );
else
oName = oName + pNamePair->m_key;
OOX::CSystemUtility::CreateDirectories( oPath / oDefDir );
smart_ptr<OOX::IFileBuilder> pFileBuilder = pPair->m_value.smart_dynamic_cast<OOX::IFileBuilder>();
if ( pFileBuilder.is_init() )
pFileBuilder->Commit( oPath / oDefDir / oName );
}
}
}
void IFileContainer::Finalize(const OOX::CPath& oFileName, const OOX::CPath& oDirectory, OOX::CContentTypes& oContent)
{
OOX::CPath oCurrent = oFileName.GetDirectory();
OOX::CRels oRels;
Finalize( oRels, oCurrent, oDirectory, oContent );
oRels.Write( oFileName );
}
void IFileContainer::Finalize(OOX::CRels& oRels, const OOX::CPath& oCurrent, const OOX::CPath& oDir, OOX::CContentTypes& oContent)
{
CAtlMap<CString, size_t> mNamepair;
POSITION pos = m_mContainer.GetStartPosition();
while ( NULL != pos )
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.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 oDefDir = pFile->DefaultDirectory();
OOX::CPath oName = pFile->DefaultFileName();
CAtlMap<CString, size_t>::CPair* pNamePair = mNamepair.Lookup( oName.m_strFilename );
if ( NULL == pNamePair )
mNamepair.SetAt( oName.m_strFilename, 1 );
else
oName = oName + pNamePair->m_key;
OOX::CSystemUtility::CreateDirectories( oCurrent / oDefDir );
smart_ptr<OOX::IFileBuilder> pFileBuilder = pFile.smart_dynamic_cast<OOX::IFileBuilder>();
if ( pFileBuilder.is_init() )
{
pFileBuilder->Finalize( oCurrent / oDefDir / oName, oDir / oDefDir, oContent );
}
else
{
pFile->write( oCurrent / oDefDir / oName, oDir / oDefDir, oContent );
}
oRels.Registration( pPair->m_key, pFile->type(), oDefDir / oName );
}
else
{
oRels.Registration( pPair->m_key, pExt );
}
}
}
void IFileContainer::ExtractPictures(const OOX::CPath& oPath) const
{
POSITION pos = m_mContainer.GetStartPosition();
while ( NULL != pos )
{
smart_ptr<OOX::File> pFile = m_mContainer.GetNextValue( pos );
smart_ptr<Image> pImage = pFile.smart_dynamic_cast<Image>();
if ( pImage.is_init() )
{
pImage->copy_to( oPath );
continue;
}
smart_ptr<IFileContainer> pExt = pFile.smart_dynamic_cast<IFileContainer>();
if ( pExt.is_init() )
{
pExt->ExtractPictures( oPath );
continue;
}
}
}
smart_ptr<Image> IFileContainer::GetImage (const RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.Lookup(rId.get());
if (NULL == pPair)
return smart_ptr<Image>();
return pPair->m_value.smart_dynamic_cast<Image>();
}
smart_ptr<HyperLink> IFileContainer::GetHyperlink(const RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.Lookup(rId.get());
if (NULL == pPair)
return smart_ptr<HyperLink>();
return pPair->m_value.smart_dynamic_cast<HyperLink>();
}
smart_ptr<OleObject> IFileContainer::GetOleObject(const RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.Lookup(rId.get());
if (NULL == pPair)
return smart_ptr<OleObject>();
return pPair->m_value.smart_dynamic_cast<OleObject>();
}
const bool IFileContainer::IsExist(const FileType& oType) const
{
POSITION pos = m_mContainer.GetStartPosition();
while ( NULL != pos )
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.GetNext( pos );
if ( oType == pPair->m_value->type() )
return true;
}
return false;
}
const bool IFileContainer::IsExist(const RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.Lookup(rId.get());
return ( NULL != pPair );
}
template<typename T>
const bool IFileContainer::IsExist() const
{
T oFile;
return IsExist( oFile.type() );
}
const bool IFileContainer::IsExternal(const OOX::RId& rId) const
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.Lookup(rId.get());
if ( NULL != pPair )
{
CString sType = pPair->m_value->type().RelationType();
CString sName = pPair->m_value->type().DefaultFileName().m_strFilename;
return (( ( sType == OOX::FileTypes::ExternalAudio.RelationType() ) || ( sType == OOX::FileTypes::ExternalImage.RelationType() ) || ( sType == OOX::FileTypes::ExternalVideo.RelationType() ) ) && ( sName == _T("") ) );
}
return true;
}
smart_ptr<OOX::File> IFileContainer::Get(const FileType& oType)
{
POSITION pos = m_mContainer.GetStartPosition();
while ( NULL != pos )
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.GetNext( pos );
if ( oType == pPair->m_value->type() )
return pPair->m_value;
}
return smart_ptr<OOX::File>(new UnknowTypeFile( Unknown ));
}
const RId IFileContainer::Add(smart_ptr<OOX::File>& pFile)
{
const RId rId = GetMaxRId().next();
Add( rId, pFile );
return rId;
}
void IFileContainer::Add(const OOX::RId& rId, const smart_ptr<OOX::File>& pFile)
{
m_lMaxRid = max( m_lMaxRid, rId.getNumber() );
m_mContainer.SetAt( rId.get(), pFile );
}
smart_ptr<OOX::File> IFileContainer::Find(const FileType& oType) const
{
POSITION pos = m_mContainer.GetStartPosition();
while ( NULL != pos )
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.GetNext( pos );
if ( oType == 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_mContainer.Lookup(rId.get());
if ( NULL != pPair )
return pPair->m_value;
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile() );
}
template<typename T>
T& IFileContainer::Find()
{
T oFile;
return dynamic_cast<T&>( Find( oFile.type() ) );
}
smart_ptr<OOX::File> IFileContainer::operator [](const OOX::RId rId)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_mContainer.Lookup(rId.get());
if ( NULL != pPair )
return pPair->m_value;
return smart_ptr<OOX::File>( (OOX::File*)new UnknowTypeFile() );
}
smart_ptr<OOX::File> IFileContainer::operator [](const FileType& oType)
{
return Find( oType );
}
const RId IFileContainer::GetMaxRId()
{
++m_lMaxRid;
return RId( m_lMaxRid );
}
} // namespace OOX

View File

@@ -0,0 +1,121 @@
/*
* (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_XLSXIFILE_CONTAINER_INCLUDE_H_
#define OOX_XLSXIFILE_CONTAINER_INCLUDE_H_
#include "RId.h"
#include "UnknowTypeFile.h"
#include "IFileBuilder.h"
namespace OOX
{
class File;
class FileType;
class CRels;
class CContentTypes;
class Image;
class HyperLink;
class OleObject;
}
namespace OOX
{
class IFileContainer
{
public:
IFileContainer()
{
m_lMaxRid = 0;
}
protected:
CAtlMap<CString, smart_ptr<OOX::File>> m_mContainer;
size_t m_lMaxRid;
protected:
void Read (const OOX::CPath& oPath);
void Read (const OOX::CRels& oRels, const CPath& oPath);
void Write(const OOX::CPath& oFileName, const CPath& oDir, OOX::CContentTypes& oContent) const;
void Write(OOX::CRels& oRels, const CPath& oCurrent, const CPath& oDir, OOX::CContentTypes& oContent) const;
protected:
void Commit (const CPath& oPath);
void Finalize(const CPath& oFilefilename, const CPath& oDir, OOX::CContentTypes& oContent);
void Finalize(OOX::CRels& oRels, const CPath& oCurrent, const CPath& oDir, OOX::CContentTypes& oContent);
public:
void ExtractPictures(const OOX::CPath& oPath) const;
public:
virtual smart_ptr<Image> GetImage (const RId& rId) const;
virtual smart_ptr<HyperLink> GetHyperlink(const RId& rId) const;
virtual smart_ptr<OleObject> GetOleObject(const RId& rId) const;
public:
template<typename T>
const bool IsExist() const;
const bool IsExist(const FileType& oType) const;
const bool IsExist(const OOX::RId& rId) const;
const bool IsExternal(const OOX::RId& rId) const;
smart_ptr<OOX::File> Get(const FileType& oType);
const RId Add(smart_ptr<OOX::File>& pFile);
void Add(const OOX::RId& rId, const smart_ptr<OOX::File>& pFile);
template<typename T>
T& Find();
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& oType);
protected:
static UnknowTypeFile Unknown;
private:
const RId GetMaxRId();
};
}
#endif // OOX_XLSXIFILE_CONTAINER_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
*
*/
#include "AlternateContent.h"
#include "Run.h"
namespace OOX
{
namespace Logic
{
void CAlternateContent::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
m_sXml.Init();
m_sXml->Append(oReader.GetOuterXml());
CString sXml;
sXml.Format(_T("<root xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">%s</root>"), m_sXml.get());
XmlUtils::CXmlLiteReader oSubReader;
oSubReader.FromString(sXml);
oSubReader.ReadNextNode();
oSubReader.ReadNextNode();
int nParentDepth = oSubReader.GetDepth();
while( oSubReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oSubReader.GetName();
if ( _T("mc:Choice") == sName )
{
CRun altRun(oSubReader);
for (int i = 0; i < altRun.m_arrItems.GetSize(); ++i)
m_arrChoiceItems.Add(altRun.m_arrItems[i]);
for (int i = 0; i < altRun.m_arrSpreadsheetItems.GetSize(); ++i)
m_arrSpreadsheetChoiceItems.Add(altRun.m_arrSpreadsheetItems[i]);
altRun.m_arrItems.RemoveAll();
altRun.m_arrSpreadsheetItems.RemoveAll();
}
else if ( _T("mc:Fallback") == sName )
{
CRun altRun(oSubReader);
for (int i = 0; i < altRun.m_arrItems.GetSize(); ++i)
m_arrFallbackItems.Add(altRun.m_arrItems[i]);
for (int i = 0; i < altRun.m_arrSpreadsheetItems.GetSize(); ++i)
m_arrSpreadsheetFallbackItems.Add(altRun.m_arrSpreadsheetItems[i]);
altRun.m_arrItems.RemoveAll();
altRun.m_arrSpreadsheetItems.RemoveAll();
}
}
}
}
} // namespace OOX

View File

@@ -0,0 +1,112 @@
/*
* (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_ALTERNATECONTENT_WORD_INCLUDE_H_
#define OOX_ALTERNATECONTENT_WORD_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../WritingElement.h"
#include "../../XlsxFormat/WritingElement.h"
namespace OOX
{
namespace Logic
{
class CAlternateContent : public WritingElement
{
public:
WritingElement_AdditionConstructors(CAlternateContent)
CAlternateContent()
{
}
virtual ~CAlternateContent()
{
Clear();
}
void Clear()
{
for ( int nIndex = 0; nIndex < m_arrChoiceItems.GetSize(); nIndex++ )
{
if ( m_arrChoiceItems[nIndex] )
delete m_arrChoiceItems[nIndex];
m_arrChoiceItems[nIndex] = NULL;
}
m_arrChoiceItems.RemoveAll();
for ( int nIndex = 0; nIndex < m_arrFallbackItems.GetSize(); nIndex++ )
{
if ( m_arrFallbackItems[nIndex] )
delete m_arrFallbackItems[nIndex];
m_arrFallbackItems[nIndex] = NULL;
}
m_arrFallbackItems.RemoveAll();
for ( int nIndex = 0; nIndex < m_arrSpreadsheetChoiceItems.GetSize(); nIndex++ )
{
if ( m_arrSpreadsheetChoiceItems[nIndex] )
delete m_arrSpreadsheetChoiceItems[nIndex];
m_arrSpreadsheetChoiceItems[nIndex] = NULL;
}
m_arrSpreadsheetChoiceItems.RemoveAll();
for ( int nIndex = 0; nIndex < m_arrSpreadsheetFallbackItems.GetSize(); nIndex++ )
{
if ( m_arrSpreadsheetFallbackItems[nIndex] )
delete m_arrSpreadsheetFallbackItems[nIndex];
m_arrSpreadsheetFallbackItems[nIndex] = NULL;
}
m_arrSpreadsheetFallbackItems.RemoveAll();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual CString toXML() const
{
return _T("");
}
virtual EElementType getType() const
{
return OOX::et_mc_alternateContent;
}
public:
nullable<CString > m_sXml;
CSimpleArray<WritingElement *> m_arrChoiceItems;
CSimpleArray<WritingElement *> m_arrFallbackItems;
CSimpleArray<OOX::Spreadsheet::WritingElement *> m_arrSpreadsheetChoiceItems;
CSimpleArray<OOX::Spreadsheet::WritingElement *> m_arrSpreadsheetFallbackItems;
};
}
}
#endif // OOX_ALTERNATECONTENT_WORD_INCLUDE_H_

View File

@@ -0,0 +1,249 @@
/*
* (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 "Annotations.h"
#include "Bdo.h"
#include "Paragraph.h"
#include "Annotations.h"
#include "Run.h"
#include "FldSimple.h"
#include "Sdt.h"
#include "Hyperlink.h"
#include "SmartTag.h"
#include "Dir.h"
#include "../Math/oMathPara.h"
#include "../Math/oMath.h"
namespace OOX
{
namespace Logic
{
void CIns::fromXML(XmlUtils::CXmlNode& oNode)
{
}
void CIns::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oReader );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new CDel( oReader );
else if ( _T("w:dir") == sName )
pItem = new CDir( oReader );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oReader );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oReader );
else if ( _T("w:ins") == sName )
pItem = new CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oReader );
else if ( _T("w:r") == sName )
pItem = new CRun( oReader );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oReader );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
CString CIns::toXML() const
{
CString sResult = _T("");
return sResult;
}
void CDel::fromXML(XmlUtils::CXmlNode& oNode)
{
}
void CDel::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oReader );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new CDel( oReader );
else if ( _T("w:dir") == sName )
pItem = new CDir( oReader );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oReader );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oReader );
else if ( _T("w:ins") == sName )
pItem = new CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oReader );
else if ( _T("w:r") == sName )
pItem = new CRun( oReader );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oReader );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
CString CDel::toXML() const
{
CString sResult = _T("");
return sResult;
}
}
} // namespace OOX

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
/*
* (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 "../../Base/Nullable.h"
#include "../WritingElement.h"
#include "../../Common/SimpleTypes_Word.h"
#include "../../Common/SimpleTypes_Drawing.h"
#include "../../Common/SimpleTypes_Shared.h"
#include "../../XML/XmlUtils.h"
#include "../../XML/XmlSimple.h"
#include "atlcoll.h"
namespace OOX
{
namespace Logic
{
using XmlUtils::CXmlNode;
using XmlUtils::CXmlNodes;
using XmlUtils::CAttribute;
}
}

View File

@@ -0,0 +1,261 @@
/*
* (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 "Bdo.h"
#include "Paragraph.h"
#include "Annotations.h"
#include "Run.h"
#include "FldSimple.h"
#include "Sdt.h"
#include "Hyperlink.h"
#include "SmartTag.h"
#include "Dir.h"
#include "../Math/oMathPara.h"
#include "../Math/oMath.h"
namespace OOX
{
namespace Logic
{
void CBdo::fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:val"), m_oVal );
XmlUtils::CXmlNodes oChilds;
if ( oNode.GetNodes( _T("*"), oChilds ) )
{
XmlUtils::CXmlNode oItem;
for ( int nIndex = 0; nIndex < oChilds.GetCount(); nIndex++ )
{
if ( oChilds.GetAt( nIndex, oItem ) )
{
CString sName = oItem.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oItem );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oItem );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oItem );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oItem );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oItem );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oItem );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oItem );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oItem );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oItem );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oItem );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oItem );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oItem );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oItem );
else if ( _T("w:dir") == sName )
pItem = new CDir( oItem );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oItem );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oItem );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oItem );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oItem );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oItem );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oItem );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oItem );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oItem );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oItem );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oItem );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oItem );
else if ( _T("w:r") == sName )
pItem = new CRun( oItem );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oItem );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oItem );
if ( pItem )
m_arrItems.Add( pItem );
}
}
}
}
void CBdo::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oReader );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new CDel( oReader );
else if ( _T("w:dir") == sName )
pItem = new CDir( oReader );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oReader );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oReader );
else if ( _T("w:ins") == sName )
pItem = new CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oReader );
else if ( _T("w:r") == sName )
pItem = new CRun( oReader );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oReader );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
CString CBdo::toXML() const
{
CString sResult = _T("<w:bdo ");
sResult += _T("w:val=\"");
sResult += m_oVal.ToString();
sResult += _T("\">");
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
{
sResult += m_arrItems[nIndex]->toXML();
}
}
sResult += _T("</w:bdo>");
return sResult;
}
}
} // namespace OOX

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_LOGIC_BDO_INCLUDE_H_
#define OOX_LOGIC_BDO_INCLUDE_H_
#include "../WritingElement.h"
#include "../../Common/SimpleTypes_Word.h"
namespace OOX
{
namespace Logic
{
class CBdo : public WritingElement
{
public:
CBdo()
{
}
CBdo(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CBdo(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CBdo()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
const CBdo &operator =(const XmlUtils::CXmlNode& oNode)
{
Clear();
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
const CBdo &operator =(const XmlUtils::CXmlLiteReader& oReader)
{
Clear();
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
void Clear()
{
m_oVal.SetValue( SimpleTypes::directionLTR );
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual CString toXML() const;
virtual EElementType getType() const
{
return et_w_bdo;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
public:
SimpleTypes::CDirection<SimpleTypes::directionLTR> m_oVal;
CSimpleArray<WritingElement *> m_arrItems;
};
}
}
#endif

View File

@@ -0,0 +1,170 @@
/*
* (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 "Dir.h"
#include "Sdt.h"
#include "Paragraph.h"
#include "Annotations.h"
#include "Run.h"
#include "RunProperty.h"
#include "ParagraphProperty.h"
#include "FldSimple.h"
#include "Bdo.h"
#include "Table.h"
#include "Hyperlink.h"
#include "SmartTag.h"
#include "../Math/oMathPara.h"
#include "../Math/oMath.h"
namespace OOX
{
namespace Logic
{
void CDir::fromXML(XmlUtils::CXmlNode& oNode)
{
}
void CDir::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oReader );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new CDel( oReader );
else if ( _T("w:dir") == sName )
pItem = new CDir( oReader );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oReader );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oReader );
else if ( _T("w:ins") == sName )
pItem = new CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oReader );
else if ( _T("w:p") == sName )
pItem = new CParagraph( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oReader );
else if ( _T("w:r") == sName )
pItem = new CRun( oReader );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oReader );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oReader );
else if ( _T("w:tbl") == sName )
pItem = new CTbl( oReader );
else if ( _T("w:tc") == sName )
pItem = new CTc( oReader );
else if ( _T("w:tr") == sName )
pItem = new CTr( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
CString CDir::toXML() const
{
CString sResult = _T("<w:dir");
if(m_oVal.IsInit())
sResult.AppendFormat(_T(" val=\"%s\""), m_oVal->ToString());
sResult += _T(">");
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
{
sResult += m_arrItems[nIndex]->toXML();
}
}
sResult += _T("</w:dir>");
return sResult;
}
}
} // namespace OOX

View File

@@ -0,0 +1,116 @@
/*
* (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_LOGIC_DIR_INCLUDE_H_
#define OOX_LOGIC_DIR_INCLUDE_H_
#include "../WritingElement.h"
#include "RunProperty.h"
namespace OOX
{
namespace Logic
{
class CDir : public WritingElement
{
public:
CDir()
{
}
CDir(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CDir(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CDir()
{
Clear();
}
public:
const CDir &operator =(const XmlUtils::CXmlNode& oNode)
{
Clear();
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
const CDir &operator =(const XmlUtils::CXmlLiteReader& oReader)
{
Clear();
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
void Clear()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual CString toXML() const;
virtual EElementType getType() const
{
return et_w_dir;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CDirVal<>> m_oVal;
CSimpleArray<WritingElement *> m_arrItems;
};
}
}
#endif // OOX_LOGIC_DIR_INCLUDE_H_

View File

@@ -0,0 +1,810 @@
/*
* (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_LOGIC_FLD_CHAR_INCLUDE_H_
#define OOX_LOGIC_FLD_CHAR_INCLUDE_H_
#include "../WritingElement.h"
#include "../../Base/Nullable.h"
#include "../../Common/SimpleTypes_Word.h"
#include "../../Common/ComplexTypes.h"
namespace ComplexTypes
{
namespace Word
{
class CMacroName : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CMacroName)
CMacroName()
{
}
virtual ~CMacroName()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
virtual CString ToString() const
{
CString sResult;
if ( m_oVal.IsInit() )
{
sResult += "w:val=\"";
sResult += m_oVal->ToString();
sResult += "\" ";
}
return sResult;
}
public:
nullable<SimpleTypes::CMacroName > m_oVal;
};
class CFFHelpText : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CFFHelpText)
CFFHelpText()
{
}
virtual ~CFFHelpText()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:type"), m_oType );
oNode.ReadAttributeBase( _T("w:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:type"), m_oType )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
virtual CString ToString() const
{
CString sResult;
if ( m_oVal.IsInit() )
{
sResult += "w:val=\"";
sResult += m_oVal->ToString();
sResult += "\" ";
}
if ( m_oType.IsInit() )
{
sResult += "w:type=\"";
sResult += m_oType->ToString();
sResult += "\" ";
}
return sResult;
}
public:
nullable<SimpleTypes::CInfoTextType<> > m_oType;
nullable<SimpleTypes::CFFHelpTextVal > m_oVal;
};
class CFFName : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CFFName)
CFFName()
{
}
virtual ~CFFName()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
virtual CString ToString() const
{
CString sResult;
if ( m_oVal.IsInit() )
{
sResult += "w:val=\"";
sResult += m_oVal->ToString();
sResult += "\" ";
}
return sResult;
}
public:
nullable<SimpleTypes::CFFName > m_oVal;
};
class CFFStatusText : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CFFStatusText)
CFFStatusText()
{
}
virtual ~CFFStatusText()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:type"), m_oType );
oNode.ReadAttributeBase( _T("w:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:type"), m_oType )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
virtual CString ToString() const
{
CString sResult;
if ( m_oVal.IsInit() )
{
sResult += "w:val=\"";
sResult += m_oVal->ToString();
sResult += "\" ";
}
if ( m_oType.IsInit() )
{
sResult += "w:type=\"";
sResult += m_oType->ToString();
sResult += "\" ";
}
return sResult;
}
public:
nullable<SimpleTypes::CInfoTextType<> > m_oType;
nullable<SimpleTypes::CFFStatusTextVal > m_oVal;
};
class CFFTextType : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CFFTextType)
CFFTextType()
{
}
virtual ~CFFTextType()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:val"), m_oVal );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, _T("w:val"), m_oVal )
WritingElement_ReadAttributes_End( oReader )
}
virtual CString ToString() const
{
CString sResult;
if ( m_oVal.IsInit() )
{
sResult += "w:val=\"";
sResult += m_oVal->ToString();
sResult += "\" ";
}
return sResult;
}
public:
nullable<SimpleTypes::CFFTextType<> > m_oVal;
};
}
}
namespace OOX
{
namespace Logic
{
class CFFCheckBox : public WritingElement
{
public:
CFFCheckBox()
{
}
CFFCheckBox(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CFFCheckBox(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CFFCheckBox()
{
}
public:
const CFFCheckBox &operator=(const XmlUtils::CXmlNode &oNode)
{
fromXML( (XmlUtils::CXmlNode&) oNode );
return *this;
}
const CFFCheckBox &operator=(const XmlUtils::CXmlLiteReader& oReader)
{
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
WritingElement_ReadNode( oNode, oChild, _T("w:checked"), m_oChecked );
WritingElement_ReadNode( oNode, oChild, _T("w:default"), m_oDefault );
WritingElement_ReadNode( oNode, oChild, _T("w:size"), m_oSize );
WritingElement_ReadNode( oNode, oChild, _T("w:sizeAuto"), m_oSizeAuto );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("w:checked") == sName )
m_oChecked = oReader;
else if ( _T("w:default") == sName )
m_oDefault = oReader;
else if ( _T("w:size") == sName )
m_oSize = oReader;
else if ( _T("w:sizeAuto") == sName )
m_oSizeAuto = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<w:checkBox>");
WritingElement_WriteNode_1( _T("<w:checked "), m_oChecked );
WritingElement_WriteNode_1( _T("<w:default "), m_oDefault );
WritingElement_WriteNode_1( _T("<w:size "), m_oSize );
WritingElement_WriteNode_1( _T("<w:sizeAuto "), m_oSizeAuto );
sResult += _T("</w:checkBox>");
return sResult;
}
virtual EElementType getType() const
{
return et_w_checkBox;
}
public:
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oChecked;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oDefault;
nullable<ComplexTypes::Word::CHpsMeasure > m_oSize;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oSizeAuto;
};
class CFFDDList : public WritingElement
{
public:
CFFDDList()
{
}
CFFDDList(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CFFDDList(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CFFDDList()
{
}
public:
const CFFDDList &operator=(const XmlUtils::CXmlNode &oNode)
{
fromXML( (XmlUtils::CXmlNode&) oNode );
return *this;
}
const CFFDDList &operator=(const XmlUtils::CXmlLiteReader& oReader)
{
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
WritingElement_ReadNode( oNode, oChild, _T("w:default"), m_oDefault );
WritingElement_ReadNode( oNode, oChild, _T("w:result"), m_oResult );
XmlUtils::CXmlNodes oListEntryNodes;
if ( oNode.GetNodes( _T("w:listEntry"), oListEntryNodes ) )
{
XmlUtils::CXmlNode oListEntryNode;
for ( int nIndex = 0; nIndex < oListEntryNodes.GetCount(); nIndex++ )
{
if ( oListEntryNodes.GetAt( nIndex, oListEntryNode ) )
{
ComplexTypes::Word::CString_ oListEntry = oListEntryNode;
m_arrListEntry.Add( oListEntry );
}
}
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("w:default") == sName )
m_oDefault = oReader;
else if ( _T("w:result") == sName )
m_oResult = oReader;
else if ( _T("w:listEntry") == sName )
{
ComplexTypes::Word::CString_ oListEntry = oReader;
m_arrListEntry.Add( oListEntry );
}
}
}
virtual CString toXML() const
{
CString sResult = _T("<w:ddList>");
WritingElement_WriteNode_1( _T("<w:default "), m_oDefault );
WritingElement_WriteNode_1( _T("<w:result "), m_oResult );
for ( int nIndex = 0; nIndex < m_arrListEntry.GetSize(); nIndex++ )
{
sResult += _T("<w:listEntry ");
sResult += m_arrListEntry[nIndex].ToString();
sResult += _T("/>");
}
sResult += _T("</w:ddList>");
return sResult;
}
virtual EElementType getType() const
{
return et_w_ddList;
}
public:
nullable<ComplexTypes::Word::CDecimalNumber > m_oDefault;
nullable<ComplexTypes::Word::CDecimalNumber > m_oResult;
CSimpleArray<ComplexTypes::Word::CString_ > m_arrListEntry;
};
class CFFTextInput : public WritingElement
{
public:
CFFTextInput()
{
}
CFFTextInput(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CFFTextInput(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CFFTextInput()
{
}
public:
const CFFTextInput &operator=(const XmlUtils::CXmlNode &oNode)
{
fromXML( (XmlUtils::CXmlNode&) oNode );
return *this;
}
const CFFTextInput &operator=(const XmlUtils::CXmlLiteReader& oReader)
{
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
WritingElement_ReadNode( oNode, oChild, _T("w:default"), m_oDefault );
WritingElement_ReadNode( oNode, oChild, _T("w:format"), m_oFormat );
WritingElement_ReadNode( oNode, oChild, _T("w:maxLength"), m_oMaxLength );
WritingElement_ReadNode( oNode, oChild, _T("w:type"), m_oType );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("w:default") == sName )
m_oDefault = oReader;
else if ( _T("w:format") == sName )
m_oFormat = oReader;
else if ( _T("w:maxLength") == sName )
m_oMaxLength = oReader;
else if ( _T("w:type") == sName )
m_oType = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<w:textInput>");
WritingElement_WriteNode_1( _T("<w:default "), m_oDefault );
WritingElement_WriteNode_1( _T("<w:format "), m_oFormat );
WritingElement_WriteNode_1( _T("<w:maxLength "), m_oMaxLength );
WritingElement_WriteNode_1( _T("<w:type "), m_oType );
sResult += _T("</w:textInput>");
return sResult;
}
virtual EElementType getType() const
{
return et_w_textInput;
}
public:
nullable<ComplexTypes::Word::CString_ > m_oDefault;
nullable<ComplexTypes::Word::CString_ > m_oFormat;
nullable<ComplexTypes::Word::CDecimalNumber > m_oMaxLength;
nullable<ComplexTypes::Word::CFFTextType > m_oType;
};
class CFFData : public WritingElement
{
public:
CFFData()
{
}
CFFData(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CFFData(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CFFData()
{
}
public:
const CFFData &operator=(const XmlUtils::CXmlNode &oNode)
{
fromXML( (XmlUtils::CXmlNode&) oNode );
return *this;
}
const CFFData &operator=(const XmlUtils::CXmlLiteReader& oReader)
{
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
XmlUtils::CXmlNode oChild;
WritingElement_ReadNode( oNode, oChild, _T("w:calcOnExit"), m_oCalcOnExit );
WritingElement_ReadNode( oNode, oChild, _T("w:checkBox"), m_oCheckBox );
WritingElement_ReadNode( oNode, oChild, _T("w:ddList"), m_oDDList );
WritingElement_ReadNode( oNode, oChild, _T("w:enabled"), m_oEnabled );
WritingElement_ReadNode( oNode, oChild, _T("w:entryMacro"), m_oEntryMacro );
WritingElement_ReadNode( oNode, oChild, _T("w:exitMacro"), m_oExitMacro );
WritingElement_ReadNode( oNode, oChild, _T("w:helpText"), m_oHelpText );
WritingElement_ReadNode( oNode, oChild, _T("w:label"), m_oLabel );
WritingElement_ReadNode( oNode, oChild, _T("w:name"), m_oName );
WritingElement_ReadNode( oNode, oChild, _T("w:statusText"), m_oStatusText );
WritingElement_ReadNode( oNode, oChild, _T("w:tabIndex"), m_oTabIndex );
WritingElement_ReadNode( oNode, oChild, _T("w:textInput"), m_oTextInput );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("w:calcOnExit") == sName ) m_oCalcOnExit = oReader;
else if ( _T("w:checkBox") == sName ) m_oCheckBox = oReader;
else if ( _T("w:ddList") == sName ) m_oDDList = oReader;
else if ( _T("w:enabled") == sName ) m_oEnabled = oReader;
else if ( _T("w:entryMacro") == sName ) m_oEntryMacro = oReader;
else if ( _T("w:exitMacro") == sName ) m_oExitMacro = oReader;
else if ( _T("w:helpText") == sName ) m_oHelpText = oReader;
else if ( _T("w:label") == sName ) m_oLabel = oReader;
else if ( _T("w:name") == sName ) m_oName = oReader;
else if ( _T("w:statusText") == sName ) m_oStatusText = oReader;
else if ( _T("w:tabIndex") == sName ) m_oTabIndex = oReader;
else if ( _T("w:textInput") == sName ) m_oTextInput = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<w:ffData>");
WritingElement_WriteNode_1( _T("<w:calcOnExit "), m_oCalcOnExit );
WritingElement_WriteNode_2( m_oCheckBox );
WritingElement_WriteNode_2( m_oDDList );
WritingElement_WriteNode_1( _T("<w:enabled "), m_oEnabled );
WritingElement_WriteNode_1( _T("<w:entryMacro "), m_oEntryMacro );
WritingElement_WriteNode_1( _T("<w:exitMacro "), m_oExitMacro );
WritingElement_WriteNode_1( _T("<w:helpText "), m_oHelpText );
WritingElement_WriteNode_1( _T("<w:label "), m_oLabel );
WritingElement_WriteNode_1( _T("<w:name "), m_oName );
WritingElement_WriteNode_1( _T("<w:statusText "), m_oStatusText );
WritingElement_WriteNode_1( _T("<w:tabIndex "), m_oTabIndex );
WritingElement_WriteNode_2( m_oTextInput );
sResult += _T("</w:ffData>");
return sResult;
}
virtual EElementType getType() const
{
return et_w_ffData;
}
public:
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oCalcOnExit;
nullable<OOX::Logic::CFFCheckBox > m_oCheckBox;
nullable<OOX::Logic::CFFDDList > m_oDDList;
nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oEnabled;
nullable<ComplexTypes::Word::CMacroName > m_oEntryMacro;
nullable<ComplexTypes::Word::CMacroName > m_oExitMacro;
nullable<ComplexTypes::Word::CFFHelpText > m_oHelpText;
nullable<ComplexTypes::Word::CDecimalNumber > m_oLabel;
nullable<ComplexTypes::Word::CFFName > m_oName;
nullable<ComplexTypes::Word::CFFStatusText > m_oStatusText;
nullable<ComplexTypes::Word::CUnsignedDecimalNumber > m_oTabIndex;
nullable<OOX::Logic::CFFTextInput > m_oTextInput;
};
class CFldChar : public WritingElement
{
public:
CFldChar()
{
}
CFldChar(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CFldChar(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CFldChar()
{
}
public:
const CFldChar &operator=(const XmlUtils::CXmlNode &oNode)
{
fromXML( (XmlUtils::CXmlNode&) oNode );
return *this;
}
const CFldChar &operator=(const XmlUtils::CXmlLiteReader& oReader)
{
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:dirty"), m_oDirty );
oNode.ReadAttributeBase( _T("w:fldCharType"), m_oFldCharType );
oNode.ReadAttributeBase( _T("w:fldLock"), m_oFldLock );
XmlUtils::CXmlNode oChild;
WritingElement_ReadNode( oNode, oChild, _T("w:ffData"), m_oFFData );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:ffData") == sName )
m_oFFData = oReader;
}
}
virtual CString toXML() const
{
CString sResult = _T("<w:fldChar ");
ComplexTypes_WriteAttribute( _T("w:dirty=\""), m_oDirty );
ComplexTypes_WriteAttribute( _T("w:fldCharType=\""), m_oFldCharType );
ComplexTypes_WriteAttribute( _T("w:fldLock=\""), m_oFldLock );
if ( m_oFFData.IsInit() )
{
sResult += _T(">");
sResult += m_oFFData->toXML();
sResult += _T("</w:fldChar>");
}
else
{
sResult += _T("/>");
}
return sResult;
}
virtual EElementType getType() const
{
return et_w_fldChar;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:dirty"), m_oDirty )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:fldCharType"), m_oFldCharType )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:fldLock"), m_oFldLock )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::COnOff<> > m_oDirty;
nullable<SimpleTypes::CFldCharType<> > m_oFldCharType;
nullable<SimpleTypes::COnOff<> > m_oFldLock;
nullable<OOX::Logic::CFFData > m_oFFData;
};
}
}
#endif // OOX_LOGIC_FLD_CHAR_INCLUDE_H_

View File

@@ -0,0 +1,276 @@
/*
* (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 "Bdo.h"
#include "FldSimple.h"
#include "Annotations.h"
#include "Run.h"
#include "RunProperty.h"
#include "ParagraphProperty.h"
#include "Sdt.h"
#include "Hyperlink.h"
#include "SmartTag.h"
#include "Dir.h"
#include "../Math/oMathPara.h"
#include "../Math/oMath.h"
namespace OOX
{
namespace Logic
{
void CFldSimple::fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:dirty"), m_oDirty );
oNode.ReadAttributeBase( _T("w:fldLock"), m_oFldLock );
oNode.ReadAttributeBase( _T("w:instr"), m_sInstr );
XmlUtils::CXmlNodes oChilds;
if ( oNode.GetNodes( _T("*"), oChilds ) )
{
XmlUtils::CXmlNode oItem;
for ( int nIndex = 0; nIndex < oChilds.GetCount(); nIndex++ )
{
if ( oChilds.GetAt( nIndex, oItem ) )
{
CString sName = oItem.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oItem );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oItem );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oItem );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oItem );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oItem );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oItem );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oItem );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oItem );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oItem );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oItem );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oItem );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oItem );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oItem );
else if ( _T("w:dir") == sName )
pItem = new CDir( oItem );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oItem );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oItem );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oItem );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oItem );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oItem );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oItem );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oItem );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oItem );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oItem );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oItem );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oItem );
else if ( _T("w:r") == sName )
pItem = new CRun( oItem );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oItem );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oItem );
if ( pItem )
m_arrItems.Add( pItem );
}
}
}
}
void CFldSimple::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oReader );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new CDel( oReader );
else if ( _T("w:dir") == sName )
pItem = new CDir( oReader );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oReader );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oReader );
else if ( _T("w:ins") == sName )
pItem = new CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oReader );
else if ( _T("w:r") == sName )
pItem = new CRun( oReader );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oReader );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
CString CFldSimple::toXML() const
{
CString sResult = _T("<w:fldSimple ");
sResult += _T("w:dirty=\"");
sResult += m_oDirty.ToString();
sResult += _T("\" ");
sResult += _T("w:fldLock=\"");
sResult += m_oFldLock.ToString();
sResult += _T("\" ");
if ( m_sInstr.IsInit() )
{
sResult += _T("w:instr=\"");
sResult += m_sInstr->GetString();
sResult += _T("\" ");
}
sResult += _T(">");
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
{
sResult += m_arrItems[nIndex]->toXML();
}
}
sResult += _T("</w:fldSimple>");
return sResult;
}
}
} // namespace OOX

View File

@@ -0,0 +1,146 @@
/*
* (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_LOGIC_FIELD_SIMPLE_INCLUDE_H_
#define OOX_LOGIC_FIELD_SIMPLE_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../WritingElement.h"
#include "../../Common/SimpleTypes_Word.h"
#include "../../Common/SimpleTypes_Shared.h"
namespace OOX
{
namespace Logic
{
class CFldSimple : public WritingElement
{
public:
CFldSimple()
{
}
CFldSimple(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CFldSimple(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CFldSimple()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
const CFldSimple &operator =(const XmlUtils::CXmlNode& oNode)
{
Clear();
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
const CFldSimple &operator =(const XmlUtils::CXmlLiteReader& oReader)
{
Clear();
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
void Clear()
{
m_oDirty.SetValue( SimpleTypes::onoffFalse );
m_oFldLock.SetValue( SimpleTypes::onoffFalse );
m_sInstr.reset();
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual CString toXML() const;
virtual EElementType getType() const
{
return et_w_fldSimple;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:dirty"), m_oDirty )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:fldLock"), m_oFldLock )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:instr"), m_sInstr )
WritingElement_ReadAttributes_End( oReader )
}
public:
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oDirty;
SimpleTypes::COnOff<SimpleTypes::onoffFalse> m_oFldLock;
nullable<CString > m_sInstr;
CSimpleArray<WritingElement *> m_arrItems;
};
}
}
#endif // OOX_LOGIC_FIELD_SIMPLE_INCLUDE_H_

View File

@@ -0,0 +1,309 @@
/*
* (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 "Hyperlink.h"
#include "Paragraph.h"
#include "Annotations.h"
#include "Run.h"
#include "RunProperty.h"
#include "ParagraphProperty.h"
#include "FldSimple.h"
#include "Bdo.h"
#include "Sdt.h"
#include "SmartTag.h"
#include "Dir.h"
#include "../Math/oMathPara.h"
#include "../Math/oMath.h"
namespace OOX
{
namespace Logic
{
void CHyperlink::fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:anchor"), m_sAnchor );
oNode.ReadAttributeBase( _T("w:docLocation"), m_sDocLocation );
oNode.ReadAttributeBase( _T("w:history"), m_oHistory );
oNode.ReadAttributeBase( _T("r:id"), m_oId );
oNode.ReadAttributeBase( _T("w:tgtFrame"), m_sTgtFrame );
oNode.ReadAttributeBase( _T("w:tooltip"), m_sTooltip );
XmlUtils::CXmlNodes oChilds;
if ( oNode.GetNodes( _T("*"), oChilds ) )
{
XmlUtils::CXmlNode oItem;
for ( int nIndex = 0; nIndex < oChilds.GetCount(); nIndex++ )
{
if ( oChilds.GetAt( nIndex, oItem ) )
{
CString sName = oItem.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oItem );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oItem );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oItem );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oItem );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oItem );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oItem );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oItem );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oItem );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oItem );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oItem );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oItem );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oItem );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oItem );
else if ( _T("w:dir") == sName )
pItem = new CDir( oItem );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oItem );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oItem );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oItem );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oItem );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oItem );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oItem );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oItem );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oItem );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oItem );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oItem );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oItem );
else if ( _T("w:r") == sName )
pItem = new CRun( oItem );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oItem );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oItem );
if ( pItem )
m_arrItems.Add( pItem );
}
}
}
}
void CHyperlink::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oReader );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new CDel( oReader );
else if ( _T("w:dir") == sName )
pItem = new CDir( oReader );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oReader );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oReader );
else if ( _T("w:ins") == sName )
pItem = new CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oReader );
else if ( _T("w:r") == sName )
pItem = new CRun( oReader );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oReader );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
CString CHyperlink::toXML() const
{
CString sResult = _T("<w:hyperlink ");
if ( m_sAnchor.IsInit() )
{
sResult += _T("w:anchor=\"");
sResult += m_sAnchor->GetString();
sResult += _T("\" ");
}
if ( m_sDocLocation.IsInit() )
{
sResult += _T("w:docLocation=\"");
sResult += m_sDocLocation->GetString();
sResult += _T("\" ");
}
if ( m_oHistory.IsInit() )
{
sResult += _T("w:history=\"");
sResult += m_oHistory->ToString();
sResult += _T("\" ");
}
if ( m_oId.IsInit() )
{
sResult += _T("r:id=\"");
sResult += m_oId->ToString();
sResult += _T("\" ");
}
if ( m_sTgtFrame.IsInit() )
{
sResult += _T("w:tgtFrame=\"");
sResult += m_sTgtFrame->GetString();
sResult += _T("\" ");
}
if ( m_sTooltip.IsInit() )
{
sResult += _T("w:tooltip=\"");
sResult += m_sTooltip->GetString();
sResult += _T("\" ");
}
sResult += _T(">");
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
{
sResult += m_arrItems[nIndex]->toXML();
}
}
sResult += _T("</w:hyperlink>");
return sResult;
}
}
} // namespace OOX

View File

@@ -0,0 +1,152 @@
/*
* (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_LOGIC_HYPERLINK_INCLUDE_H_
#define OOX_LOGIC_HYPERLINK_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../WritingElement.h"
#include "../../Common/SimpleTypes_Word.h"
#include "../../Common/SimpleTypes_Shared.h"
namespace OOX
{
namespace Logic
{
class CHyperlink : public WritingElement
{
public:
CHyperlink()
{
}
CHyperlink(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CHyperlink(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CHyperlink()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
const CHyperlink &operator =(const XmlUtils::CXmlNode& oNode)
{
Clear();
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
const CHyperlink &operator =(const XmlUtils::CXmlLiteReader& oReader)
{
Clear();
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
void Clear()
{
m_sAnchor.reset();
m_sDocLocation.reset();
m_oHistory.reset();
m_oId.reset();
m_sTgtFrame.reset();
m_sTooltip.reset();
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual CString toXML() const;
virtual EElementType getType() const
{
return et_w_hyperlink;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:anchor"), m_sAnchor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:docLocation"), m_sDocLocation )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:history"), m_oHistory )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("r:id"), m_oId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:tgtFrame"), m_sTgtFrame )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:tooltip"), m_sTooltip )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<CString > m_sAnchor;
nullable<CString > m_sDocLocation;
nullable<SimpleTypes::COnOff<SimpleTypes::onoffFalse> > m_oHistory;
nullable<SimpleTypes::CRelationshipId > m_oId;
nullable<CString > m_sTgtFrame;
nullable<CString > m_sTooltip;
CSimpleArray<WritingElement *> m_arrItems;
};
}
}
#endif // OOX_LOGIC_HYPERLINK_INCLUDE_H_

View File

@@ -0,0 +1,485 @@
/*
* (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 "Paragraph.h"
#include "Annotations.h"
#include "Run.h"
#include "RunProperty.h"
#include "ParagraphProperty.h"
#include "FldSimple.h"
#include "Bdo.h"
#include "Sdt.h"
#include "Hyperlink.h"
#include "SmartTag.h"
#include "Dir.h"
#include "../Math/oMathPara.h"
#include "../Math/oMath.h"
namespace OOX
{
namespace Logic
{
void CParagraph::fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:rsidDel"), m_oRsidDel );
oNode.ReadAttributeBase( _T("w:rsidP"), m_oRsidP );
oNode.ReadAttributeBase( _T("w:rsidR"), m_oRsidR );
oNode.ReadAttributeBase( _T("w:rsidRDefault"), m_oRsidRDefault );
oNode.ReadAttributeBase( _T("w:rsidRPr"), m_oRsidRPr );
XmlUtils::CXmlNodes oChilds;
if ( oNode.GetNodes( _T("*"), oChilds ) )
{
XmlUtils::CXmlNode oItem;
for ( int nIndex = 0; nIndex < oChilds.GetCount(); nIndex++ )
{
if ( oChilds.GetAt( nIndex, oItem ) )
{
CString sName = oItem.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oItem );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oItem );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oItem );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oItem );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oItem );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oItem );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oItem );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oItem );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oItem );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oItem );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oItem );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oItem );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oItem );
else if ( _T("w:dir") == sName )
pItem = new CDir( oItem );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oItem );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oItem );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oItem );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oItem );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oItem );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oItem );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oItem );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oItem );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oItem );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oItem );
else if ( _T("w:pPr") == sName )
pItem = new CParagraphProperty( oItem );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oItem );
else if ( _T("w:r") == sName )
pItem = new CRun( oItem );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oItem );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oItem );
if ( pItem )
m_arrItems.Add( pItem );
}
}
}
}
void CParagraph::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:bdo") == sName )
pItem = new CBdo( oReader );
else if ( _T("w:bookmarkEnd") == sName )
pItem = new CBookmarkEnd( oReader );
else if ( _T("w:bookmarkStart") == sName )
pItem = new CBookmarkStart( oReader );
else if ( _T("w:commentRangeEnd") == sName )
pItem = new CCommentRangeEnd( oReader );
else if ( _T("w:commentRangeStart") == sName )
pItem = new CCommentRangeStart( oReader );
else if ( _T("w:customXmlDelRangeEnd") == sName )
pItem = new CCustomXmlDelRangeEnd( oReader );
else if ( _T("w:customXmlDelRangeStart") == sName )
pItem = new CCustomXmlDelRangeStart( oReader );
else if ( _T("w:customXmlInsRangeEnd") == sName )
pItem = new CCustomXmlInsRangeEnd( oReader );
else if ( _T("w:customXmlInsRangeStart") == sName )
pItem = new CCustomXmlInsRangeStart( oReader );
else if ( _T("w:customXmlMoveFromRangeEnd") == sName )
pItem = new CCustomXmlMoveFromRangeEnd( oReader );
else if ( _T("w:customXmlMoveFromRangeStart") == sName )
pItem = new CCustomXmlMoveFromRangeStart( oReader );
else if ( _T("w:customXmlMoveToRangeEnd") == sName )
pItem = new CCustomXmlMoveToRangeEnd( oReader );
else if ( _T("w:customXmlMoveToRangeStart") == sName )
pItem = new CCustomXmlMoveToRangeStart( oReader );
else if ( _T("w:del") == sName )
pItem = new CDel( oReader );
else if ( _T("w:dir") == sName )
pItem = new CDir( oReader );
else if ( _T("w:fldSimple") == sName )
pItem = new CFldSimple( oReader );
else if ( _T("w:hyperlink") == sName )
pItem = new CHyperlink( oReader );
else if ( _T("w:ins") == sName )
pItem = new CIns( oReader );
else if ( _T("w:moveFromRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveFromRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("w:moveToRangeEnd") == sName )
pItem = new CMoveToRangeEnd( oReader );
else if ( _T("w:moveToRangeStart") == sName )
pItem = new CMoveToRangeStart( oReader );
else if ( _T("m:oMath") == sName )
pItem = new COMath( oReader );
else if ( _T("m:oMathPara") == sName )
pItem = new COMathPara( oReader );
else if ( _T("w:permEnd") == sName )
pItem = new CPermEnd( oReader );
else if ( _T("w:permStart") == sName )
pItem = new CPermStart( oReader );
else if ( _T("w:pPr") == sName )
pItem = new CParagraphProperty( oReader );
else if ( _T("w:proofErr") == sName )
pItem = new CProofErr( oReader );
else if ( _T("w:r") == sName )
pItem = new CRun( oReader );
else if ( _T("w:sdt") == sName )
pItem = new CSdt( oReader );
else if ( _T("w:smartTag") == sName )
pItem = new CSmartTag( oReader );
if ( pItem )
m_arrItems.Add( pItem );
}
}
CString CParagraph::toXML() const
{
CString sResult = _T("<w:p ");
ComplexTypes_WriteAttribute( _T("w:rsidDel=\""), m_oRsidDel );
ComplexTypes_WriteAttribute( _T("w:rsidP=\""), m_oRsidP );
ComplexTypes_WriteAttribute( _T("w:rsidR=\""), m_oRsidR );
ComplexTypes_WriteAttribute( _T("w:rsidRDefault=\""), m_oRsidRDefault );
ComplexTypes_WriteAttribute( _T("w:rsidRPr=\""), m_oRsidRPr );
ComplexTypes_WriteAttribute( _T("w14:paraId=\""), m_oParaId );
ComplexTypes_WriteAttribute( _T("w14:textId=\""), m_oTextId );
sResult += _T(">");
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
{
sResult += m_arrItems[nIndex]->toXML();
}
}
sResult += _T("</w:p>");
return sResult;
}
void CParagraph::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:rsidDel"), m_oRsidDel )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:rsidP"), m_oRsidP )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:rsidR"), m_oRsidR )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:rsidRDefault"), m_oRsidRDefault )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:rsidRPr"), m_oRsidRPr )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w14:paraId"), m_oParaId )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w14:textId"), m_oTextId )
WritingElement_ReadAttributes_End( oReader )
}
void CParagraph::AddRun(CRun *pRun)
{
m_arrItems.Add( (WritingElement*)pRun );
}
void CParagraph::AddText(CString& sText)
{
WritingElement *pR = new CRun();
if ( !pR )
return;
WritingElement *pT = new CText();
if ( !pT )
{
delete pR;
return;
}
CText *pText = (CText*)pT;
pText->m_sText = sText;
pText->m_oSpace = new SimpleTypes::CXmlSpace<>();
pText->m_oSpace->SetValue( SimpleTypes::xmlspacePreserve );
((CRun*)pR)->m_arrItems.Add( pT );
m_arrItems.Add( pR );
}
void CParagraph::AddText(CString& sText, CRunProperty *pProperty)
{
WritingElement *pR = new CRun();
if ( !pR )
return;
WritingElement *pT = new CText();
if ( !pT )
{
delete pR;
return;
}
CText *pText = (CText*)pT;
pText->m_sText = sText;
pText->m_oSpace = new SimpleTypes::CXmlSpace<>();
pText->m_oSpace->SetValue( SimpleTypes::xmlspacePreserve );
if ( pProperty )
((CRun*)pR)->m_arrItems.Add( (WritingElement*)pProperty );
((CRun*)pR)->m_arrItems.Add( pT );
m_arrItems.Add( pR );
}
void CParagraph::AddTab()
{
WritingElement *pR = new CRun();
if ( !pR )
return;
WritingElement *pTab = new CTab();
if ( !pTab )
{
delete pR;
return;
}
((CRun*)pR)->m_arrItems.Add( pTab );
m_arrItems.Add( pR );
}
void CParagraph::AddTab(CRunProperty *pProperty)
{
WritingElement *pR = new CRun();
if ( !pR )
return;
WritingElement *pTab = new CTab();
if ( !pTab )
{
delete pR;
return;
}
if ( pProperty )
((CRun*)pR)->m_arrItems.Add( (WritingElement*)pProperty );
((CRun*)pR)->m_arrItems.Add( pTab );
m_arrItems.Add( pR );
}
void CParagraph::AddBreak(SimpleTypes::EBrType eType)
{
WritingElement *pR = new CRun();
if ( !pR )
return;
WritingElement *pBr = new CBr();
if ( !pBr )
{
delete pR;
return;
}
((CBr*)pBr)->m_oType.SetValue( eType );
((CRun*)pR)->m_arrItems.Add( pBr );
m_arrItems.Add( pR );
}
void CParagraph::AddSpace(const int nCount)
{
WritingElement *pR = new CRun();
if ( !pR )
return;
WritingElement *pT = new CText();
if ( !pT )
{
delete pR;
return;
}
CText *pText = (CText*)pT;
char *sString = new char[nCount + 1];
::memset( sString, 0x20, nCount );
sString[nCount] = '\0';
pText->m_sText = sString;
delete sString;
pText->m_oSpace = new SimpleTypes::CXmlSpace<>();
pText->m_oSpace->SetValue( SimpleTypes::xmlspacePreserve );
((CRun*)pR)->m_arrItems.Add( pT );
m_arrItems.Add( pR );
}
void CParagraph::AddSpace(const int nCount, CRunProperty *pProperty)
{
WritingElement *pR = new CRun();
if ( !pR )
return;
WritingElement *pT = new CText();
if ( !pT )
{
delete pR;
return;
}
CText *pText = (CText*)pT;
char *sString = new char[nCount + 1];
::memset( sString, 0x20, nCount );
sString[nCount] = '\0';
pText->m_sText = sString;
delete sString;
pText->m_oSpace = new SimpleTypes::CXmlSpace<>();
pText->m_oSpace->SetValue( SimpleTypes::xmlspacePreserve );
if ( pProperty )
((CRun*)pR)->m_arrItems.Add( (WritingElement*)pProperty );
((CRun*)pR)->m_arrItems.Add( pT );
m_arrItems.Add( pR );
}
void CParagraph::AddBookmarkStart(int nId, CString& sName)
{
WritingElement *pBS = new CBookmarkStart();
if ( !pBS )
return;
((CBookmarkStart*)pBS)->m_oId = new SimpleTypes::CDecimalNumber<>();
((CBookmarkStart*)pBS)->m_oId->SetValue( nId );
((CBookmarkStart*)pBS)->m_sName = sName;
m_arrItems.Add( pBS );
}
void CParagraph::AddBookmarkEnd (int nId)
{
WritingElement *pBE = new CBookmarkEnd();
if ( !pBE )
return;
((CBookmarkEnd*)pBE)->m_oId = new SimpleTypes::CDecimalNumber<>();
((CBookmarkEnd*)pBE)->m_oId->SetValue( nId );
m_arrItems.Add( pBE );
}
}
} // namespace OOX

View File

@@ -0,0 +1,160 @@
/*
* (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_LOGIC_PARAGRAPH_INCLUDE_H_
#define OOX_LOGIC_PARAGRAPH_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../WritingElement.h"
#include "../../Common/SimpleTypes_Word.h"
#include "RunProperty.h"
#include "Run.h"
#include "Hyperlink.h"
#include "SmartTag.h"
#include "Dir.h"
#include "Bdo.h"
#include "../Math/OMathPara.h"
namespace OOX
{
namespace Logic
{
class CParagraph : public WritingElement
{
public:
CParagraph()
{
}
CParagraph(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CParagraph(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CParagraph()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
const CParagraph &operator =(const XmlUtils::CXmlNode& oNode)
{
Clear();
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
const CParagraph &operator =(const XmlUtils::CXmlLiteReader& oReader)
{
Clear();
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
public:
void Clear()
{
m_oRsidDel.reset();
m_oRsidP.reset();
m_oRsidR.reset();
m_oRsidRDefault.reset();
m_oRsidRPr.reset();
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
void AddRun(CRun *pRun);
void AddText(CString& sText);
void AddText(CString& sText, CRunProperty *pProperty);
void AddTab();
void AddTab(CRunProperty *pProperty);
void AddBreak(SimpleTypes::EBrType eType);
void AddSpace(const int nCount);
void AddSpace(const int nCount, CRunProperty *pProperty);
void AddBookmarkStart(int nId, CString& sName);
void AddBookmarkEnd (int nId);
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode);
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual CString toXML() const;
virtual EElementType getType() const
{
return et_w_p;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
public:
nullable<SimpleTypes::CLongHexNumber<> > m_oParaId;
nullable<SimpleTypes::CLongHexNumber<> > m_oTextId;
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidDel;
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidP;
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidR;
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidRDefault;
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidRPr;
CSimpleArray<WritingElement *> m_arrItems;
};
}
}
#endif

View File

@@ -0,0 +1,153 @@
/*
* (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 "ParagraphProperty.h"
namespace OOX
{
namespace Logic
{
CPPrChange::CPPrChange()
{
m_pParPr.Init();
m_pParPr->m_bPPrChange = true;
}
CPPrChange::CPPrChange(XmlUtils::CXmlNode &oNode)
{
m_pParPr.Init();
m_pParPr->m_bPPrChange = true;
fromXML( oNode );
}
CPPrChange::CPPrChange(XmlUtils::CXmlLiteReader& oReader)
{
m_pParPr.Init();
m_pParPr->m_bPPrChange = true;
fromXML( oReader );
}
const CPPrChange& CPPrChange::operator =(const XmlUtils::CXmlNode &oNode)
{
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
const CPPrChange& CPPrChange::operator =(const XmlUtils::CXmlLiteReader& oReader)
{
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
CPPrChange::~CPPrChange()
{
}
void CPPrChange::fromXML(XmlUtils::CXmlNode& oNode)
{
if ( _T("w:pPrChange") != oNode.GetName() )
return;
oNode.ReadAttributeBase( _T("w:author"), m_sAuthor );
oNode.ReadAttributeBase( _T("w:date"), m_oDate );
oNode.ReadAttributeBase( _T("w:id"), m_oID );
XmlUtils::CXmlNode oNode_pPr;
if ( m_pParPr.IsInit() && oNode.GetNode( _T("w:pPr"), oNode_pPr ) )
m_pParPr->fromXML( oNode_pPr );
}
void CPPrChange::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
if ( _T("w:pPr") == sName )
m_pParPr->fromXML( oReader );
}
}
CString CPPrChange::toXML() const
{
CString sResult = _T("<w:pPrChange ");
if ( m_sAuthor.IsInit() )
{
sResult += "w:author=\"";
sResult += m_sAuthor->GetString();
sResult += "\" ";
}
if ( m_oDate.IsInit() )
{
sResult += "w:date=\"";
sResult += m_oDate->ToString();
sResult += "\" ";
}
if ( m_oID.IsInit() )
{
sResult += "w:id=\"";
sResult += m_oID->ToString();
sResult += "\" ";
}
sResult += _T(">");
if ( m_pParPr.IsInit() )
sResult += m_pParPr->toXML();
sResult += _T("</w:pPrChange>");
return sResult;
}
EElementType CPPrChange::getType() const
{
return et_w_pPrChange;
}
void CPPrChange::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:author"), m_sAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oID )
WritingElement_ReadAttributes_End( oReader )
}
}
} // OOX

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,428 @@
/*
* (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_LOGIC_PICT_INCLUDE_H_
#define OOX_LOGIC_PICT_INCLUDE_H_
#include "../../Base/Nullable.h"
#include "../../Common/SimpleTypes_Word.h"
#include "../WritingElement.h"
#include "../RId.h"
#include "VmlOfficeDrawing.h"
#include "Vml.h"
namespace OOX
{
namespace Logic
{
class CControl : public WritingElement
{
public:
WritingElement_AdditionConstructors(CControl)
CControl() {}
virtual ~CControl() {}
public:
virtual void fromXML(XmlUtils::CXmlNode &oNode)
{
oNode.ReadAttributeBase( _T("r:id"), m_rId );
oNode.ReadAttributeBase( _T("w:name"), m_sName );
oNode.ReadAttributeBase( _T("w:shapeid"), m_sShapeId );
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd( oReader.GetDepth() );
}
virtual CString toXML() const
{
CString sResult = _T("<w:control ");
ComplexTypes_WriteAttribute ( _T("r:id=\""), m_rId );
ComplexTypes_WriteAttribute2( _T("w:name=\""), m_sName );
ComplexTypes_WriteAttribute2( _T("w:shapeid=\""), m_sShapeId );
sResult += _T("/>");
return sResult;
}
virtual EElementType getType() const
{
return et_w_control;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.GetAttributesCount() <= 0 )
return;
if ( !oReader.MoveToFirstAttribute() )
return;
CWCharWrapper wsName = oReader.GetName();
while( !wsName.IsNull() )
{
if ( _T("r:id") == wsName )
m_rId = oReader.GetText();
else if ( _T("w:name") == wsName )
m_sName = oReader.GetText();
else if ( _T("w:shapeid") == wsName )
m_sShapeId = oReader.GetText();
if ( !oReader.MoveToNextAttribute() )
break;
wsName = oReader.GetName();
}
oReader.MoveToElement();
}
public:
nullable<SimpleTypes::CRelationshipId> m_rId;
nullable<CString> m_sName;
nullable<CString> m_sShapeId;
};
class CPicture : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPicture)
CPicture() {}
virtual ~CPicture()
{
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
}
public:
virtual void fromXML(XmlUtils::CXmlNode &oNode)
{
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
m_sXml.Init();
m_sXml->Append(oReader.GetOuterXml());
return;
CString sXml;
sXml.Format(_T("<root xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\">%s</root>"), m_sXml.get());
XmlUtils::CXmlLiteReader oSubReader;
oSubReader.FromString(sXml);
oSubReader.ReadNextNode();
oSubReader.ReadNextNode();
int nCurDepth = oSubReader.GetDepth();
while ( oSubReader.ReadNextSiblingNode( nCurDepth ) )
{
CWCharWrapper sName = oSubReader.GetName();
WritingElement* pItem = NULL;
wchar_t wChar0 = sName[0];
switch (wChar0)
{
case 'o':
{
wchar_t wChar2 = sName[2];
switch ( wChar2 )
{
case 'b':
if ( _T("o:bottom") == sName )
pItem = new OOX::VmlOffice::CStrokeChild( oSubReader );
break;
case 'c':
if ( _T("o:callout") == sName )
pItem = new OOX::VmlOffice::CCallout( oSubReader );
else if ( _T("o:clippath") == sName )
pItem = new OOX::VmlOffice::CClipPath( oSubReader );
else if ( _T("o:column") == sName )
pItem = new OOX::VmlOffice::CStrokeChild( oSubReader );
else if ( _T("o:complex") == sName )
pItem = new OOX::VmlOffice::CComplex( oSubReader );
break;
case 'd':
if ( _T("o:diagram") == sName )
pItem = new OOX::VmlOffice::CDiagram( oSubReader );
break;
case 'e':
if ( _T("o:equationxml") == sName )
pItem = new OOX::VmlOffice::CEquationXml( oSubReader );
else if ( _T("o:extrusion") == sName )
pItem = new OOX::VmlOffice::CExtrusion( oSubReader );
break;
case 'f':
if ( _T("o:fill") == sName )
pItem = new OOX::VmlOffice::CFill( oSubReader );
break;
case 'i':
if ( _T("o:ink") == sName )
pItem = new OOX::VmlOffice::CInk( oSubReader );
break;
case 'l':
if ( _T("o:left") == sName )
pItem = new OOX::VmlOffice::CStrokeChild( oSubReader );
else if ( _T("o:lock") == sName )
pItem = new OOX::VmlOffice::CLock( oSubReader );
break;
case 'O':
if ( _T("o:OLEObject") == sName )
pItem = new OOX::VmlOffice::COLEObject( oSubReader );
break;
case 'r':
if ( _T("o:right") == sName )
pItem = new OOX::VmlOffice::CStrokeChild( oSubReader );
break;
case 's':
if ( _T("o:shapedefaults") == sName )
pItem = new OOX::VmlOffice::CShapeDefaults( oSubReader );
else if ( _T("o:shapelayout") == sName )
pItem = new OOX::VmlOffice::CShapeLayout( oSubReader );
else if ( _T("o:signatureline") == sName )
pItem = new OOX::VmlOffice::CSignatureLine( oSubReader );
else if ( _T("o:skew") == sName )
pItem = new OOX::VmlOffice::CSkew( oSubReader );
break;
case 't':
if ( _T("o:top") == sName )
pItem = new OOX::VmlOffice::CStrokeChild( oSubReader );
break;
}
break;
}
case 'v':
{
wchar_t wChar2 = sName[2];
switch ( wChar2 )
{
case 'a':
if ( _T("v:arc") == sName )
pItem = new OOX::Vml::CArc( oSubReader );
break;
case 'b':
if ( _T("v:background") == sName )
pItem = new OOX::Vml::CBackground( oSubReader );
break;
case 'c':
if ( _T("v:curve") == sName )
pItem = new OOX::Vml::CCurve( oSubReader );
break;
case 'f':
if ( _T("v:fill") == sName )
pItem = new OOX::Vml::CFill( oSubReader );
else if ( _T("v:formulas") == sName )
pItem = new OOX::Vml::CFormulas( oSubReader );
break;
case 'g':
if ( _T("v:group") == sName )
pItem = new OOX::Vml::CGroup( oSubReader );
break;
case 'h':
if ( _T("v:handles") == sName )
pItem = new OOX::Vml::CHandles( oSubReader );
break;
case 'i':
if ( _T("v:image") == sName )
pItem = new OOX::Vml::CImage( oSubReader );
else if ( _T("v:imagedata") == sName )
pItem = new OOX::Vml::CImageData( oSubReader );
break;
case 'l':
if ( _T("v:line") == sName )
pItem = new OOX::Vml::CLine( oSubReader );
break;
case 'o':
if ( _T("v:oval") == sName )
pItem = new OOX::Vml::COval( oSubReader );
break;
case 'p':
if ( _T("v:path") == sName )
pItem = new OOX::Vml::CPath( oSubReader );
else if ( _T("v:polyline") == sName )
pItem = new OOX::Vml::CPolyLine( oSubReader );
break;
case 'r':
if ( _T("v:rect") == sName )
pItem = new OOX::Vml::CRect( oSubReader );
else if ( _T("v:roundrect") == sName )
pItem = new OOX::Vml::CRoundRect( oSubReader );
break;
case 's':
if ( _T("v:shadow") == sName )
pItem = new OOX::Vml::CShadow( oSubReader );
else if ( _T("v:shape") == sName )
pItem = new OOX::Vml::CShape( oSubReader );
else if ( _T("v:shapetype") == sName )
pItem = new OOX::Vml::CShapeType( oSubReader );
else if ( _T("v:stroke") == sName )
pItem = new OOX::Vml::CStroke( oSubReader );
break;
case 't':
if ( _T("v:textbox") == sName )
pItem = new OOX::Vml::CTextbox( oSubReader );
else if ( _T("v:textpath") == sName )
pItem = new OOX::Vml::CTextPath( oSubReader );
break;
}
break;
}
case 'w':
if ( _T("w:control") == sName )
m_oControl = oSubReader;
break;
}
if ( pItem )
m_arrItems.Add( pItem );
}
}
virtual CString toXML() const
{
CString sResult = _T("<w:pict>");
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
sResult += m_arrItems[nIndex]->toXML();
}
if ( m_oControl.IsInit() )
sResult += m_oControl->toXML();
sResult += _T("</w:pict>");
return sResult;
}
virtual EElementType getType() const
{
return et_w_pict;
}
public:
nullable<CString> m_sXml;
nullable<OOX::Logic::CControl> m_oControl;
CSimpleArray<WritingElement*> m_arrItems;
};
}
}
#endif // OOX_LOGIC_PICT_INCLUDE_H_

View File

@@ -0,0 +1,380 @@
/*
* (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_LOGIC_RUN_INCLUDE_H_
#define OOX_LOGIC_RUN_INCLUDE_H_
#include "RunProperty.h"
#include "RunContent.h"
#include "FldChar.h"
#include "FldSimple.h"
#include "../Drawing/Drawing.h"
#include "Pict.h"
#include "Annotations.h"
#include "AlternateContent.h"
#include "../../XlsxFormat/Chart/ChartStyle.h"
namespace OOX
{
namespace Logic
{
class CRun : public WritingElement
{
public:
CRun()
{
}
CRun(XmlUtils::CXmlNode &oNode)
{
fromXML( oNode );
}
CRun(XmlUtils::CXmlLiteReader& oReader)
{
fromXML( oReader );
}
virtual ~CRun()
{
Clear();
}
public:
const CRun &operator =(const XmlUtils::CXmlNode& oNode)
{
Clear();
fromXML( (XmlUtils::CXmlNode&)oNode );
return *this;
}
const CRun &operator =(const XmlUtils::CXmlLiteReader& oReader)
{
Clear();
fromXML( (XmlUtils::CXmlLiteReader&)oReader );
return *this;
}
void Clear()
{
m_oRsidDel.reset();
m_oRsidR.reset();
m_oRsidRPr.reset();
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrItems[nIndex];
m_arrItems[nIndex] = NULL;
}
m_arrItems.RemoveAll();
for ( int nIndex = 0; nIndex < m_arrSpreadsheetItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
delete m_arrSpreadsheetItems[nIndex];
m_arrSpreadsheetItems[nIndex] = NULL;
}
m_arrSpreadsheetItems.RemoveAll();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& oNode)
{
oNode.ReadAttributeBase( _T("w:rsidDel"), m_oRsidDel );
oNode.ReadAttributeBase( _T("w:rsidR"), m_oRsidR );
oNode.ReadAttributeBase( _T("w:rsidRPr"), m_oRsidRPr );
XmlUtils::CXmlNodes oChilds;
if ( oNode.GetNodes( _T("*"), oChilds ) )
{
XmlUtils::CXmlNode oItem;
for ( int nIndex = 0; nIndex < oChilds.GetCount(); nIndex++ )
{
if ( oChilds.GetAt( nIndex, oItem ) )
{
CString sName = oItem.GetName();
WritingElement *pItem = NULL;
if ( _T("w:annotationRef") == sName )
pItem = new CAnnotationRef( oItem );
else if ( _T("w:br") == sName )
pItem = new CBr( oItem );
else if ( _T("w:commentReference") == sName )
pItem = new CCommentReference( oItem );
else if ( _T("w:contentPart") == sName )
pItem = new CContentPart( oItem );
else if ( _T("w:continuationSeparator") == sName )
pItem = new CContinuationSeparator( oItem );
else if ( _T("w:cr") == sName )
pItem = new CCr( oItem );
else if ( _T("w:dayLong") == sName )
pItem = new CDayLong( oItem );
else if ( _T("w:dayShort") == sName )
pItem = new CDayShort( oItem );
else if ( _T("w:delInstrText") == sName )
pItem = new CDelInstrText( oItem );
else if ( _T("w:delText") == sName )
pItem = new CDelText( oItem );
else if ( _T("w:drawing") == sName )
pItem = new CDrawing( oItem );
else if ( _T("w:endnoteRef") == sName )
pItem = new CEndnoteRef( oItem );
else if ( _T("w:endnoteReference") == sName )
pItem = new CEndnoteReference( oItem );
else if ( _T("w:fldChar") == sName )
pItem = new CFldChar( oItem );
else if ( _T("w:footnoteRef") == sName )
pItem = new CFootnoteRef( oItem );
else if ( _T("w:footnoteReference") == sName )
pItem = new CFootnoteReference( oItem );
else if ( _T("w:instrText") == sName )
pItem = new CInstrText( oItem );
else if ( _T("w:lastRenderedPageBreak") == sName )
pItem = new CLastRenderedPageBreak( oItem );
else if ( _T("w:monthLong") == sName )
pItem = new CMonthLong( oItem );
else if ( _T("w:monthShort") == sName )
pItem = new CMonthShort( oItem );
else if ( _T("w:noBreakHyphen") == sName )
pItem = new CNoBreakHyphen( oItem );
else if ( _T("w:object") == sName )
pItem = new CPicture( oItem );
else if ( _T("w:pgNum") == sName )
pItem = new CPgNum( oItem );
else if ( _T("w:pict") == sName )
pItem = new CPicture( oItem );
else if ( _T("w:ptab") == sName )
pItem = new CPTab( oItem );
else if ( _T("w:rPr") == sName )
pItem = new CRunProperty( oItem );
else if ( _T("w:ruby") == sName )
pItem = new CRuby( oItem );
else if ( _T("w:separator") == sName )
pItem = new CSeparator( oItem );
else if ( _T("w:softHyphen") == sName )
pItem = new CSoftHyphen( oItem );
else if ( _T("w:sym") == sName )
pItem = new CSym( oItem );
else if ( _T("w:t") == sName )
pItem = new CText( oItem );
else if ( _T("w:tab") == sName )
pItem = new CTab( oItem );
else if ( _T("w:yearLong") == sName )
pItem = new CYearLong( oItem );
else if ( _T("w:yearShort") == sName )
pItem = new CYearShort( oItem );
if ( pItem )
m_arrItems.Add( pItem );
}
}
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
OOX::Spreadsheet::WritingElement *pSpreadsheetItem = NULL;
if ( _T("mc:AlternateContent") == sName )
pItem = new CAlternateContent( oReader );
else if ( _T("w:annotationRef") == sName )
pItem = new CAnnotationRef( oReader );
else if ( _T("w:br") == sName )
pItem = new CBr( oReader );
else if ( _T("w:commentReference") == sName )
pItem = new CCommentReference( oReader );
else if ( _T("w:contentPart") == sName )
pItem = new CContentPart( oReader );
else if ( _T("w:continuationSeparator") == sName )
pItem = new CContinuationSeparator( oReader );
else if ( _T("w:cr") == sName )
pItem = new CCr( oReader );
else if ( _T("w:dayLong") == sName )
pItem = new CDayLong( oReader );
else if ( _T("w:dayShort") == sName )
pItem = new CDayShort( oReader );
else if ( _T("w:delInstrText") == sName )
pItem = new CDelInstrText( oReader );
else if ( _T("w:delText") == sName )
pItem = new CDelText( oReader );
else if ( _T("w:drawing") == sName )
pItem = new CDrawing( oReader );
else if ( _T("w:endnoteRef") == sName )
pItem = new CEndnoteRef( oReader );
else if ( _T("w:endnoteReference") == sName )
pItem = new CEndnoteReference( oReader );
else if ( _T("w:fldChar") == sName )
pItem = new CFldChar( oReader );
else if ( _T("w:footnoteRef") == sName )
pItem = new CFootnoteRef( oReader );
else if ( _T("w:footnoteReference") == sName )
pItem = new CFootnoteReference( oReader );
else if ( _T("w:instrText") == sName )
pItem = new CInstrText( oReader );
else if ( _T("w:lastRenderedPageBreak") == sName )
pItem = new CLastRenderedPageBreak( oReader );
else if ( _T("w:monthLong") == sName )
pItem = new CMonthLong( oReader );
else if ( _T("w:monthShort") == sName )
pItem = new CMonthShort( oReader );
else if ( _T("w:noBreakHyphen") == sName )
pItem = new CNoBreakHyphen( oReader );
else if ( _T("w:object") == sName )
pItem = new CPicture( oReader );
else if ( _T("w:pgNum") == sName )
pItem = new CPgNum( oReader );
else if ( _T("w:pict") == sName )
pItem = new CPicture( oReader );
else if ( _T("w:ptab") == sName )
pItem = new CPTab( oReader );
else if ( _T("w:rPr") == sName )
pItem = new CRunProperty( oReader );
else if ( _T("w:ruby") == sName )
pItem = new CRuby( oReader );
else if ( _T("w:separator") == sName )
pItem = new CSeparator( oReader );
else if ( _T("w:softHyphen") == sName )
pItem = new CSoftHyphen( oReader );
else if ( _T("w:sym") == sName )
pItem = new CSym( oReader );
else if ( _T("w:t") == sName )
pItem = new CText( oReader );
else if ( _T("w:tab") == sName )
pItem = new CTab( oReader );
else if ( _T("w:yearLong") == sName )
pItem = new CYearLong( oReader );
else if ( _T("c:style") == sName )
pSpreadsheetItem = new OOX::Spreadsheet::CChartStyle( oReader );
else if ( _T("c14:style") == sName )
pSpreadsheetItem = new OOX::Spreadsheet::CChartStyle( oReader );
if ( pItem )
m_arrItems.Add( pItem );
if ( pSpreadsheetItem )
m_arrSpreadsheetItems.Add( pSpreadsheetItem );
}
}
virtual CString toXML() const
{
CString sResult = _T("<w:r ");
ComplexTypes_WriteAttribute( _T("w:rsidDel=\""), m_oRsidDel );
ComplexTypes_WriteAttribute( _T("w:rsidR=\""), m_oRsidR );
ComplexTypes_WriteAttribute( _T("w:rsidRPr=\""), m_oRsidRPr );
sResult += _T(">");
for ( int nIndex = 0; nIndex < m_arrItems.GetSize(); nIndex++ )
{
if ( m_arrItems[nIndex] )
{
sResult += m_arrItems[nIndex]->toXML();
}
}
for ( int nIndex = 0; nIndex < m_arrSpreadsheetItems.GetSize(); nIndex++ )
{
if ( m_arrSpreadsheetItems[nIndex] )
{
sResult += m_arrSpreadsheetItems[nIndex]->toXML();
}
}
sResult += _T("</w:r>");
return sResult;
}
virtual EElementType getType() const
{
return et_w_r;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.GetAttributesCount() <= 0 )
return;
if ( !oReader.MoveToFirstAttribute() )
return;
CWCharWrapper wsName = oReader.GetName();
while( !wsName.IsNull() )
{
if ( _T("w:rsidDel") == wsName )
m_oRsidDel = oReader.GetText();
else if ( _T("w:rsidR") == wsName )
m_oRsidR = oReader.GetText();
else if ( _T("w:rsidRPr") == wsName )
m_oRsidRPr = oReader.GetText();
if ( !oReader.MoveToNextAttribute() )
break;
wsName = oReader.GetName();
}
oReader.MoveToElement();
}
public:
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidDel;
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidR;
nullable<SimpleTypes::CLongHexNumber<> > m_oRsidRPr;
CSimpleArray<WritingElement *> m_arrItems;
CSimpleArray<OOX::Spreadsheet::WritingElement *> m_arrSpreadsheetItems;
};
}
}
#endif // OOX_LOGIC_RUN_INCLUDE_H_

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,146 @@
/*
* (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 "RunProperty.h"
namespace OOX
{
namespace Logic
{
CRPrChange::CRPrChange()
{
m_pRunPr.Init();
m_pRunPr->m_bRPRChange = true;
}
CRPrChange::CRPrChange(XmlUtils::CXmlNode& oNode)
{
m_pRunPr.Init();
m_pRunPr->m_bRPRChange = true;
fromXML( oNode );
}
CRPrChange::CRPrChange(XmlUtils::CXmlLiteReader& oReader)
{
m_pRunPr.Init();
m_pRunPr->m_bRPRChange = true;
fromXML( oReader );
}
CRPrChange::~CRPrChange()
{
}
void CRPrChange::fromXML(XmlUtils::CXmlNode& oNode)
{
if ( _T("w:rPrChange") != oNode.GetName() )
return;
oNode.ReadAttributeBase( _T("w:author"), m_sAuthor );
oNode.ReadAttributeBase( _T("w:date"), m_oDate );
oNode.ReadAttributeBase( _T("w:id"), m_oID );
XmlUtils::CXmlNode oNode_rPr;
if ( m_pRunPr.IsInit() && oNode.GetNode( _T("w:rPr"), oNode_rPr ) )
m_pRunPr->fromXML( oNode_rPr );
}
void CRPrChange::fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
CWCharWrapper sName = oReader.GetName();
WritingElement *pItem = NULL;
if ( _T("w:rPr") == sName )
m_pRunPr->fromXML( oReader );
}
}
CString CRPrChange::toXML() const
{
CString sResult = _T("<w:rPrChange ");
if ( m_sAuthor.IsInit() )
{
sResult += "w:author=\"";
sResult += m_sAuthor->GetString();
sResult += "\" ";
}
if ( m_oDate.IsInit() )
{
sResult += "w:date=\"";
sResult += m_oDate->ToString();
sResult += "\" ";
}
if ( m_oID.IsInit() )
{
sResult += "w:id=\"";
sResult += m_oID->ToString();
sResult += "\" ";
}
sResult += _T(">");
if ( m_pRunPr.IsInit() )
sResult += m_pRunPr->toXML();
sResult += _T("</w:rPrChange>");
return sResult;
}
EElementType CRPrChange::getType() const
{
return et_w_rPrChange;
}
void CRPrChange::ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("w:author"), m_sAuthor )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:date"), m_oDate )
WritingElement_ReadAttributes_Read_else_if( oReader, _T("w:id"), m_oID )
WritingElement_ReadAttributes_End( oReader )
}
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More