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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,860 @@
/*
* (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 "stdafx.h"
#include "resource.h"
#include "../Common/OfficeFileTemplate.h"
#include "./PPTXFormat/Logic/SpTreeElem.h"
#include "../Common/DocxFormat/Source/Common/SimpleTypes_Base.h"
#include "../ASCPresentationEditor/OfficeDrawing/Shapes/Shape.h"
#include "./PPTXFormat/Logic/Geometry.h"
namespace PPTX
{
class CCSS
{
public:
CAtlMap<CString, CString> m_mapSettings;
CString m_strClassName;
public:
CCSS()
{
Clear();
}
~CCSS()
{
}
AVSINLINE void Clear()
{
m_strClassName = _T("");
m_mapSettings.RemoveAll();
}
public:
void LoadFromString(CString& strParams)
{
Clear();
TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength();
int nPosition = 0;
TCHAR* pDataMem = pData;
while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('\n') == *pDataMem) || (TCHAR('.') == *pDataMem)))
{
++nPosition;
++pDataMem;
}
int nPosNameStart = nPosition;
while ((nPosition < nCount) && (TCHAR(' ') != *pDataMem) && (TCHAR('{') != *pDataMem))
{
++nPosition;
++pDataMem;
}
m_strClassName = strParams.Mid(nPosNameStart, nPosition - nPosNameStart);
while (true)
{
++nPosition;
++pDataMem;
while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('{') == *pDataMem)))
{
++nPosition;
++pDataMem;
}
int nPosOld = nPosition;
while ((nPosition < nCount) && (TCHAR(':') != *pDataMem))
{
++nPosition;
++pDataMem;
}
if (nPosOld == nPosition)
{
break;
}
CString strName = strParams.Mid(nPosOld, nPosition - nPosOld);
++nPosition;
++pDataMem;
while ((nPosition < nCount) && (TCHAR(' ') == *pDataMem))
{
++nPosition;
++pDataMem;
}
nPosOld = nPosition;
while ((nPosition < nCount) && (TCHAR(';') != *pDataMem) && (TCHAR('}') != *pDataMem))
{
++nPosition;
++pDataMem;
}
CString strValue = strParams.Mid(nPosOld, nPosition - nPosOld);
m_mapSettings.SetAt(strName, strValue);
}
}
void LoadFromString2(CString& strParams)
{
Clear();
TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength();
int nPosition = 0;
TCHAR* pDataMem = pData;
m_strClassName = _T("");
while (true)
{
while ((nPosition < nCount) && ((TCHAR(' ') == *pDataMem) || (TCHAR('{') == *pDataMem) || (TCHAR(';') == *pDataMem)))
{
++nPosition;
++pDataMem;
}
int nPosOld = nPosition;
while ((nPosition < nCount) && (TCHAR(':') != *pDataMem))
{
++nPosition;
++pDataMem;
}
if (nPosOld == nPosition)
{
break;
}
CString strName = strParams.Mid(nPosOld, nPosition - nPosOld);
++nPosition;
++pDataMem;
while ((nPosition < nCount) && (TCHAR(' ') == *pDataMem))
{
++nPosition;
++pDataMem;
}
nPosOld = nPosition;
while ((nPosition < nCount) && (TCHAR(';') != *pDataMem) && (TCHAR('}') != *pDataMem))
{
++nPosition;
++pDataMem;
}
CString strValue = strParams.Mid(nPosOld, nPosition - nPosOld);
if (pData[nPosOld] == WCHAR('.'))
strValue = (_T("0") + strValue);
m_mapSettings.SetAt(strName, strValue);
}
}
};
class CStylesCSS
{
public:
CAtlArray<CCSS> m_arStyles;
public:
CStylesCSS() : m_arStyles()
{
}
~CStylesCSS()
{
}
AVSINLINE void Clear()
{
m_arStyles.RemoveAll();
}
public:
void LoadStyles(CString& strParams)
{
Clear();
TCHAR* pData = strParams.GetBuffer();
int nCount = strParams.GetLength();
int nPosition = 0;
int nPositionOld = 0;
TCHAR* pDataMem = pData;
while (nPosition < nCount)
{
if (*pDataMem == TCHAR('}'))
{
CString strTemp = strParams.Mid(nPositionOld, nPosition - nPositionOld + 1);
m_arStyles.Add();
m_arStyles[m_arStyles.GetCount() - 1].LoadFromString(strTemp);
nPositionOld = nPosition + 1;
}
++nPosition;
++pDataMem;
}
}
};
}
[object, uuid("44B693E1-F4F9-4547-ACEF-0AE037C84485"), dual, pointer_default(unique)]
__interface IAVSODObjectProps : IDispatch
{
[id(1)] HRESULT GetProperty([in] LONG lId, [out, retval] VARIANT* pProp);
[id(2)] HRESULT SetProperty([in] LONG lId, [in] VARIANT prop);
[id(1000)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
[id(1001)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
};
[object, uuid("8E0FBC40-9B34-40bf-B68A-0FA320E1B004"), dual, pointer_default(unique)]
__interface IAVSOfficeDrawingConverter : IDispatch
{
[id(1)] HRESULT SetMainDocument([in] IUnknown* pDocument);
[id(2)] HRESULT SetRelsPath([in] BSTR bsRelsPath);
[id(3)] HRESULT SetMediaDstPath([in] BSTR bsMediaPath);
[id(9)] HRESULT AddShapeType([in] BSTR bsXml);
[id(10)] HRESULT AddObject([in] BSTR bsXml, [out] BSTR* pMainProps, [out, satype("BYTE")] SAFEARRAY** ppBinary);
[id(11)] HRESULT SaveObject([in, satype("BYTE")] SAFEARRAY* pBinaryObj, [in] LONG lStart, [in] LONG lLength, [in] BSTR bsMainProps, [out] BSTR* bsXml);
[id(12)] HRESULT SaveObjectEx([in, satype("BYTE")] SAFEARRAY* pBinaryObj, [in] LONG lStart, [in] LONG lLength, [in] BSTR bsMainProps, [in] LONG lDocType, [out] BSTR* bsXml);
[id(13)] HRESULT GetRecordBinary([in] LONG lRecordType, [in] BSTR bsXml, [out, satype("BYTE")] SAFEARRAY** ppBinary);
[id(14)] HRESULT GetRecordXml([in, satype("BYTE")] SAFEARRAY* pBinaryObj, [in] LONG lStart, [in] LONG lLength, [in] LONG lRecType, [in] LONG lDocType, [out] BSTR* bsXml);
[id(20)] HRESULT AddObject2([in] BSTR bsXml, [in, satype("BYTE")] SAFEARRAY* pBinaryObj, [out] BSTR* pXmlOutput);
[id(30)] HRESULT GetThemeBinary([in] BSTR bsThemeFilePath, [out, satype("BYTE")] SAFEARRAY** ppBinary);
[id(31)] HRESULT SaveThemeXml([in, satype("BYTE")] SAFEARRAY* pBinaryTheme, [in] LONG lStart, [in] LONG lLength, [in] BSTR bsThemePath);
[id(40)] HRESULT SetDstContentRels();
[id(41)] HRESULT SaveDstContentRels([in] BSTR bsRelsPath);
[id(42)] HRESULT WriteRels([in] BSTR bsType, [in] BSTR bsTarget, [in] BSTR bsTargetMode, [out] LONG* lId);
[id(50)] HRESULT LoadClrMap([in] BSTR bsXml);
[id(60)] HRESULT GetTxBodyBinary([in] BSTR bsXml, [out, satype("BYTE")] SAFEARRAY** ppBinary);
[id(61)] HRESULT GetTxBodyXml([in, satype("BYTE")] SAFEARRAY* pBinary, [in] LONG lStart, [in] LONG lLength, BSTR* pbstrXml);
[id(62)] HRESULT SetFontDir([in] BSTR bsFontDir);
[id(1000)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
[id(1001)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
};
class CSpTreeElemProps
{
public:
LONG X;
LONG Y;
LONG Width;
LONG Height;
bool IsTop;
public:
CSpTreeElemProps()
{
X = 0;
Y = 0;
Width = 0;
Height = 0;
IsTop = true;
}
};
class CElementProps
{
public:
CAtlMap<LONG, VARIANT> m_Properties;
public:
CElementProps() : m_Properties()
{
}
~CElementProps()
{
FinalRelease();
}
void FinalRelease()
{
POSITION pos = m_Properties.GetStartPosition();
while (pos != NULL)
{
CAtlMap<LONG, VARIANT>::CPair * pPair = m_Properties.GetNext(pos);
if (NULL != pPair)
{
if (pPair->m_value.vt == VT_BSTR)
SysFreeString(pPair->m_value.bstrVal);
}
}
m_Properties.RemoveAll();
}
public:
STDMETHOD(GetProperty)(LONG lId, VARIANT* pProp)
{
if (NULL == pProp)
return S_FALSE;
CAtlMap<LONG, VARIANT>::CPair * pPair = m_Properties.Lookup(lId);
if (NULL == pPair)
return S_FALSE;
bool bIsSupportProp = CopyProperty(*pProp, pPair->m_value);
if (!bIsSupportProp)
{
return S_FALSE;
}
return S_OK;
}
STDMETHOD(SetProperty)(LONG lId, VARIANT prop)
{
VARIANT var;
bool bIsSupportProp = CopyProperty(var, prop);
if (!bIsSupportProp)
return S_FALSE;
CAtlMap<LONG, VARIANT>::CPair* pPair = m_Properties.Lookup(lId);
if (NULL != pPair)
{
if (pPair->m_value.vt == VT_BSTR)
SysFreeString(pPair->m_value.bstrVal);
}
m_Properties.SetAt(lId, var);
return S_OK;
}
public:
static bool CopyProperty(VARIANT& oDst, const VARIANT& oSrc)
{
oDst.vt = oSrc.vt;
switch (oDst.vt)
{
case VT_I4:
{
oDst.lVal = oSrc.lVal;
break;
}
case VT_R8:
{
oDst.dblVal = oSrc.dblVal;
break;
}
case VT_BSTR:
{
oDst.bstrVal = SysAllocString(oSrc.bstrVal);
break;
}
default:
return false;
}
return true;
}
};
[coclass, uuid("4AB04382-4B51-4674-A691-BE2691A5F387"), threading(apartment), vi_progid("AVSOfficePPTXFile.ODObjectProps"), progid("AVSOfficePPTXFile.ODObjectProps.1"), version(1.0), registration_script("control.rgs")]
class ATL_NO_VTABLE CAVSODObjectProps
: public IAVSODObjectProps
{
private:
CElementProps m_oProps;
public:
CAVSODObjectProps() : m_oProps()
{
}
~CAVSODObjectProps()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
m_oProps.FinalRelease();
}
public:
STDMETHOD(GetProperty)(LONG lId, VARIANT* pProp)
{
return m_oProps.GetProperty(lId, pProp);
}
STDMETHOD(SetProperty)(LONG lId, VARIANT prop)
{
return m_oProps.SetProperty(lId, prop);
}
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
{
return S_OK;
}
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
{
return S_OK;
}
};
[coclass, uuid("BA240E3F-CFE4-45d7-96BB-97CDD73F63C3"), event_source(com), threading(apartment), vi_progid("AVSOfficePPTXFile.ODConverter"), progid("AVSOfficePPTXFile.ODConverter.1"), version(1.0), registration_script("control.rgs")]
class ATL_NO_VTABLE CAVSOfficeDrawingConverter
: public IAVSOfficeDrawingConverter
{
public:
class CElement
{
public:
PPTX::WrapperWritingElement* m_pElement;
CElementProps* m_pProps;
public:
CElement()
{
m_pElement = NULL;
m_pProps = NULL;
}
~CElement()
{
RELEASEOBJECT(m_pElement);
RELEASEOBJECT(m_pProps);
}
CElement& operator=(const CElement& oSrc)
{
m_pElement = oSrc.m_pElement;
m_pProps = oSrc.m_pProps;
return *this;
}
CElement(const CElement& oSrc)
{
*this = oSrc;
}
};
CAtlMap<CString, CShape*> m_mapShapeTypes;
CAtlMap<CString, smart_ptr<PPTX::CCommonRels>> m_mapRels;
CString m_strCurrentRelsPath;
NSBinPptxRW::CBinaryFileWriter m_oBinaryWriter;
int m_lNextId;
int m_lCurrentObjectTop;
NSBinPptxRW::CBinaryFileReader m_oReader;
NSBinPptxRW::CImageManager2 m_oImageManager;
NSBinPptxRW::CXmlWriter m_oXmlWriter;
int m_nCurrentIndexObject;
IASCRenderer* m_pOOXToVMLRenderer;
BOOL m_bIsUseConvertion2007;
NSCommon::smart_ptr<PPTX::WrapperFile> m_oTheme;
NSCommon::smart_ptr<PPTX::WrapperWritingElement> m_oClrMap;
CString m_strFontDirectory;
public:
__event __interface _IAVSOfficeFileTemplateEvents2;
CAVSOfficeDrawingConverter()
{
m_nCurrentIndexObject = 0;
m_strFontDirectory = _T("");
}
~CAVSOfficeDrawingConverter()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
m_strCurrentRelsPath = _T("");
m_lNextId = 1;
m_lCurrentObjectTop = 0;
m_pOOXToVMLRenderer = NULL;
m_bIsUseConvertion2007 = TRUE;
return S_OK;
}
void FinalRelease()
{
Clear();
RELEASEINTERFACE(m_pOOXToVMLRenderer);
}
public:
STDMETHOD(SetMainDocument)(IUnknown* pDocument)
{
m_oBinaryWriter.ClearNoAttack();
m_oBinaryWriter.m_oCommon.m_oImageManager.NewDocument();
m_oBinaryWriter.SetMainDocument(pDocument);
m_oReader.SetMainDocument(pDocument);
m_lNextId = 1;
return S_OK;
}
STDMETHOD(SetRelsPath)(BSTR bsRelsPath)
{
m_strCurrentRelsPath = bsRelsPath;
return SetCurrentRelsPath();
}
STDMETHOD(SetMediaDstPath)(BSTR bsMediaPath)
{
m_oBinaryWriter.m_oCommon.m_oImageManager.m_strDstMedia = (CString)bsMediaPath;
m_oImageManager.SetDstMedia(m_oBinaryWriter.m_oCommon.m_oImageManager.m_strDstMedia);
CreateDirectory(bsMediaPath, NULL);
return S_OK;
}
STDMETHOD(AddShapeType)(BSTR bsXml)
{
CString strXml = _T("<main ");
strXml += _T("\
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:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/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\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" \
xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\"");
strXml += _T(">");
strXml += (CString)bsXml;
strXml += _T("</main>");
XmlUtils::CXmlNode oNode;
oNode.FromXmlString(strXml);
if (oNode.IsValid())
{
CPPTShape* pShape = new CPPTShape();
pShape->m_bIsShapeType = true;
XmlUtils::CXmlNode oNodeST = oNode.ReadNodeNoNS(_T("shapetype"));
CString strId = oNodeST.GetAttribute(_T("id"));
pShape->LoadFromXMLShapeType(oNodeST);
CShape* pS = new CShape(NSBaseShape::unknown, 0);
pS->m_pShape = pShape;
LoadCoordSize(oNodeST, pS);
m_mapShapeTypes.SetAt(strId, pS);
}
return S_OK;
}
STDMETHOD(AddObject)(BSTR bsXml, BSTR* pMainProps, SAFEARRAY** ppBinary)
{
CString strXml = _T("<main ");
strXml += _T("\
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:ve=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/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\" \
xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" \
xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" \
xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\" \
xmlns:xdr=\"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing\"");
strXml += _T(">");
strXml += (CString)bsXml;
strXml += _T("</main>");
m_oBinaryWriter.m_oCommon.CheckFontPicker();
++m_lCurrentObjectTop;
bool bResult = ParceObject(strXml, pMainProps, ppBinary);
--m_lCurrentObjectTop;
if (0 == m_lCurrentObjectTop)
{
m_oBinaryWriter.ClearNoAttack();
}
return bResult ? S_OK : S_FALSE;
}
STDMETHOD(AddObject2)(BSTR bsXml, SAFEARRAY* pBinaryObj, BSTR* pXmlOutput)
{
return S_OK;
}
STDMETHOD(GetThemeBinary)(BSTR bsThemeFilePath, SAFEARRAY** ppBinary);
STDMETHOD(SaveThemeXml)(SAFEARRAY* pBinaryTheme, LONG lStart, LONG lLength, BSTR bsThemePath);
STDMETHOD(SaveObject)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, BSTR bsMainProps, BSTR* bsXml);
STDMETHOD(SaveObjectEx)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, BSTR bsMainProps, LONG lDocType, BSTR* bsXml);
STDMETHOD(GetRecordBinary)(LONG lRecordType, BSTR bsXml, SAFEARRAY** ppBinary);
STDMETHOD(GetRecordXml)(SAFEARRAY* pBinaryObj, LONG lStart, LONG lLength, LONG lRecType, LONG lDocType, BSTR* bsXml);
STDMETHOD(SetDstContentRels)()
{
m_oReader.m_oRels.Clear();
m_oReader.m_oRels.StartRels();
return S_OK;
}
STDMETHOD(SaveDstContentRels)(BSTR bsRelsPath)
{
m_oReader.m_oRels.CloseRels();
m_oReader.m_oRels.SaveRels((CString)bsRelsPath);
return S_OK;
}
STDMETHOD(WriteRels)(BSTR bsType, BSTR bsTarget, BSTR bsTargetMode, LONG* lId)
{
if (NULL == lId)
return S_FALSE;
*lId = m_oReader.m_oRels.WriteRels(bsType, bsTarget, bsTargetMode);
return S_OK;
}
STDMETHOD(LoadClrMap)(BSTR bsXml);
STDMETHOD(GetTxBodyBinary)(BSTR bsXml, SAFEARRAY** ppBinary);
STDMETHOD(GetTxBodyXml)(SAFEARRAY* pBinary, LONG lStart, LONG lLength, BSTR *pbstrXml);
STDMETHOD(SetFontDir)(BSTR bsFontDir);
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
{
CString name = (CString)ParamName;
if (name == _T("SourceFileDir"))
{
m_oReader.m_oRels.m_pManager = &m_oImageManager;
m_oImageManager.m_bIsWord = TRUE;
m_oReader.m_strFolder = CString(ParamValue.bstrVal);
}
else if (name == _T("UseConvertion2007"))
{
m_bIsUseConvertion2007 = (ParamValue.boolVal == VARIANT_TRUE) ? true : false;
}
else if (name == _T("SerializeImageManager"))
{
NSBinPptxRW::CBinaryFileReader oReader;
oReader.Deserialize(&m_oBinaryWriter.m_oCommon.m_oImageManager, ParamValue.parray);
}
else if (name == _T("SerializeImageManager2"))
{
NSBinPptxRW::CBinaryFileReader oReader;
oReader.Deserialize(&m_oImageManager, ParamValue.parray);
}
else if (name == _T("FontPicker") && ParamValue.vt == VT_UNKNOWN && NULL != ParamValue.punkVal)
{
IOfficeFontPicker* pFontPicker = NULL;
ParamValue.punkVal->QueryInterface(__uuidof(IOfficeFontPicker), (void**)&pFontPicker);
m_oBinaryWriter.m_oCommon.CreateFontPicker(pFontPicker);
RELEASEINTERFACE(pFontPicker);
}
else if (name == _T("DocumentChartsCount") && ParamValue.vt == VT_I4)
{
m_oReader.m_lChartNumber = ParamValue.lVal + 1;
}
return S_OK;
}
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
{
CString name = (CString)ParamName;
if (name == _T("SerializeImageManager"))
{
NSBinPptxRW::CBinaryFileWriter oWriter;
ParamValue->vt = VT_ARRAY;
ParamValue->parray = oWriter.Serialize(&m_oBinaryWriter.m_oCommon.m_oImageManager);
}
else if (name == _T("SerializeImageManager2"))
{
NSBinPptxRW::CBinaryFileWriter oWriter;
ParamValue->vt = VT_ARRAY;
ParamValue->parray = oWriter.Serialize(&m_oImageManager);
}
else if (name == _T("FontPicker"))
{
ParamValue->vt = VT_UNKNOWN;
ParamValue->punkVal = NULL;
if (NULL != m_oBinaryWriter.m_oCommon.m_pFontPicker)
m_oBinaryWriter.m_oCommon.m_pFontPicker->QueryInterface(IID_IUnknown, (void**)&(ParamValue->punkVal));
}
else if (name == _T("DocumentChartsCount"))
{
ParamValue->vt = VT_I4;
ParamValue->lVal = m_oReader.m_lChartNumber;
}
else if (name == _T("ContentTypes"))
{
ParamValue->vt = VT_BSTR;
ParamValue->bstrVal = m_oReader.m_strContentTypes.AllocSysString();
}
return S_OK;
}
protected:
bool ParceObject(CString& strXml, BSTR* pMainProps, SAFEARRAY** ppBinary);
void SendMainProps(CString& strMainProps, BSTR*& pMainProps);
PPTX::Logic::SpTreeElem doc_LoadShape(XmlUtils::CXmlNode& oNode, BSTR*& pMainProps, bool bIsTop = true);
PPTX::Logic::SpTreeElem doc_LoadGroup(XmlUtils::CXmlNode& oNode, BSTR*& pMainProps, bool bIsTop = true);
CString GetVMLShapeXml(CPPTShape* pPPTShape);
CString GetVMLShapeXml(PPTX::Logic::SpTreeElem& oElem);
void CheckBrushShape(PPTX::Logic::SpTreeElem& oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void CheckPenShape(PPTX::Logic::SpTreeElem& oElem, XmlUtils::CXmlNode& oNode, PPTShapes::ShapeType eType, CPPTShape* pPPTShape);
void LoadCoordSize(XmlUtils::CXmlNode& oNode, CShape* pShape);
CString GetDrawingMainProps(XmlUtils::CXmlNode& oNode, PPTX::CCSS& oCssStyles, CSpTreeElemProps& oProps);
void ConvertMainPropsToVML(BSTR bsMainProps, NSBinPptxRW::CXmlWriter& oWriter, PPTX::Logic::SpTreeElem& oElem);
void ConvertShapeVML(PPTX::Logic::SpTreeElem& oShape, BSTR bsMainProps, NSBinPptxRW::CXmlWriter& oWriter);
void ConvertGroupVML(PPTX::Logic::SpTreeElem& oGroup, BSTR bsMainProps, NSBinPptxRW::CXmlWriter& oWriter);
void Clear()
{
POSITION pos = m_mapShapeTypes.GetStartPosition();
while (NULL != pos)
{
CShape* pMem = m_mapShapeTypes.GetNextValue(pos);
RELEASEOBJECT(pMem);
}
m_mapShapeTypes.RemoveAll();
m_mapRels.RemoveAll();
}
HRESULT SetCurrentRelsPath()
{
CAtlMap<CString, smart_ptr<PPTX::CCommonRels>>::CPair* pPair = m_mapRels.Lookup(m_strCurrentRelsPath);
if (NULL == pPair)
{
smart_ptr<PPTX::CCommonRels> pCR = new PPTX::CCommonRels();
m_mapRels.SetAt(m_strCurrentRelsPath, pCR);
pPair = m_mapRels.Lookup(m_strCurrentRelsPath);
OOX::CPath filename = m_strCurrentRelsPath;
pPair->m_value->_read(filename);
}
m_oBinaryWriter.m_pCommonRels = pPair->m_value.smart_dynamic_cast<PPTX::FileContainer>();
return S_OK;
}
};

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
*
*/
#include "stdafx.h"
#include "resource.h"
#include "ASCOfficePPTXFile.h"
#include "ASCOfficeDrawingConverter.h"
[ module(dll, uuid = "{95DEE027-7707-4078-A314-33D35AE842FD}",
name = "ASCOfficePPTXFile",
helpstring = "ASCOfficePPTXFile 1.0 Type Library",
resource_name = "IDR_ASCOFFICEPPTXFILE") ];

View File

@@ -0,0 +1,511 @@
/*
* (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 "stdafx.h"
#include "resource.h"
#include "../Common/OfficeFileTemplate.h"
#include "PPTXFormat/PPTXEvent.h"
#include "../../../../Common/GdiPlusEx.h"
#include <shellapi.h>
#include <shlobj.h>
#include <shlwapi.h>
#pragma comment( lib, "shell32.lib" )
#include "Editor\PPTXWriter.h"
[object, uuid("ED1EC17E-EE0E-4cae-9E63-1C57235CE286"), dual, pointer_default(unique)]
__interface IAVSOfficePPTXFile : IAVSOfficeFileTemplate
{
[propget, id(4), helpstring("property TempDirectory")] HRESULT TempDirectory([out, retval] BSTR* pVal);
[propput, id(4), helpstring("property TempDirectory")] HRESULT TempDirectory([in] BSTR newVal);
[id(5), helpstring("method GetDVDXml")] HRESULT GetDVDXml([out,retval] BSTR* pbstrPTTXml);
[id(6), helpstring("method GetBluRayXml")] HRESULT GetBluRayXml([out,retval] BSTR* pbstrDVDXml);
[propget, id(7), helpstring("property DrawingXml")] HRESULT DrawingXml([out, retval] BSTR* pVal);
[id(2000 + 0)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
[id(2001 + 1)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
};
[object, uuid("4F4EA472-EC78-495c-B627-5798EA364468"), dual, pointer_default(unique)]
__interface IAVSOfficePPTXFile2 : IDispatch
{
[id(10000 + 0)] HRESULT OpenFileToPPTY([in] BSTR bsInputDir, [in] BSTR bsFileDst);
[id(10000 + 1)] HRESULT OpenDirectoryToPPTY([in] BSTR bsInputDir, [in] BSTR bsFileDst);
[id(10000 + 2)] HRESULT SetMediaDir([in] BSTR bsMediaDir);
[id(10000 + 3)] HRESULT SetFontDir([in] BSTR bsFontDir);
[id(10000 + 4)] HRESULT SetUseSystemFonts([in] VARIANT_BOOL useSystemFonts);
[id(10000 + 5)] HRESULT ConvertPPTYToPPTX([in] BSTR bsInputFile, [in] BSTR bsFileDst);
[id(10000 + 6)] HRESULT SetThemesDir([in] BSTR bsThemesPath);
};
[coclass, uuid("5731F488-94FF-44b7-8A3E-54CBB746F5B1"), event_source(com), threading(apartment), vi_progid("AVSOfficePPTXFile.OfficePPTXFile"), progid("AVSOfficePPTXFile.OfficePPTXFile.1"), version(1.0), registration_script("control.rgs")]
class ATL_NO_VTABLE CAVSOfficePPTXFile
: public IAVSOfficePPTXFile
, public IAVSOfficePPTXFile2
, public PPTX::IPPTXEvent
{
private:
OfficeUtils::IOfficeUtils* m_pOfficeUtils;
PPTX::Folder* m_pFolder;
CStringW m_strTempDir;
CString m_strDirectory;
CString m_strFontDirectory;
CString m_strMediaDirectory;
BOOL m_bIsUseSystemFonts;
CString m_strEmbeddedFontsDirectory;
CString m_strFolderThemes;
CGdiPlusInit m_oInit;
public:
__event __interface _IAVSOfficeFileTemplateEvents2;
CAVSOfficePPTXFile()
{
WCHAR buffer[4096];
GetTempPathW(4096, buffer);
m_strTempDir = CStringW(buffer);
GetLongPathNameW(m_strTempDir.GetString(), buffer, 4096);
m_strTempDir = CStringW(buffer) + CStringW("_PPTX\\");
m_strFontDirectory = _T("");
m_strMediaDirectory = _T("");
m_bIsUseSystemFonts = FALSE;
m_strEmbeddedFontsDirectory = _T("");
m_strFolderThemes = _T("");
}
~CAVSOfficePPTXFile()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
m_pFolder = NULL;
m_pOfficeUtils = NULL;
if (S_OK != CoCreateInstance(__uuidof(OfficeUtils::COfficeUtils), NULL, CLSCTX_INPROC_SERVER, __uuidof(OfficeUtils::IOfficeUtils),(void**)&m_pOfficeUtils))
return S_FALSE;
m_oInit.Init();
return S_OK;
}
void FinalRelease()
{
RELEASEINTERFACE(m_pOfficeUtils);
RELEASEOBJECT(m_pFolder);
}
public:
HRESULT LoadFromFile(BSTR sSrcFileName, BSTR sDstPath, BSTR sXMLOptions)
{
CStringW localTempDir(sDstPath);
if((sDstPath != NULL) || (localTempDir != ""))
{
int res = SHCreateDirectoryExW(NULL, localTempDir.GetString(), NULL);
if((res != ERROR_SUCCESS) && (res != ERROR_ALREADY_EXISTS) && (res != ERROR_FILE_EXISTS))
return S_FALSE;
put_TempDirectory(sDstPath);
}
else
{
int res = SHCreateDirectoryExW(NULL, m_strTempDir, NULL);
if((res != ERROR_SUCCESS) && (res != ERROR_ALREADY_EXISTS) && (res != ERROR_FILE_EXISTS))
return S_FALSE;
}
localTempDir = m_strTempDir;
if(m_pOfficeUtils == NULL)
return S_FALSE;
BSTR bsParam = localTempDir.AllocSysString();
HRESULT hr = m_pOfficeUtils->ExtractToDirectory( sSrcFileName, bsParam, NULL, 0);
SysFreeString(bsParam);
if(hr != S_OK)
return hr;
RELEASEOBJECT(m_pFolder);
m_pFolder = new PPTX::Folder();
if(!m_pFolder->isValid(localTempDir))
{
RELEASEOBJECT(m_pFolder);
return S_FALSE;
}
m_pFolder->read(localTempDir, (PPTX::IPPTXEvent*)this);
if(GetPercent() < 1000000)
{
RELEASEOBJECT(m_pFolder);
return S_FALSE;
}
smart_ptr<PPTX::Presentation> presentation = m_pFolder->get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
if (!presentation.is_init())
{
RemoveDirOrFile(m_strTempDir, false);
return S_FALSE;
}
m_strDirectory = (CString)sSrcFileName;
int nIndex = m_strDirectory.ReverseFind(TCHAR('\\'));
if (-1 != nIndex)
m_strDirectory = m_strDirectory.Mid(0, nIndex);
return S_OK;
}
public:
HRESULT SaveToFile(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
{
if (NULL == m_pFolder)
return S_FALSE;
OOX::CPath oPath;
oPath.m_strFilename = CString(sSrcPath);
m_pFolder->write(oPath);
return m_pOfficeUtils->CompressFileOrDirectory( sSrcPath, sDstFileName, -1 );
}
public:
STDMETHOD(get_TempDirectory)(BSTR* pVal)
{
*pVal = m_strTempDir.AllocSysString();
return S_OK;
}
STDMETHOD(put_TempDirectory)(BSTR newVal)
{
CStringW TempStr(newVal);
if(PathIsDirectoryW(TempStr.GetString()))
{
if(TempStr.Right(1) != L"\\")
TempStr += L"\\";
m_strTempDir = TempStr;
return S_OK;
}
return S_FALSE;
}
public:
STDMETHOD(GetDVDXml)(BSTR* pbstrPTTXml)
{
return S_OK;
}
STDMETHOD(GetBluRayXml)(BSTR* pbstrDVDXml)
{
return S_OK;
}
public:
STDMETHOD(get_DrawingXml)(BSTR* pVal)
{
if ((NULL == m_pFolder) || (NULL == pVal))
return S_FALSE;
return S_OK;
}
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
{
CString sParamName; sParamName = ParamName;
if (_T("EmbeddedFontsDirectory") == sParamName && ParamValue.vt == VT_BSTR)
{
m_strEmbeddedFontsDirectory = ParamValue.bstrVal;
return S_OK;
}
return S_OK;
}
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
{
if (NULL == ParamValue)
return S_FALSE;
return S_OK;
}
virtual bool Progress(long ID, long Percent)
{
SHORT res = 0;
percent = Percent;
OnProgressEx(ID, Percent, &res);
return (res != 0);
}
STDMETHOD(SetMediaDir)(BSTR bsMediaDir)
{
m_strMediaDirectory = bsMediaDir;
return S_OK;
}
STDMETHOD(SetFontDir)(BSTR bsFontDir)
{
m_strFontDirectory = bsFontDir;
return S_OK;
}
STDMETHOD(SetThemesDir)(BSTR bsDir)
{
m_strFolderThemes = bsDir;
return S_OK;
}
STDMETHOD(SetUseSystemFonts)(VARIANT_BOOL useSystemFonts)
{
m_bIsUseSystemFonts = (VARIANT_TRUE == useSystemFonts);
return S_OK;
}
STDMETHOD(OpenFileToPPTY)(BSTR bsInput, BSTR bsOutput)
{
int res = SHCreateDirectoryExW(NULL, m_strTempDir, NULL);
if((res != ERROR_SUCCESS) && (res != ERROR_ALREADY_EXISTS) && (res != ERROR_FILE_EXISTS))
return S_FALSE;
if (m_pOfficeUtils == NULL)
return S_FALSE;
BSTR localTempDir = m_strTempDir.AllocSysString();
HRESULT hr = m_pOfficeUtils->ExtractToDirectory(bsInput, localTempDir, NULL, 0);
if(hr != S_OK)
return hr;
SysFreeString(localTempDir);
RELEASEOBJECT(m_pFolder);
m_pFolder = new PPTX::Folder();
if (!m_pFolder->isValid(m_strTempDir))
{
RELEASEOBJECT(m_pFolder);
return S_FALSE;
}
m_pFolder->read(m_strTempDir, (PPTX::IPPTXEvent*)this);
if(GetPercent() < 1000000)
{
RELEASEOBJECT(m_pFolder);
return S_FALSE;
}
smart_ptr<PPTX::Presentation> presentation = m_pFolder->get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
if (!presentation.is_init())
{
RemoveDirOrFile(m_strTempDir, false);
return S_FALSE;
}
m_strDirectory = (CString)bsInput;
int nIndex = m_strDirectory.ReverseFind(TCHAR('\\'));
if (-1 != nIndex)
m_strDirectory = m_strDirectory.Mid(0, nIndex);
NSBinPptxRW::CBinaryFileWriter oBinaryWriter;
oBinaryWriter.m_oCommon.CheckFontPicker();
oBinaryWriter.m_oCommon.m_pNativePicker->Init(m_strFontDirectory);
CString sDstFileOutput = bsOutput;
m_strMediaDirectory = sDstFileOutput;
nIndex = m_strMediaDirectory.ReverseFind(TCHAR('\\'));
if (-1 != nIndex)
m_strMediaDirectory = m_strMediaDirectory.Mid(0, nIndex);
oBinaryWriter.m_strMainFolder = m_strMediaDirectory;
m_strMediaDirectory = m_strMediaDirectory + _T("\\media");
oBinaryWriter.m_oCommon.m_oImageManager.m_strDstMedia = m_strMediaDirectory;
CDirectory::CreateDirectory(m_strMediaDirectory);
if (_T("") != m_strEmbeddedFontsDirectory)
{
CDirectory::CreateDirectory(m_strEmbeddedFontsDirectory);
if (NULL != oBinaryWriter.m_oCommon.m_pFontPicker)
{
oBinaryWriter.m_oCommon.m_pNativePicker->m_bIsEmbeddedFonts = TRUE;
oBinaryWriter.m_oCommon.m_pNativePicker->m_oEmbeddedFonts.m_strEmbeddedFontsFolder = m_strEmbeddedFontsDirectory;
}
}
PPTX2EditorAdvanced::Convert(oBinaryWriter, *m_pFolder, m_strDirectory, sDstFileOutput);
return S_OK;
}
STDMETHOD(OpenDirectoryToPPTY)(BSTR bsInput, BSTR bsOutput)
{
RELEASEOBJECT(m_pFolder);
m_pFolder = new PPTX::Folder();
if (!m_pFolder->isValid((CString)bsInput))
{
RELEASEOBJECT(m_pFolder);
return S_FALSE;
}
m_pFolder->read((CString)bsInput, (PPTX::IPPTXEvent*)this);
if(GetPercent() < 1000000)
{
RELEASEOBJECT(m_pFolder);
return S_FALSE;
}
smart_ptr<PPTX::Presentation> presentation = m_pFolder->get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
if (!presentation.is_init())
{
RemoveDirOrFile(m_strTempDir, false);
return S_FALSE;
}
m_strDirectory = (CString)bsInput;
int nIndex = m_strDirectory.ReverseFind(TCHAR('\\'));
if (-1 != nIndex)
m_strDirectory = m_strDirectory.Mid(0, nIndex);
NSBinPptxRW::CBinaryFileWriter oBinaryWriter;
oBinaryWriter.m_oCommon.CheckFontPicker();
oBinaryWriter.m_oCommon.m_pNativePicker->Init(m_strFontDirectory);
CString sDstFileOutput = (CString)bsOutput;
m_strMediaDirectory = sDstFileOutput;
nIndex = m_strMediaDirectory.ReverseFind(TCHAR('\\'));
if (-1 != nIndex)
m_strMediaDirectory = m_strMediaDirectory.Mid(0, nIndex);
oBinaryWriter.m_strMainFolder = m_strMediaDirectory;
m_strMediaDirectory = m_strMediaDirectory + _T("\\media");
oBinaryWriter.m_oCommon.m_oImageManager.m_strDstMedia = m_strMediaDirectory;
CDirectory::CreateDirectory(m_strMediaDirectory);
PPTX2EditorAdvanced::Convert(oBinaryWriter, *m_pFolder, m_strDirectory, sDstFileOutput);
return S_OK;
}
STDMETHOD(ConvertPPTYToPPTX)(BSTR bsInput, BSTR bsOutput)
{
#ifdef _DEBUG
m_strTempDir = _T("C:\\PPTMemory\\PPTX_test");
#endif
int len = m_strTempDir.GetLength();
while (len != 0 && m_strTempDir[len - 1] == (TCHAR)'\\')
{
m_strTempDir.Delete(len - 1);
--len;
}
NSBinPptxRW::CPPTXWriter oWriter;
oWriter.Init(m_strTempDir);
CFile oFileBinary;
oFileBinary.OpenFile((CString)bsInput);
LONG lFileSize = (LONG)oFileBinary.GetFileSize();
BYTE* pSrcBuffer = new BYTE[lFileSize];
oFileBinary.ReadFile(pSrcBuffer, (DWORD)lFileSize);
oFileBinary.CloseFile();
CString srcFolder = CDirectory::GetFolderPath((CString)bsInput);
oWriter.OpenPPTY(pSrcBuffer, lFileSize, srcFolder, m_strFolderThemes);
RELEASEARRAYOBJECTS(pSrcBuffer);
BSTR bsInput2 = m_strTempDir.AllocSysString();
HRESULT hRes = m_pOfficeUtils->CompressFileOrDirectory(bsInput2, bsOutput, -1 );
SysFreeString(bsInput2);
RemoveDirOrFile(m_strTempDir);
return hRes;
}
private:
INT32 RemoveDirOrFile(CString sPath, bool bIsRemoveHead = true)
{
DWORD dwFileAttrib = ::GetFileAttributes( sPath );
if( dwFileAttrib != INVALID_FILE_ATTRIBUTES )
{
DWORD dwResult = 0;
if( 0 != (FILE_ATTRIBUTE_DIRECTORY & dwFileAttrib) )
{
HANDLE Handle;
WIN32_FIND_DATA FindData;
DWORDLONG Result = 0;
Handle = FindFirstFile( ( sPath + _T("\\*.*") ), &FindData );
if ( Handle == INVALID_HANDLE_VALUE )
return 0;
do
{
BOOL bRes = TRUE;
if( ( CString( FindData.cFileName ) != _T(".") ) && ( CString( FindData.cFileName ) != _T("..") ) )
if( FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY )
Result += RemoveDirOrFile( sPath + _T("\\") + FindData.cFileName );
else
bRes = DeleteFile( sPath + _T("\\") + FindData.cFileName );
if( FALSE == bRes )
dwResult += 1;
}
while( FindNextFile( Handle, &FindData ) != 0 );
FindClose( Handle );
if (bIsRemoveHead)
{
BOOL bRes = RemoveDirectory( sPath );
if( FALSE == bRes )
dwResult += 1;
}
}
else
{
if( FALSE == DeleteFile( sPath ) )
dwResult = 1;
}
return dwResult;
}
return 0;
}
};

View File

@@ -0,0 +1,148 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource.h"
#define COMPONENT_NAME "OfficePPTXFile"
#include "../Common/FileInfo.h"
#include "version.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "winres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// Russian resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS)
#ifdef _WIN32
LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT
#pragma code_page(1251)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
IDB_XML_NOTESTHEME PPTXW "Editor\\ResourceFiles\\notesTheme.xml"
IDB_XML_NOTESMASTER PPTXW "Editor\\ResourceFiles\\notesMaster.xml"
/////////////////////////////////////////////////////////////////////////////
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
#endif // Russian resources
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""winres.h""\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION INTVER
PRODUCTVERSION INTVER
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", COMPANY_NAME
VALUE "FileDescription", FILE_DESCRIPTION_ACTIVEX
VALUE "FileVersion", STRVER
VALUE "InternalName", COMPONENT_FILE_NAME_DLL
VALUE "LegalCopyright", LEGAL_COPYRIGHT
VALUE "OriginalFilename", COMPONENT_FILE_NAME_DLL
VALUE "ProductName", FILE_DESCRIPTION_ACTIVEX
VALUE "ProductVersion", STRVER
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
/////////////////////////////////////////////////////////////////////////////
//
// REGISTRY
//
IDR_ASCOFFICEPPTXFILE REGISTRY "ASCOfficePPTXFile.rgs"
/////////////////////////////////////////////////////////////////////////////
//
// String Table
//
STRINGTABLE
BEGIN
IDS_PROJNAME "ASCOfficePPTXFile"
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@@ -0,0 +1,11 @@
HKCR
{
NoRemove AppID
{
'%APPID%' = s 'ASCOfficePPTXFile'
'ASCOfficePPTXFile.DLL'
{
val AppID = s '%APPID%'
}
}
}

View File

@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual C++ Express 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ASCOfficePPTXFile", "ASCOfficePPTXFile.vcproj", "{70078FE7-BE4F-493C-84F3-F98F151587F5}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
ReleaseASC|Win32 = ReleaseASC|Win32
ReleaseOpenSource|Win32 = ReleaseOpenSource|Win32
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{70078FE7-BE4F-493C-84F3-F98F151587F5}.Debug|Win32.ActiveCfg = Debug|Win32
{70078FE7-BE4F-493C-84F3-F98F151587F5}.Debug|Win32.Build.0 = Debug|Win32
{70078FE7-BE4F-493C-84F3-F98F151587F5}.Release|Win32.ActiveCfg = Release|Win32
{70078FE7-BE4F-493C-84F3-F98F151587F5}.Release|Win32.Build.0 = Release|Win32
{70078FE7-BE4F-493C-84F3-F98F151587F5}.ReleaseASC|Win32.ActiveCfg = ReleaseASC|Win32
{70078FE7-BE4F-493C-84F3-F98F151587F5}.ReleaseASC|Win32.Build.0 = ReleaseASC|Win32
{70078FE7-BE4F-493C-84F3-F98F151587F5}.ReleaseOpenSource|Win32.ActiveCfg = ReleaseOpenSource|Win32
{70078FE7-BE4F-493C-84F3-F98F151587F5}.ReleaseOpenSource|Win32.Build.0 = ReleaseOpenSource|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

File diff suppressed because it is too large Load Diff

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 "stdafx.h"
#include "Directory.h"
#include <strsafe.h>
namespace FileSystem {
LPCTSTR Directory::GetCurrentDirectory() {
static const int bufferSize = MAX_PATH;
LPTSTR directory = new TCHAR[bufferSize];
DWORD lenght = ::GetCurrentDirectory(bufferSize, directory);
if (lenght == 0) {
delete[] directory;
directory = NULL;
}
return directory;
}
String Directory::GetCurrentDirectoryS() {
LPCTSTR directory = GetCurrentDirectory();
if (directory == NULL)
return String();
return String(directory);
}
bool Directory::CreateDirectory(LPCTSTR path) {
bool directoryCreated = false;
if (::CreateDirectory(path, NULL) == TRUE)
directoryCreated = true;
return directoryCreated;
}
bool Directory::CreateDirectory(const String& path) {
return CreateDirectory(path.c_str());
}
bool Directory::CreateDirectories(LPCTSTR path)
{
int codeResult = ERROR_SUCCESS;
codeResult = ::CreateDirectory (path, NULL);
bool created = false;
if (codeResult == ERROR_SUCCESS)
created = true;
return created;
}
StringArray Directory::GetFilesInDirectory(LPCTSTR path, const bool& andSubdirectories) {
size_t pathLength = 0;
StringCchLength(path, MAX_PATH, &pathLength);
++pathLength;
size_t pathToFilesLength = pathLength + 3;
LPTSTR pathToFiles = new TCHAR[pathToFilesLength];
StringCchCopy(pathToFiles, pathLength, path);
StringCchCat(pathToFiles, pathToFilesLength, TEXT("\\*"));
WIN32_FIND_DATA findData;
HANDLE findResult = FindFirstFile(pathToFiles, &findData);
delete[] pathToFiles;
if (findResult == INVALID_HANDLE_VALUE)
return StringArray();
StringArray files;
do {
if (andSubdirectories || !(findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
String file = findData.cFileName;
files.insert(files.end(), file);
}
} while (FindNextFile(findResult, &findData));
FindClose(findResult);
return files;
}
StringArray Directory::GetFilesInDirectory(const String& path, const bool& andSubdirectories) {
LPCTSTR pathW = path.c_str();
return GetFilesInDirectory(pathW, andSubdirectories);
}
int Directory::GetFilesCount(const CString& path, const bool& recursive) {
CString pathMask = path + _T("\\*");
WIN32_FIND_DATA findData;
HANDLE findResult = FindFirstFile(pathMask, &findData);
int filesCount = 0;
do {
if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
if (!recursive)
continue;
if ((CString) findData.cFileName == _T("."))
continue;
if ((CString) findData.cFileName == _T(".."))
continue;
CString innerPath = path + _T('\\') + (CString) findData.cFileName;
filesCount += GetFilesCount(innerPath, recursive);
}
else
++filesCount;
} while (FindNextFile(findResult, &findData));
FindClose(findResult);
return filesCount;
}
}

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
#include "Settings.h"
#include <windows.h>
namespace FileSystem {
class Directory {
public:
static LPCTSTR GetCurrentDirectory();
static String GetCurrentDirectoryS();
static bool CreateDirectory(LPCTSTR path);
static bool CreateDirectory(const String& path);
static bool CreateDirectories(LPCTSTR path);
static StringArray GetFilesInDirectory(LPCTSTR path, const bool& andSubdirectories = false);
static StringArray GetFilesInDirectory(const String& path, const bool& andSubdirectories = false);
static int GetFilesCount(const CString& path, const bool& recursive = false);
};
}

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
namespace NSBinPptxRW
{
const double eps = 0.001;
const double g_dKoef_mm_to_pt = 72 / (2.54 * 10);
const double g_dKoef_mm_to_twips = 20 * g_dKoef_mm_to_pt;
const double g_dKoef_mm_to_emu = 36000;
const double g_dKoef_mm_to_eightpoint = 8 * g_dKoef_mm_to_pt;
const BYTE g_nodeAttributeStart = 0xFA;
const BYTE g_nodeAttributeEnd = 0xFB;
namespace NSSerFormat
{
enum SerFormat
{
Version = 0,
Signature = 0x50505459
};
}
namespace NSMainTables
{
enum MainTables
{
Main = 255,
App = 1,
Core = 2,
Presentation = 3,
ViewProps = 4,
VmlDrawing = 5,
TableStyles = 6,
Themes = 20,
ThemeOverride = 21,
SlideMasters = 22,
SlideLayouts = 23,
Slides = 24,
NotesMasters = 25,
NotesSlides = 26,
HandoutMasters = 30,
SlideRels = 40,
ThemeRels = 41,
ImageMap = 42,
FontMap = 43,
FontsEmbedded = 44
};
}
}
#define COLOR_TYPE_NONE 0
#define COLOR_TYPE_SRGB 1
#define COLOR_TYPE_PRST 2
#define COLOR_TYPE_SCHEME 3
#define COLOR_TYPE_SYS 4
#define FILL_TYPE_NONE 0
#define FILL_TYPE_BLIP 1
#define FILL_TYPE_NOFILL 2
#define FILL_TYPE_SOLID 3
#define FILL_TYPE_GRAD 4
#define FILL_TYPE_PATT 5
#define EFFECT_TYPE_NONE 0
#define EFFECT_TYPE_OUTERSHDW 1
#define EFFECT_TYPE_GLOW 2
#define EFFECT_TYPE_DUOTONE 3
#define EFFECT_TYPE_XFRM 4
#define EFFECT_TYPE_BLUR 5
#define EFFECT_TYPE_PRSTSHDW 6
#define EFFECT_TYPE_INNERSHDW 7
#define EFFECT_TYPE_REFLECTION 8
#define EFFECT_TYPE_SOFTEDGE 9
#define EFFECT_TYPE_FILLOVERLAY 10
#define EFFECT_TYPE_ALPHACEILING 11
#define EFFECT_TYPE_ALPHAFLOOR 12
#define EFFECT_TYPE_TINTEFFECT 13
#define EFFECT_TYPE_RELOFF 14
#define EFFECT_TYPE_LUM 15
#define EFFECT_TYPE_HSL 16
#define EFFECT_TYPE_GRAYSCL 17
#define EFFECT_TYPE_ELEMENT 18
#define EFFECT_TYPE_ALPHAREPL 19
#define EFFECT_TYPE_ALPHAOUTSET 20
#define EFFECT_TYPE_ALPHAMODFIX 21
#define EFFECT_TYPE_ALPHABILEVEL 22
#define EFFECT_TYPE_BILEVEL 23
#define EFFECT_TYPE_DAG 24
#define EFFECT_TYPE_FILL 25
#define EFFECT_TYPE_CLRREPL 26
#define EFFECT_TYPE_CLRCHANGE 27
#define EFFECT_TYPE_ALPHAINV 28
#define EFFECT_TYPE_ALPHAMOD 29
#define EFFECT_TYPE_BLEND 30
#define GEOMETRY_TYPE_NONE 0
#define GEOMETRY_TYPE_PRST 1
#define GEOMETRY_TYPE_CUSTOM 2
#define GEOMETRY_TYPE_AH_NONE 0
#define GEOMETRY_TYPE_AH_POLAR 1
#define GEOMETRY_TYPE_AH_XY 2
#define GEOMETRY_TYPE_PATH_NONE 0
#define GEOMETRY_TYPE_PATH_MOVETO 1
#define GEOMETRY_TYPE_PATH_LINETO 2
#define GEOMETRY_TYPE_PATH_CLOZE 3
#define GEOMETRY_TYPE_PATH_CUBICBEZTO 4
#define GEOMETRY_TYPE_PATH_ARCTO 5
#define GEOMETRY_TYPE_PATH_QUADBEZTO 6
#define EFFECTPROPERTIES_TYPE_NONE 0
#define EFFECTPROPERTIES_TYPE_LIST 1
#define EFFECTPROPERTIES_TYPE_DAG EFFECT_TYPE_DAG
#define BULLET_TYPE_COLOR_NONE 0
#define BULLET_TYPE_COLOR_CLRTX 1
#define BULLET_TYPE_COLOR_CLR 2
#define BULLET_TYPE_SIZE_NONE 0
#define BULLET_TYPE_SIZE_TX 1
#define BULLET_TYPE_SIZE_PCT 2
#define BULLET_TYPE_SIZE_PTS 3
#define BULLET_TYPE_TYPEFACE_NONE 0
#define BULLET_TYPE_TYPEFACE_TX 1
#define BULLET_TYPE_TYPEFACE_BUFONT 2
#define BULLET_TYPE_BULLET_NONE 0
#define BULLET_TYPE_BULLET_CHAR 1
#define BULLET_TYPE_BULLET_AUTONUM 2
#define BULLET_TYPE_BULLET_BLIP 3
#define PARRUN_TYPE_NONE 0
#define PARRUN_TYPE_RUN 1
#define PARRUN_TYPE_FLD 2
#define PARRUN_TYPE_BR 3
#define SPTREE_TYPE_NONE 0
#define SPTREE_TYPE_SHAPE 1
#define SPTREE_TYPE_PIC 2
#define SPTREE_TYPE_CXNSP 3
#define SPTREE_TYPE_SPTREE 4
#define SPTREE_TYPE_GRFRAME 5
static BYTE SchemeClr_GetBYTECode(const CString& sValue)
{
if (_T("accent1") == sValue)
return 0;
if (_T("accent2") == sValue)
return 1;
if (_T("accent3") == sValue)
return 2;
if (_T("accent4") == sValue)
return 3;
if (_T("accent5") == sValue)
return 4;
if (_T("accent6") == sValue)
return 5;
if (_T("bg1") == sValue)
return 6;
if (_T("bg2") == sValue)
return 7;
if (_T("dk1") == sValue)
return 8;
if (_T("dk2") == sValue)
return 9;
if (_T("folHlink") == sValue)
return 10;
if (_T("hlink") == sValue)
return 11;
if (_T("lt1") == sValue)
return 12;
if (_T("lt2") == sValue)
return 13;
if (_T("phClr") == sValue)
return 14;
if (_T("tx1") == sValue)
return 15;
if (_T("tx2") == sValue)
return 16;
return 0;
}
static CString SchemeClr_GetStringCode(const BYTE& val)
{
switch (val)
{
case 0:
return _T("accent1");
case 1:
return _T("accent2");
case 2:
return _T("accent3");
case 3:
return _T("accent4");
case 4:
return _T("accent5");
case 5:
return _T("accent6");
case 6:
return _T("bg1");
case 7:
return _T("bg2");
case 8:
return _T("dk1");
case 9:
return _T("dk2");
case 10:
return _T("folHlink");
case 11:
return _T("hlink");
case 12:
return _T("lt1");
case 13:
return _T("lt2");
case 14:
return _T("phClr");
case 15:
return _T("tx1");
case 16:
return _T("tx2");
}
return _T("accent1");
}
#define XMLWRITER_DOC_TYPE_PPTX 0
#define XMLWRITER_DOC_TYPE_DOCX 1
#define XMLWRITER_DOC_TYPE_XLSX 2
#define XMLWRITER_DOC_TYPE_CHART 3
#define XMLWRITER_RECORD_TYPE_SPPR 0

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,118 @@
/*
* (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
const long g_clFilePartSize = 20*1024;
class CCalculatorCRC32
{
public:
CCalculatorCRC32()
{
m_dwMagicWord = 0xEDB88320;
m_dwInitCrc = 0xFFFFFFFF;
m_bInitTable = FALSE;
}
public:
DWORD Calc(BYTE const*pStream, int nSize)
{
InitCRCTable();
DWORD dwRes = m_dwInitCrc;
for (int i=0;i<nSize;i++)
{
dwRes = m_arCRCTable[(dwRes ^ pStream[i])& 0xFF] ^ (dwRes >> 8);
}
dwRes = dwRes ^ 0xFFFFFFFF;
return dwRes;
}
DWORD Calc(const CString &sStream)
{
InitCRCTable();
DWORD dwRes = m_dwInitCrc;
int nSize = sStream.GetLength();
for (int i=0;i<nSize;i++)
{
dwRes = m_arCRCTable[(dwRes ^ (BYTE)sStream[i]) & 0xFF] ^ (dwRes >> 8);
}
dwRes = dwRes ^ 0xFFFFFFFF;
return dwRes;
}
DWORD CalcPartFile(const CString &sFilepath)
{
DWORD dwRet = 0xFFFFFFFF;
return dwRet;
}
private:
void InitCRCTable()
{
if (m_bInitTable)
return;
DWORD dwTemp;
for (int i=0;i<256;i++)
{
dwTemp = i;
for (int j=0;j<8;j++)
{
if (0x1==(dwTemp & 0x1))
dwTemp = (dwTemp >> 1) ^ m_dwMagicWord;
else
dwTemp = dwTemp >> 1;
}
m_arCRCTable[i] = dwTemp;
}
}
DWORD m_dwMagicWord;
DWORD m_dwInitCrc;
DWORD m_arCRCTable[255];
BOOL m_bInitTable;
};

View File

@@ -0,0 +1,426 @@
/*
* (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 "../stdafx.h"
#include "../PPTXFormat/PPTX.h"
#include "BinWriters.h"
namespace PPTX2EditorAdvanced
{
using namespace NSBinPptxRW;
DWORD Convert(NSBinPptxRW::CBinaryFileWriter& oBinaryWriter, PPTX::Folder& oFolder, const CString& strSourceDirectory, const CString& strDstFile)
{
NSBinPptxRW::CCommonWriter* pCommon = &oBinaryWriter.m_oCommon;
CAtlArray<smart_ptr<PPTX::Theme>> _themes;
CAtlArray<smart_ptr<PPTX::SlideMaster>> _slideMasters;
CAtlArray<smart_ptr<PPTX::Slide>> _slides;
CAtlArray<smart_ptr<PPTX::SlideLayout>> _layouts;
CAtlArray<smart_ptr<PPTX::NotesSlide>> _notes;
CAtlArray<smart_ptr<PPTX::NotesMaster>> _notesMasters;
smart_ptr<PPTX::Presentation> presentation = oFolder.get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
int cx = presentation->sldSz->cx;
int cy = presentation->sldSz->cy;
size_t nCountMasters = presentation->sldMasterIdLst.GetCount();
for (size_t nMaster = 0; nMaster < nCountMasters; ++nMaster)
{
smart_ptr<PPTX::SlideMaster> slideMaster = ((*presentation)[presentation->sldMasterIdLst[nMaster].rid.get()]).smart_dynamic_cast<PPTX::SlideMaster>();
size_t pPointerSM = (size_t)(slideMaster.operator ->());
CAtlMap<size_t, LONG>::CPair* pSearchSM = pCommon->slideMasters.Lookup(pPointerSM);
if (NULL != pSearchSM)
{
continue;
}
oBinaryWriter.m_oCommon.m_oRels.Add();
CMasterSlideInfo& oMasterInfo = oBinaryWriter.m_oCommon.m_oRels[oBinaryWriter.m_oCommon.m_oRels.GetCount() - 1];
LONG lCountSM = (LONG)_slideMasters.GetCount();
pCommon->slideMasters.SetAt(pPointerSM, lCountSM);
_slideMasters.Add(slideMaster);
size_t pPointerTh = (size_t)(slideMaster->Theme.operator ->());
CAtlMap<size_t, LONG>::CPair* pSearchTh = pCommon->themes.Lookup(pPointerTh);
if (NULL == pSearchTh)
{
LONG lCountTh = (LONG)_themes.GetCount();
pCommon->themes.SetAt(pPointerTh, lCountTh);
_themes.Add(slideMaster->Theme);
oMasterInfo.m_lThemeIndex = lCountTh;
}
else
{
oMasterInfo.m_lThemeIndex = pSearchTh->m_value;
}
size_t nCountLayouts = slideMaster->sldLayoutIdLst.GetCount();
for (size_t iLayout = 0; iLayout < nCountLayouts; ++iLayout)
{
smart_ptr<PPTX::SlideLayout> slideLayout = ((*slideMaster)[slideMaster->sldLayoutIdLst[iLayout].rid.get()]).smart_dynamic_cast<PPTX::SlideLayout>();
size_t pPointerL = (size_t)(slideLayout.operator ->());
CAtlMap<size_t, LONG>::CPair* pSearchL = pCommon->layouts.Lookup(pPointerL);
if (NULL == pSearchL)
{
LONG lCountL = (LONG)_layouts.GetCount();
pCommon->layouts.SetAt(pPointerL, lCountL);
_layouts.Add(slideLayout);
oMasterInfo.m_arLayoutIndexes.Add(lCountL);
oMasterInfo.m_arLayoutImagesBase64.Add("");
}
else
{
oMasterInfo.m_arLayoutIndexes.Add(pSearchL->m_value);
oMasterInfo.m_arLayoutImagesBase64.Add("");
}
}
}
size_t nCountNoteMasters = presentation->notesMasterIdLst.GetCount();
for (size_t nNote = 0; nNote < nCountNoteMasters; ++nNote)
{
smart_ptr<PPTX::NotesMaster> noteMaster = ((*presentation)[presentation->notesMasterIdLst[nNote].rid.get()]).smart_dynamic_cast<PPTX::NotesMaster>();
size_t pPointerNM = (size_t)(noteMaster.operator ->());
CAtlMap<size_t, LONG>::CPair* pSearchNM = pCommon->notesMasters.Lookup(pPointerNM);
if (NULL != pSearchNM)
{
continue;
}
LONG lCountNM = (LONG)_notesMasters.GetCount();
pCommon->notesMasters.SetAt(pPointerNM, lCountNM);
_notesMasters.Add(noteMaster);
size_t pPointerTh = (size_t)(noteMaster->Theme.operator ->());
CAtlMap<size_t, LONG>::CPair* pSearchTh = pCommon->themes.Lookup(pPointerTh);
if (NULL == pSearchTh)
{
LONG lCountTh = (LONG)_themes.GetCount();
pCommon->themes.SetAt(pPointerTh, lCountTh);
_themes.Add(noteMaster->Theme);
}
}
size_t nCount = presentation->sldIdLst.GetCount();
for (size_t i = 0; i < nCount; ++i)
{
smart_ptr<PPTX::Slide> slide = ((*presentation)[presentation->sldIdLst[i].rid.get()]).smart_dynamic_cast<PPTX::Slide>();
size_t pPointerS = (size_t)(slide.operator ->());
CAtlMap<size_t, LONG>::CPair* pSearchS = pCommon->slides.Lookup(pPointerS);
if (NULL != pSearchS)
{
continue;
}
size_t pPointerL = (size_t)(slide->Layout.operator ->());
CAtlMap<size_t, LONG>::CPair* pSearchL = pCommon->layouts.Lookup(pPointerL);
if (NULL == pSearchL)
{
oBinaryWriter.m_oCommon.m_oSlide_Layout_Rels.Add(0);
}
else
{
oBinaryWriter.m_oCommon.m_oSlide_Layout_Rels.Add(pSearchL->m_value);
}
LONG lCountS = (LONG)_slides.GetCount();
pCommon->slides.SetAt(pPointerS, lCountS);
_slides.Add(slide);
size_t pPointerN = (size_t)(slide->Note.operator ->());
if (NULL != pPointerN)
{
CAtlMap<size_t, LONG>::CPair* pSearchN = pCommon->notes.Lookup(pPointerN);
if (NULL == pSearchN)
{
LONG lCountN = (LONG)_notes.GetCount();
pCommon->notes.SetAt(pPointerN, lCountN);
_notes.Add(slide->Note);
}
}
}
oBinaryWriter.WriteReserved(5 * 30);
oBinaryWriter.StartMainRecord(NSMainTables::Main);
oBinaryWriter.WriteULONG(NSSerFormat::Signature);
oBinaryWriter.WriteULONG(0);
smart_ptr<PPTX::App> app = oFolder.get(OOX::FileTypes::App).smart_dynamic_cast<PPTX::App>();
if (app.is_init())
{
oBinaryWriter.StartMainRecord(NSMainTables::App);
app->toPPTY(&oBinaryWriter);
}
smart_ptr<PPTX::Core> core = oFolder.get(OOX::FileTypes::Core).smart_dynamic_cast<PPTX::Core>();
if (core.is_init())
{
oBinaryWriter.StartMainRecord(NSMainTables::Core);
core->toPPTY(&oBinaryWriter);
}
smart_ptr<PPTX::ViewProps> viewProps = presentation->get(OOX::FileTypes::ViewProps).smart_dynamic_cast<PPTX::ViewProps>();
if (viewProps.is_init())
{
oBinaryWriter.StartMainRecord(NSMainTables::ViewProps);
viewProps->toPPTY(&oBinaryWriter);
}
smart_ptr<PPTX::TableStyles> tablestyles = presentation->get(OOX::FileTypes::TableStyles).smart_dynamic_cast<PPTX::TableStyles>();
if (tablestyles.is_init())
{
oBinaryWriter.StartMainRecord(NSMainTables::TableStyles);
tablestyles->toPPTY(&oBinaryWriter);
}
oBinaryWriter.StartMainRecord(NSMainTables::Presentation);
presentation->toPPTY(&oBinaryWriter);
oBinaryWriter.StartMainRecord(NSMainTables::Themes);
ULONG nCountThemes = (ULONG)_themes.GetCount();
oBinaryWriter.WriteULONG(nCountThemes);
for (ULONG i = 0; i < nCountThemes; ++i)
{
_themes[i]->toPPTY(&oBinaryWriter);
}
oBinaryWriter.StartMainRecord(NSMainTables::SlideMasters);
ULONG nCountSM = (ULONG)_slideMasters.GetCount();
oBinaryWriter.WriteULONG(nCountSM);
for (ULONG i = 0; i < nCountSM; ++i)
{
_slideMasters[i]->toPPTY(&oBinaryWriter);
}
oBinaryWriter.StartMainRecord(NSMainTables::SlideLayouts);
ULONG nCountL = (ULONG)_layouts.GetCount();
oBinaryWriter.WriteULONG(nCountL);
for (ULONG i = 0; i < nCountL; ++i)
{
_layouts[i]->toPPTY(&oBinaryWriter);
}
oBinaryWriter.StartMainRecord(NSMainTables::Slides);
ULONG nCountS = (ULONG)_slides.GetCount();
oBinaryWriter.WriteULONG(nCountS);
for (ULONG i = 0; i < nCountS; ++i)
{
_slides[i]->toPPTY(&oBinaryWriter);
}
if (FALSE)
{
oBinaryWriter.StartMainRecord(NSMainTables::NotesSlides);
ULONG nCountN = (ULONG)_notes.GetCount();
oBinaryWriter.WriteULONG(nCountN);
for (ULONG i = 0; i < nCountN; ++i)
{
_notes[i]->toPPTY(&oBinaryWriter);
}
oBinaryWriter.StartMainRecord(NSMainTables::NotesMasters);
ULONG nCountNM = (ULONG)_notesMasters.GetCount();
oBinaryWriter.WriteULONG(nCountNM);
for (ULONG i = 0; i < nCountNM; ++i)
{
_notesMasters[i]->toPPTY(&oBinaryWriter);
}
}
oBinaryWriter.StartMainRecord(NSMainTables::ImageMap);
oBinaryWriter.StartRecord(NSMainTables::ImageMap);
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
CAtlMap<CString, NSShapeImageGen::CImageInfo>* pIMaps = &oBinaryWriter.m_oCommon.m_oImageManager.m_mapImagesFile;
POSITION pos1 = pIMaps->GetStartPosition();
LONG lIndexI = 0;
while (NULL != pos1)
{
NSShapeImageGen::CImageInfo& oRec = pIMaps->GetNextValue(pos1);
oBinaryWriter.WriteString1(lIndexI++, oRec.GetPath2());
}
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
oBinaryWriter.EndRecord();
oBinaryWriter.StartMainRecord(NSMainTables::FontMap);
oBinaryWriter.StartRecord(NSMainTables::FontMap);
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
CAtlMap<CString, CString>* pFMaps = &oBinaryWriter.m_oCommon.m_pNativePicker->m_mapPicks;
POSITION pos2 = pFMaps->GetStartPosition();
LONG lIndexF = 0;
while (NULL != pos2)
{
CString& oRec = pFMaps->GetNextValue(pos2);
oBinaryWriter.WriteString1(lIndexF++, oRec);
}
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
oBinaryWriter.EndRecord();
if (TRUE)
{
oBinaryWriter.StartMainRecord(NSMainTables::SlideRels);
oBinaryWriter.StartRecord(NSMainTables::SlideRels);
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
size_t _s_rels = oBinaryWriter.m_oCommon.m_oSlide_Layout_Rels.GetCount();
for (size_t i = 0; i < _s_rels; ++i)
{
oBinaryWriter.WriteInt1(0, oBinaryWriter.m_oCommon.m_oSlide_Layout_Rels[i]);
}
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
oBinaryWriter.EndRecord();
oBinaryWriter.StartMainRecord(NSMainTables::ThemeRels);
oBinaryWriter.StartRecord(NSMainTables::ThemeRels);
CAtlArray<NSBinPptxRW::CMasterSlideInfo>* th_rels = &oBinaryWriter.m_oCommon.m_oRels;
oBinaryWriter.WriteULONG((ULONG)th_rels->GetCount());
for (size_t i = 0; i < th_rels->GetCount(); i++)
{
NSBinPptxRW::CMasterSlideInfo& oTh = th_rels->GetAt(i);
oBinaryWriter.StartRecord(0);
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
oBinaryWriter.WriteInt1(0, oTh.m_lThemeIndex);
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
ULONG lay_count = (ULONG)oTh.m_arLayoutIndexes.GetCount();
oBinaryWriter.WriteULONG(lay_count);
for (ULONG j = 0; j < lay_count; ++j)
{
oBinaryWriter.StartRecord(0);
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
oBinaryWriter.WriteInt1(0, oTh.m_arLayoutIndexes[j]);
oBinaryWriter.WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
oBinaryWriter.EndRecord();
}
oBinaryWriter.EndRecord();
}
oBinaryWriter.EndRecord();
}
oBinaryWriter.WriteEmbeddedFonts();
oBinaryWriter.WriteMainPart();
BYTE* pbBinBuffer = oBinaryWriter.GetBuffer();
int nBinBufferLen = (int)oBinaryWriter.GetPosition();
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
BYTE* pbBase64Buffer = new BYTE[nBase64BufferLen];
if (TRUE == Base64::Base64Encode(pbBinBuffer, nBinBufferLen, (LPSTR)pbBase64Buffer, &nBase64BufferLen, Base64::B64_BASE64_FLAG_NOCRLF))
{
CFile oFile;
oFile.CreateFileW(strDstFile);
CString strPrefix = _T("");
strPrefix.Format(_T("PPTY;v1;%d;"), nBinBufferLen);
CStringA sW = (CStringA)strPrefix;
oFile.WriteFile(sW.GetBuffer(), (DWORD)sW.GetLength());
oFile.WriteFile(pbBase64Buffer, nBase64BufferLen);
oFile.CloseFile();
}
RELEASEARRAYOBJECTS(pbBase64Buffer);
return 0;
}
}

View File

@@ -0,0 +1,438 @@
/*
* (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 "../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "BinReaderWriterDefines.h"
namespace NSFontCutter
{
class CEmbeddedFontsManager
{
private:
class CEmbeddedFontInfo
{
public:
CString Name;
CString PathRegular;
LONG FaceRegular;
CString PathBold;
LONG FaceBold;
CString PathItalic;
LONG FaceItalic;
CString PathBoldItalic;
LONG FaceBoldItalic;
public:
CEmbeddedFontInfo()
{
Name = _T("");
PathRegular = _T("");
FaceRegular = -1;
PathBold = _T("");
FaceBold = -1;
PathItalic = _T("");
FaceItalic = -1;
PathBoldItalic = _T("");
FaceBoldItalic = -1;
}
CEmbeddedFontInfo(const CEmbeddedFontInfo& oSrc)
{
*this = oSrc;
}
CEmbeddedFontInfo& operator=(const CEmbeddedFontInfo& oSrc)
{
Name = oSrc.Name;
PathRegular = oSrc.PathRegular;
FaceRegular = oSrc.FaceRegular;
PathBold = oSrc.PathBold;
FaceBold = oSrc.FaceBold;
PathItalic = oSrc.PathItalic;
FaceItalic = oSrc.FaceItalic;
PathBoldItalic = oSrc.PathBoldItalic;
FaceBoldItalic = oSrc.FaceBoldItalic;
return *this;
}
};
CAtlMap<CString, CEmbeddedFontInfo> m_mapFontsEmbeddded;
CAtlMap<WCHAR, BOOL> m_CharMap;
public:
CString m_strEmbeddedFontsFolder;
public:
CEmbeddedFontsManager()
{
m_strEmbeddedFontsFolder = _T("");
}
void CheckFont(const CString& strName, ASCGraphics::IASCFontManager* pManager)
{
CAtlMap<CString, CEmbeddedFontInfo>::CPair* pPair = m_mapFontsEmbeddded.Lookup(strName);
if (NULL != pPair)
return;
CEmbeddedFontInfo oInfo;
oInfo.Name = strName;
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = strName.AllocSysString();
pManager->GetAdditionalParam(L"GetAllStylesByFontName", &var);
CString strXml = (CString)var.bstrVal;
XmlUtils::CXmlNode oNode;
if (oNode.FromXmlString(strXml))
{
XmlUtils::CXmlNodes oNodes;
if (oNode.GetNodes(_T("font"), oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oNodeF;
oNodes.GetAt(i, oNodeF);
LONG lStyle = oNodeF.ReadAttributeInt(_T("style"));
switch (lStyle)
{
case 0:
oInfo.PathRegular = oNodeF.GetAttribute(_T("path"));
oInfo.FaceRegular = oNodeF.ReadAttributeInt(_T("faceindex"));
break;
case 1:
oInfo.PathBold = oNodeF.GetAttribute(_T("path"));
oInfo.FaceBold = oNodeF.ReadAttributeInt(_T("faceindex"));
break;
case 2:
oInfo.PathItalic = oNodeF.GetAttribute(_T("path"));
oInfo.FaceItalic = oNodeF.ReadAttributeInt(_T("faceindex"));
break;
case 3:
oInfo.PathBoldItalic = oNodeF.GetAttribute(_T("path"));
oInfo.FaceBoldItalic = oNodeF.ReadAttributeInt(_T("faceindex"));
break;
default:
break;
}
}
}
}
m_mapFontsEmbeddded.SetAt(strName, oInfo);
}
void CheckString(const nullable_string& val)
{
if (val.is_init())
CheckString(*val);
}
void CheckString(const CString& val)
{
int len = val.GetLength();
LPWSTR pCBuf1 = new WCHAR[len + 1];
LPWSTR pCBuf2 = new WCHAR[len + 1];
LPCWSTR pSrc = (LPCWSTR)val;
memcpy(pCBuf1, pSrc, len * sizeof(WCHAR));
memcpy(pCBuf2, pSrc, len * sizeof(WCHAR));
pCBuf1[len] = 0;
pCBuf2[len] = 0;
LPWSTR ch1 = CharLower(pCBuf1);
LPWSTR ch2 = CharUpper(pCBuf2);
for (int i = 0; i < len; ++i)
{
m_CharMap.SetAt(ch1[i], TRUE);
m_CharMap.SetAt(ch2[i], TRUE);
}
RELEASEARRAYOBJECTS(pCBuf1);
RELEASEARRAYOBJECTS(pCBuf2);
}
template<typename T>
void WriteEmbeddedFonts(T* pWriter)
{
#ifdef BUILD_CONFIG_FULL_VERSION
ULONG nCount = 0;
POSITION pos = m_mapFontsEmbeddded.GetStartPosition();
while (pos != NULL)
{
CEmbeddedFontInfo& oInfo = m_mapFontsEmbeddded.GetNextValue(pos);
if (_T("") != oInfo.PathRegular)
++nCount;
if (_T("") != oInfo.PathBold)
++nCount;
if (_T("") != oInfo.PathItalic)
++nCount;
if (_T("") != oInfo.PathBoldItalic)
++nCount;
}
pWriter->WriteULONG(nCount);
CString strFileWrite = m_strEmbeddedFontsFolder + _T("\\fonts.js");
CFile oFile;
oFile.CreateFile(strFileWrite);
CStringA strWrite = "var embedded_fonts = [\n";
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
strWrite = ",\n";
bool bIsFirst = true;
ULONG lIndexF = 0;
SAFEARRAY* pArrayUnicodes = GenerateSafearray();
Fonts::IFontConverter* pFontConverter = NULL;
CoCreateInstance(__uuidof(Fonts::CFontConverter), NULL, CLSCTX_ALL, __uuidof(Fonts::IFontConverter), (void**)&pFontConverter);
pos = m_mapFontsEmbeddded.GetStartPosition();
while (pos != NULL)
{
CEmbeddedFontInfo& oInfo = m_mapFontsEmbeddded.GetNextValue(pos);
if (_T("") != oInfo.PathRegular)
{
if (!bIsFirst)
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
bIsFirst = false;
WriteFont(oInfo.Name, oInfo.FaceRegular, oInfo.PathRegular, &oFile, pArrayUnicodes, pFontConverter);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteBYTE(0);
pWriter->WriteString(oInfo.Name);
pWriter->WriteBYTE(1);
pWriter->WriteULONG(0);
pWriter->WriteBYTE(2);
pWriter->WriteBYTE(1);
pWriter->WriteBYTE(3);
pWriter->WriteULONG(lIndexF);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
lIndexF++;
}
if (_T("") != oInfo.PathBold)
{
if (!bIsFirst)
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
bIsFirst = false;
WriteFont(oInfo.Name, oInfo.FaceBold, oInfo.PathBold, &oFile, pArrayUnicodes, pFontConverter);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteBYTE(0);
pWriter->WriteString(oInfo.Name);
pWriter->WriteBYTE(1);
pWriter->WriteULONG(1);
pWriter->WriteBYTE(2);
pWriter->WriteBYTE(1);
pWriter->WriteBYTE(3);
pWriter->WriteULONG(lIndexF);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
lIndexF++;
}
if (_T("") != oInfo.PathItalic)
{
if (!bIsFirst)
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
bIsFirst = false;
WriteFont(oInfo.Name, oInfo.FaceItalic, oInfo.PathItalic, &oFile, pArrayUnicodes, pFontConverter);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteBYTE(0);
pWriter->WriteString(oInfo.Name);
pWriter->WriteBYTE(1);
pWriter->WriteULONG(2);
pWriter->WriteBYTE(2);
pWriter->WriteBYTE(1);
pWriter->WriteBYTE(3);
pWriter->WriteULONG(lIndexF);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
lIndexF++;
}
if (_T("") != oInfo.PathBoldItalic)
{
if (!bIsFirst)
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
bIsFirst = false;
WriteFont(oInfo.Name, oInfo.FaceBoldItalic, oInfo.PathBoldItalic, &oFile, pArrayUnicodes, pFontConverter);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteBYTE(0);
pWriter->WriteString(oInfo.Name);
pWriter->WriteBYTE(1);
pWriter->WriteULONG(3);
pWriter->WriteBYTE(2);
pWriter->WriteBYTE(1);
pWriter->WriteBYTE(3);
pWriter->WriteULONG(lIndexF);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
lIndexF++;
}
}
strWrite = "\n];";
oFile.WriteFile(strWrite.GetBuffer(), strWrite.GetLength());
oFile.CloseFile();
RELEASEARRAY(pArrayUnicodes);
RELEASEINTERFACE(pFontConverter);
#endif
}
SAFEARRAY* GenerateSafearray()
{
CheckString(_T("0123456789"));
m_CharMap.SetAt((WCHAR)0x00B0, TRUE);
m_CharMap.SetAt((WCHAR)0x00B7, TRUE);
m_CharMap.SetAt((WCHAR)0x00B6, TRUE);
m_CharMap.SetAt((WCHAR)0x00A4, TRUE);
m_CharMap.SetAt((WCHAR)0x00A0, TRUE);
m_CharMap.SetAt((WCHAR)0x0022, TRUE);
m_CharMap.SetAt((WCHAR)0x0032, TRUE);
m_CharMap.SetAt((WCHAR)0x0038, TRUE);
m_CharMap.SetAt((WCHAR)0x0097, TRUE);
ULONG nCount = (ULONG)m_CharMap.GetCount();
SAFEARRAYBOUND rgsab;
rgsab.lLbound = 0;
rgsab.cElements = nCount;
SAFEARRAY* pArray = SafeArrayCreate(VT_UI2, 1, &rgsab);
USHORT* pBuffer = (USHORT*)(pArray->pvData);
POSITION pos = m_CharMap.GetStartPosition();
while (NULL != pos)
{
CAtlMap<WCHAR, BOOL>::CPair* pPair = m_CharMap.GetNext(pos);
*pBuffer = pPair->m_key;
++pBuffer;
}
return pArray;
}
#ifdef BUILD_CONFIG_FULL_VERSION
void WriteFont(CString& strName, LONG& lFaceIndex, CString& strFontPath, CFile* pFile, SAFEARRAY* pArrayUnicodes, Fonts::IFontConverter* pFontConverter)
{
LONG lFontConverterFlag = 16;
BSTR bsFontIn = strFontPath.AllocSysString();
CString _strName = strName + _T("_Embedded");
BSTR bsName = _strName.AllocSysString();
SAFEARRAY* pArrayData = NULL;
pFontConverter->ToOTF2(bsFontIn, pArrayUnicodes, bsName, lFontConverterFlag, lFaceIndex, &pArrayData);
SysFreeString(bsFontIn);
SysFreeString(bsName);
BYTE* pbBinBuffer = (BYTE*)pArrayData->pvData;
int nBinBufferLen = pArrayData->rgsabound[0].cElements;
int nBase64BufferLen = Base64::Base64EncodeGetRequiredLength(nBinBufferLen, Base64::B64_BASE64_FLAG_NOCRLF);
BYTE* pbBase64Buffer = new BYTE[nBase64BufferLen];
if (TRUE == Base64::Base64Encode(pbBinBuffer, nBinBufferLen, (LPSTR)pbBase64Buffer, &nBase64BufferLen, Base64::B64_BASE64_FLAG_NOCRLF))
{
CStringA s = "\"";
pFile->WriteFile(s.GetBuffer(), s.GetLength());
pFile->WriteFile(pbBase64Buffer, nBase64BufferLen);
pFile->WriteFile(s.GetBuffer(), s.GetLength());
}
RELEASEARRAYOBJECTS(pbBase64Buffer);
RELEASEARRAY(pArrayData);
}
#endif
};
}
#define FONT_PICKER_BINARYDATA_SAVEEMBEDDED 0
#define FONT_PICKER_BINARYDATA_SAVEMAP 1

View File

@@ -0,0 +1,58 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "stdafx.h"
#include "BinWriters.h"
HRESULT COfficeFontPicker::GetBinaryData(LONG lType, SAFEARRAY** ppBinaryArray)
{
if (NULL == ppBinaryArray)
return S_FALSE;
*ppBinaryArray = NULL;
if (FONT_PICKER_BINARYDATA_SAVEEMBEDDED == lType)
{
NSBinPptxRW::CBinaryFileWriter oWriter;
m_oPicker.m_oEmbeddedFonts.CheckString(_T(".)abcdefghijklmnopqrstuvwxyz"));
m_oPicker.m_oEmbeddedFonts.CheckFont(_T("Wingdings 3"), m_oPicker.m_pFontManager);
m_oPicker.m_oEmbeddedFonts.CheckFont(_T("Arial"), m_oPicker.m_pFontManager);
oWriter.StartRecord(NSBinPptxRW::NSMainTables::FontsEmbedded);
m_oPicker.m_oEmbeddedFonts.WriteEmbeddedFonts(&oWriter);
oWriter.EndRecord();
*ppBinaryArray = oWriter.GetSafearray();
}
else if (FONT_PICKER_BINARYDATA_SAVEMAP == lType)
{
}
return S_OK;
}

View File

@@ -0,0 +1,310 @@
/*
* (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 "../stdafx.h"
#include "../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "BinReaderWriterDefines.h"
#include "FontCutter.h"
namespace NSFontCutter
{
class CFontDstManager
{
public:
CAtlMap<CString, CString> m_mapPicks;
ASCGraphics::IASCFontManager* m_pFontManager;
CString m_strFontsDir;
BOOL m_bIsEmbeddedFonts;
CEmbeddedFontsManager m_oEmbeddedFonts;
public:
CFontDstManager() : m_mapPicks()
{
m_strFontsDir = _T("");
m_pFontManager = NULL;
CoCreateInstance(ASCGraphics::CLSID_CASCFontManager, NULL, CLSCTX_ALL, ASCGraphics::IID_IASCFontManager, (void**)&m_pFontManager);
m_bIsEmbeddedFonts = FALSE;
}
~CFontDstManager()
{
RELEASEINTERFACE(m_pFontManager);
}
void Init(const CString& strDir)
{
m_strFontsDir = strDir;
if (_T("") != m_strFontsDir)
{
VARIANT var;
var.vt = VT_BSTR;
var.bstrVal = m_strFontsDir.AllocSysString();
m_pFontManager->SetAdditionalParam(L"InitializeFromFolder", var);
RELEASESYSSTRING(var.bstrVal);
}
else
{
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
m_pFontManager->Init(L"", VARIANT_TRUE, VARIANT_FALSE);
#else
m_pFontManager->Initialize(L"");
#endif
}
#ifdef BUILD_CONFIG_FULL_VERSION
CString defaultFontName = _T("Arial");
BSTR defFontName = defaultFontName.AllocSysString();
m_pFontManager->SetDefaultFont(defFontName);
SysFreeString(defFontName);
#endif
}
CString GetTypefacePickByName(const CString& strTypeface)
{
CString sFind = strTypeface;
int nFindTh = sFind.Find(_T("+mj"));
if (0 == nFindTh)
return sFind;
nFindTh = sFind.Find(_T("+mn"));
if (0 == nFindTh)
return sFind;
if (_T("") == sFind)
{
sFind = _T("Arial");
}
CAtlMap<CString, CString>::CPair* pPair = m_mapPicks.Lookup(sFind);
if (NULL != pPair)
return pPair->m_value;
CString sInputSave = sFind;
sFind.Replace(_T("'"), _T("&apos;"));
sFind.Replace(_T("<"), _T("&lt;"));
sFind.Replace(_T(">"), _T("&gt;"));
sFind.Replace(_T("\""), _T("&quot;"));
sFind.Replace(_T("&"), _T("&amp;"));
CString strPick = _T("<FontProperties><Name value=\"") + sFind + _T("\"/></FontProperties>");
BSTR bsResult = NULL;
LONG lFontIndex = 0;
BSTR bsInput = strPick.AllocSysString();
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
m_pFontManager->GetWinFontByParams(bsInput, &bsResult, NULL, NULL, &lFontIndex);
#else
m_pFontManager->GetWinFontByParams(bsInput, &bsResult, &lFontIndex);
CString strPath = (CString)bsResult;
m_pFontManager->LoadFontFromFile(bsResult, 12, 72, 72, lFontIndex);
SysFreeString(bsInput);
SysFreeString(bsResult);
m_pFontManager->GetFamilyName(&bsResult);
#endif
CString sRes = bsResult;
SysFreeString(bsResult);
if (m_bIsEmbeddedFonts)
m_oEmbeddedFonts.CheckFont(sRes, m_pFontManager);
m_mapPicks.SetAt(sInputSave, sRes);
return sRes;
}
template<typename TTextFont>
CString GetTypefacePick(TTextFont& textFont)
{
return GetTypefacePickByName(textFont.typeface);
}
};
}
[object, uuid("5061C3D5-E67E-4bd8-8E32-BE2CFC2D112D"), dual, pointer_default(unique)]
__interface IOfficeFontPicker : IDispatch
{
[id(1)] HRESULT Init([in] BSTR bsFontsDirectory);
[propget, id(2)] HRESULT FontManager([out, retval] IUnknown** pVal);
[propput, id(2)] HRESULT FontManager([in] IUnknown* newVal);
[id(10)] HRESULT SetEmbeddedFontsDirectory([in] BSTR bsFontsDirectory);
[id(11)] HRESULT SetEmbeddedFontsParam([in] LONG lParam);
[id(20)] HRESULT CheckString([in] BSTR bsText);
[id(21)] HRESULT CheckFont([in] BSTR bsFontName);
[id(22)] HRESULT PickFont([in] LONG lParamType, [in] BSTR bsParams, [out, retval] BSTR* pDstName);
[id(30)] HRESULT GetBinaryData([in] LONG lType, [out, satype("BYTE")] SAFEARRAY** ppBinaryArray);
[id(50)] HRESULT SetAdditionalParam([in] BSTR ParamName, [in] VARIANT ParamValue);
[id(51)] HRESULT GetAdditionalParam([in] BSTR ParamName, [out, retval] VARIANT* ParamValue);
};
[coclass, uuid("C489E74B-FCAF-450f-A1CB-881CACB65501"), threading(apartment), vi_progid("Office.OfficeFontPicker"), progid("Office.Picker.1"), version(1.0), registration_script("control.rgs")]
class ATL_NO_VTABLE COfficeFontPicker
: public IOfficeFontPicker
{
private:
NSFontCutter::CFontDstManager m_oPicker;
public:
COfficeFontPicker()
{
}
~COfficeFontPicker()
{
}
DECLARE_PROTECT_FINAL_CONSTRUCT()
HRESULT FinalConstruct()
{
return S_OK;
}
void FinalRelease()
{
}
public:
STDMETHOD(Init)(BSTR bsFontsDirectory)
{
m_oPicker.Init((CString)bsFontsDirectory);
return S_OK;
}
STDMETHOD(get_FontManager)(IUnknown** pVal)
{
if (NULL == pVal)
return S_FALSE;
*pVal = NULL;
if (NULL == m_oPicker.m_pFontManager)
return S_OK;
m_oPicker.m_pFontManager->QueryInterface(IID_IUnknown, (void**)pVal);
return S_OK;
}
STDMETHOD(put_FontManager)(IUnknown* newVal)
{
if (NULL == newVal)
return S_OK;
RELEASEINTERFACE((m_oPicker.m_pFontManager));
newVal->QueryInterface(ASCGraphics::IID_IASCFontManager, (void**)&(m_oPicker.m_pFontManager));
return S_OK;
}
STDMETHOD(SetEmbeddedFontsDirectory)(BSTR bsFontsDirectory)
{
m_oPicker.m_oEmbeddedFonts.m_strEmbeddedFontsFolder = (CString)bsFontsDirectory;
return S_OK;
}
STDMETHOD(SetEmbeddedFontsParam)(LONG lParam)
{
switch (lParam)
{
case 0:
m_oPicker.m_bIsEmbeddedFonts = FALSE;
break;
case 1:
m_oPicker.m_bIsEmbeddedFonts = TRUE;
break;
default:
break;
}
return S_OK;
}
STDMETHOD(CheckString)(BSTR bsText)
{
m_oPicker.m_oEmbeddedFonts.CheckString((CString)bsText);
return S_OK;
}
STDMETHOD(CheckFont)(BSTR bsFontName)
{
m_oPicker.m_oEmbeddedFonts.CheckFont((CString)bsFontName, m_oPicker.m_pFontManager);
return S_OK;
}
STDMETHOD(PickFont)(LONG lParamType, BSTR bsParams, BSTR* pDstName)
{
if (NULL == pDstName)
return S_FALSE;
if (0 == lParamType)
{
CString strResult = m_oPicker.GetTypefacePickByName((CString)bsParams);
*pDstName = strResult.AllocSysString();
return S_OK;
}
return S_OK;
}
STDMETHOD(GetBinaryData)(LONG lType, SAFEARRAY** ppBinaryArray);
STDMETHOD(SetAdditionalParam)(BSTR ParamName, VARIANT ParamValue)
{
return S_OK;
}
STDMETHOD(GetAdditionalParam)(BSTR ParamName, VARIANT* ParamValue)
{
CString name = (CString)ParamName;
if (name == _T("NativePicker"))
{
ParamValue->vt = VT_PTR;
ParamValue->pvRecord = &m_oPicker;
}
else if (name == _T("NativeCutter"))
{
ParamValue->vt = VT_PTR;
ParamValue->pvRecord = &m_oPicker.m_oEmbeddedFonts;
}
return S_OK;
}
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,183 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<p:notesMaster xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
<p:cSld>
<p:bg>
<p:bgPr>
<a:solidFill>
<a:schemeClr val="bg1"/>
</a:solidFill>
<a:effectLst/>
</p:bgPr>
</p:bg>
<p:spTree>
<p:nvGrpSpPr>
<p:cNvPr id="1" name=""/>
<p:cNvGrpSpPr/>
<p:nvPr/>
</p:nvGrpSpPr>
<p:grpSpPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="0" cy="0"/>
<a:chOff x="0" y="0"/>
<a:chExt cx="0" cy="0"/>
</a:xfrm>
</p:grpSpPr>
<p:sp>
<p:nvSpPr>
<p:cNvPr id="11271" name="Rectangle 7"/>
<p:cNvSpPr>
<a:spLocks noGrp="1" noChangeArrowheads="1"/>
</p:cNvSpPr>
<p:nvPr>
<p:ph type="body" idx="1"/>
</p:nvPr>
</p:nvSpPr>
<p:spPr bwMode="auto">
<a:xfrm>
<a:off x="3884613" y="8685213"/>
<a:ext cx="2971800" cy="457200"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
<a:extLst/>
</p:spPr>
<p:txBody>
<a:bodyPr/>
<a:lstStyle>
<a:lvl1pPr algn="l">
<a:defRPr sz="1200">
<a:latin typeface="Arial" charset="0"/>
</a:defRPr>
</a:lvl1pPr>
</a:lstStyle>
<a:p><a:endParaRPr/></a:p>
</p:txBody>
</p:sp>
</p:spTree>
</p:cSld>
<p:clrMap bg1="lt1" tx1="dk1" bg2="lt2" tx2="dk2" accent1="accent1" accent2="accent2" accent3="accent3" accent4="accent4" accent5="accent5" accent6="accent6" hlink="hlink" folHlink="folHlink"/>
<p:notesStyle>
<a:lvl1pPr algn="l" rtl="0" fontAlgn="base">
<a:spcBef>
<a:spcPct val="30000"/>
</a:spcBef>
<a:spcAft>
<a:spcPct val="0"/>
</a:spcAft>
<a:defRPr sz="1200" kern="1200">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="Arial" charset="0"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
</a:defRPr>
</a:lvl1pPr>
<a:lvl2pPr marL="457200" algn="l" rtl="0" fontAlgn="base">
<a:spcBef>
<a:spcPct val="30000"/>
</a:spcBef>
<a:spcAft>
<a:spcPct val="0"/>
</a:spcAft>
<a:defRPr sz="1200" kern="1200">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="Arial" charset="0"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
</a:defRPr>
</a:lvl2pPr>
<a:lvl3pPr marL="914400" algn="l" rtl="0" fontAlgn="base">
<a:spcBef>
<a:spcPct val="30000"/>
</a:spcBef>
<a:spcAft>
<a:spcPct val="0"/>
</a:spcAft>
<a:defRPr sz="1200" kern="1200">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="Arial" charset="0"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
</a:defRPr>
</a:lvl3pPr>
<a:lvl4pPr marL="1371600" algn="l" rtl="0" fontAlgn="base">
<a:spcBef>
<a:spcPct val="30000"/>
</a:spcBef>
<a:spcAft>
<a:spcPct val="0"/>
</a:spcAft>
<a:defRPr sz="1200" kern="1200">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="Arial" charset="0"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
</a:defRPr>
</a:lvl4pPr>
<a:lvl5pPr marL="1828800" algn="l" rtl="0" fontAlgn="base">
<a:spcBef>
<a:spcPct val="30000"/>
</a:spcBef>
<a:spcAft>
<a:spcPct val="0"/>
</a:spcAft>
<a:defRPr sz="1200" kern="1200">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="Arial" charset="0"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
</a:defRPr>
</a:lvl5pPr>
<a:lvl6pPr marL="2286000" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
<a:defRPr sz="1200" kern="1200">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
</a:defRPr>
</a:lvl6pPr>
<a:lvl7pPr marL="2743200" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
<a:defRPr sz="1200" kern="1200">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
</a:defRPr>
</a:lvl7pPr>
<a:lvl8pPr marL="3200400" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
<a:defRPr sz="1200" kern="1200">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
</a:defRPr>
</a:lvl8pPr>
<a:lvl9pPr marL="3657600" algn="l" defTabSz="914400" rtl="0" eaLnBrk="1" latinLnBrk="0" hangingPunct="1">
<a:defRPr sz="1200" kern="1200">
<a:solidFill>
<a:schemeClr val="tx1"/>
</a:solidFill>
<a:latin typeface="+mn-lt"/>
<a:ea typeface="+mn-ea"/>
<a:cs typeface="+mn-cs"/>
</a:defRPr>
</a:lvl9pPr>
</p:notesStyle>
</p:notesMaster>

File diff suppressed because one or more lines are too long

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
*
*/
#pragma once
#include "../stdafx.h"
#ifdef BUILD_CONFIG_FULL_VERSION
namespace NSWMFToImageConverter
{
class CImageExt
{
private:
IASCRenderer* m_pSVGRenderer;
void Init()
{
if (NULL != m_pSVGRenderer)
{
VARIANT var;
var.vt = VT_I4;
var.lVal = 0;
m_pSVGRenderer->SetAdditionalParam(L"ReInit", var);
}
else
{
CoCreateInstance( HtmlRenderer::CLSID_CASCSVGWriter, NULL, CLSCTX_ALL, __uuidof(IASCRenderer), (void**)(&m_pSVGRenderer) );
}
}
public:
CImageExt()
{
m_pSVGRenderer = NULL;
}
~CImageExt()
{
RELEASEINTERFACE(m_pSVGRenderer);
}
public:
LONG GetImageType(CString strFile)
{
CFile oFile;
if (S_OK != oFile.OpenFile(strFile))
{
oFile.CloseFile();
return 0;
}
DWORD dwSize = (DWORD)oFile.GetFileSize();
if (44 > dwSize)
{
return 0;
}
DWORD dwKey = 0;
oFile.ReadFile((BYTE*)(&dwKey), 4);
if (0x9AC6CDD7 == dwKey)
{
oFile.CloseFile();
return 1;
}
if (0x00000001 == dwKey)
{
oFile.SetPosition(40);
oFile.ReadFile((BYTE*)(&dwKey), 4);
oFile.CloseFile();
if (0x464D4520 == dwKey)
{
return 2;
}
else
{
return 0;
}
}
oFile.CloseFile();
if (0x00090001 == dwKey)
{
return 1;
}
return 0;
}
void MetaDrawOnRenderer(IASCRenderer* pRenderer, BSTR strFile, double dW, double dH)
{
if (NULL == pRenderer)
return;
LONG brush_Alpha1 = 0;
LONG brush_Alpha2 = 0;
LONG brush_Color1 = 0;
LONG brush_Color2 = 0;
double brush_LinearAngle = 0;
BSTR brush_TexturePath = NULL;
LONG brush_TextureMode = 0;
LONG brush_TextureAlpha = 0;
LONG brush_Type = 0;
pRenderer->get_BrushAlpha1( &brush_Alpha1 );
pRenderer->get_BrushAlpha2( &brush_Alpha2 );
pRenderer->get_BrushColor1( &brush_Color1 );
pRenderer->get_BrushColor2( &brush_Color2 );
pRenderer->get_BrushLinearAngle( &brush_LinearAngle );
pRenderer->get_BrushTextureMode( &brush_TextureMode );
pRenderer->get_BrushTextureAlpha( &brush_TextureAlpha );
pRenderer->get_BrushTexturePath( &brush_TexturePath );
pRenderer->get_BrushType( &brush_Type );
BSTR font_Path = NULL;
BSTR font_Name = NULL;
double font_Size = 0;
LONG font_Style = 0;
BOOL font_GID = 0;
pRenderer->get_FontName( &font_Name );
pRenderer->get_FontPath( &font_Path );
pRenderer->get_FontSize( &font_Size );
pRenderer->get_FontStyle( &font_Style );
pRenderer->get_FontStringGID( &font_GID );
LONG pen_Align = 0;
LONG pen_Alpha = 0;
LONG pen_Color = 0;
pRenderer->get_PenAlign( &pen_Align );
pRenderer->get_PenAlpha( &pen_Alpha );
pRenderer->get_PenColor( &pen_Color );
ASCGraphics::IAVSImage *pImage = NULL;
CoCreateInstance( __uuidof(ASCGraphics::CAVSImage), NULL, CLSCTX_ALL, __uuidof(ASCGraphics::IAVSImage), (void**)(&pImage) );
pImage->put_FontManager(NULL);
pImage->LoadFromFile( strFile );
if (dW <= 0 && dH <= 0)
{
LONG _lw = 0;
LONG _lh = 0;
pImage->get_Width(&_lw);
pImage->get_Height(&_lh);
LONG lMax = max(_lw, _lh);
double dKoef = 1000.0 / lMax;
dW = (double)dKoef * _lw * 100;
dH = (double)dKoef * _lh * 100;
m_pSVGRenderer->put_Width(dW);
m_pSVGRenderer->put_Height(dH);
}
pImage->DrawOnRenderer( pRenderer, 0, 0, dW, dH );
RELEASEINTERFACE( pImage );
pRenderer->put_BrushAlpha1( brush_Alpha1 );
pRenderer->put_BrushAlpha2( brush_Alpha2 );
pRenderer->put_BrushColor1( brush_Color1 );
pRenderer->put_BrushColor2( brush_Color2 );
pRenderer->put_BrushLinearAngle( brush_LinearAngle );
pRenderer->put_BrushTextureMode( brush_TextureMode );
pRenderer->put_BrushTextureAlpha( brush_TextureAlpha );
pRenderer->put_BrushTexturePath( brush_TexturePath ); if ( brush_TexturePath ) ::SysFreeString( brush_TexturePath );
pRenderer->put_BrushType( brush_Type );
pRenderer->put_FontName( font_Name ); if ( font_Name ) ::SysFreeString( font_Name );
pRenderer->put_FontPath( font_Path ); if ( font_Path ) ::SysFreeString( font_Path );
pRenderer->put_FontSize( font_Size );
pRenderer->put_FontStyle( font_Style );
pRenderer->put_FontStringGID( font_GID );
pRenderer->put_PenAlign( pen_Align );
pRenderer->put_PenAlpha( pen_Alpha );
pRenderer->put_PenColor( pen_Color );
pRenderer->PathCommandEnd();
}
bool Convert(CString strPath, LONG lWidth, LONG lHeight, CString strDstPath)
{
Init();
m_pSVGRenderer->put_Width(lWidth);
m_pSVGRenderer->put_Height(lHeight);
BSTR bsFilePath = strPath.AllocSysString();
MetaDrawOnRenderer(m_pSVGRenderer, bsFilePath, (double)lWidth, (double)lHeight);
SysFreeString(bsFilePath);
VARIANT var;
m_pSVGRenderer->GetAdditionalParam(L"IsRaster", &var);
if (VARIANT_TRUE == var.boolVal)
return false;
var.vt = VT_BSTR;
var.bstrVal = strDstPath.AllocSysString();
m_pSVGRenderer->SetAdditionalParam(L"SaveFile", var);
SysFreeString((var.bstrVal));
return true;
}
};
}
#endif

View File

@@ -0,0 +1,746 @@
/*
* (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 "../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "./BinReaderWriterDefines.h"
namespace NSBinPptxRW
{
static _bstr_t g_bstr_nodeopen = L"<";
static _bstr_t g_bstr_nodeclose = L">";
static _bstr_t g_bstr_nodeopen_slash = L"</";
static _bstr_t g_bstr_nodeclose_slash = L"/>";
static _bstr_t g_bstr_node_space = L" ";
static _bstr_t g_bstr_node_equal = L"=";
static _bstr_t g_bstr_node_quote = L"\"";
static _bstr_t g_bstr_boolean_true = L"true";
static _bstr_t g_bstr_boolean_false = L"false";
static _bstr_t g_bstr_boolean_true2 = L"1";
static _bstr_t g_bstr_boolean_false2 = L"0";
AVSINLINE static double FABS(double dVal)
{
return (dVal >= 0) ? dVal : -dVal;
}
AVSINLINE static int round(double dVal)
{
return (int)(dVal + 0.5);
}
class CStringWriter
{
private:
wchar_t* m_pData;
size_t m_lSize;
wchar_t* m_pDataCur;
size_t m_lSizeCur;
public:
CStringWriter()
{
m_pData = NULL;
m_lSize = 0;
m_pDataCur = m_pData;
m_lSizeCur = m_lSize;
}
~CStringWriter()
{
RELEASEMEM(m_pData);
}
__forceinline void AddSize(size_t nSize)
{
if (NULL == m_pData)
{
m_lSize = max(nSize, 1000);
m_pData = (wchar_t*)malloc(m_lSize * sizeof(wchar_t));
m_lSizeCur = 0;
m_pDataCur = m_pData;
return;
}
if ((m_lSizeCur + nSize) > m_lSize)
{
while ((m_lSizeCur + nSize) > m_lSize)
{
m_lSize *= 2;
}
wchar_t* pRealloc = (wchar_t*)realloc(m_pData, m_lSize * sizeof(wchar_t));
if (NULL != pRealloc)
{
m_pData = pRealloc;
m_pDataCur = m_pData + m_lSizeCur;
}
else
{
wchar_t* pMalloc = (wchar_t*)malloc(m_lSize * sizeof(wchar_t));
memcpy(pMalloc, m_pData, m_lSizeCur * sizeof(wchar_t));
free(m_pData);
m_pData = pMalloc;
m_pDataCur = m_pData + m_lSizeCur;
}
}
}
public:
__forceinline void WriteString(wchar_t* pString, size_t& nLen)
{
AddSize(nLen);
memcpy(m_pDataCur, pString, nLen << 1);
m_pDataCur += nLen;
m_lSizeCur += nLen;
}
__forceinline void WriteString(_bstr_t& bsString)
{
size_t nLen = bsString.length();
WriteString(bsString.GetBSTR(), nLen);
}
__forceinline void WriteString(const CString& sString)
{
size_t nLen = (size_t)sString.GetLength();
#ifdef _UNICODE
CString* pString = const_cast<CString*>(&sString);
WriteString(pString->GetBuffer(), nLen);
pString->ReleaseBuffer();
#else
CStringW str = (CStringW)sString;
WriteString(str.GetBuffer(), nLen);
str.ReleaseBuffer();
#endif
}
__forceinline void WriteStringXML(const CString& strValue)
{
CString s = strValue;
s.Replace(_T("&"), _T("&amp;"));
s.Replace(_T("'"), _T("&apos;"));
s.Replace(_T("<"), _T("&lt;"));
s.Replace(_T(">"), _T("&gt;"));
s.Replace(_T("\""), _T("&quot;"));
WriteString(s);
}
__forceinline size_t GetCurSize()
{
return m_lSizeCur;
}
__forceinline void Write(CStringWriter& oWriter)
{
WriteString(oWriter.m_pData, oWriter.m_lSizeCur);
}
__forceinline void WriteBefore(CStringWriter& oWriter)
{
size_t nNewS = oWriter.GetCurSize();
AddSize(nNewS);
memmove(m_pData + nNewS, m_pData, m_lSizeCur << 1);
memcpy(m_pData, oWriter.m_pData, nNewS << 1);
m_pDataCur += nNewS;
m_lSizeCur += nNewS;
}
inline void Clear()
{
RELEASEMEM(m_pData);
m_pData = NULL;
m_lSize = 0;
m_pDataCur = m_pData;
m_lSizeCur = 0;
}
inline void ClearNoAttack()
{
m_pDataCur = m_pData;
m_lSizeCur = 0;
}
CString GetData()
{
CString str(m_pData, (int)m_lSizeCur);
return str;
}
__forceinline void AddCharNoCheck(const WCHAR& wc)
{
*m_pDataCur++ = wc;
++m_lSizeCur;
}
__forceinline void AddIntNoCheck(int val)
{
if (0 == val)
{
*m_pDataCur++ = (WCHAR)'0';
++m_lSizeCur;
return;
}
if (val < 0)
{
val = -val;
*m_pDataCur++ = (WCHAR)'-';
++m_lSizeCur;
}
int len = 0;
int oval = val;
while (oval > 0)
{
oval /= 10;
++len;
}
oval = 1;
while (val > 0)
{
m_pDataCur[len - oval] = (WCHAR)('0' + (val % 10));
++oval;
val /= 10;
}
m_pDataCur += len;
m_lSizeCur += len;
}
__forceinline void AddStringNoCheck(const wchar_t* pData, const int& len)
{
memcpy(m_pDataCur, pData, len << 1);
m_pDataCur += len;
m_lSizeCur += len;
}
__forceinline void AddSpaceNoCheck()
{
*m_pDataCur = WCHAR(' ');
++m_pDataCur;
++m_lSizeCur;
}
};
class CXmlWriter
{
public:
CStringWriter m_oWriter;
public:
BYTE m_lDocType;
LONG m_lFlag;
LONG m_lGroupIndex;
LONG m_lObjectId;
LONG m_lObjectIdVML;
public:
BOOL m_bIsUseOffice2007;
CString m_strStyleMain;
CString m_strAttributesMain;
CString m_strNodes;
IASCRenderer* m_pOOXToVMLRenderer;
bool m_bIsTop;
public:
CXmlWriter() : m_oWriter()
{
m_lDocType = XMLWRITER_DOC_TYPE_PPTX;
m_lFlag = 0;
m_lGroupIndex = 0;
m_lObjectId = 0;
m_lObjectIdVML = 0;
m_bIsUseOffice2007 = FALSE;
m_strStyleMain = _T("");
m_strAttributesMain = _T("");
m_strNodes = _T("");
m_pOOXToVMLRenderer = NULL;
m_bIsTop = false;
}
~CXmlWriter()
{
RELEASEINTERFACE(m_pOOXToVMLRenderer);
}
AVSINLINE CString GetXmlString()
{
return m_oWriter.GetData();
}
AVSINLINE void ClearNoAttack()
{
m_oWriter.ClearNoAttack();
}
AVSINLINE int GetSize()
{
return (int)m_oWriter.GetCurSize();
}
AVSINLINE void WriteString(const CString& strValue)
{
m_oWriter.WriteString(strValue);
}
AVSINLINE void WriteStringXML(CString strValue)
{
CString s = strValue;
s.Replace(_T("&"), _T("&amp;"));
s.Replace(_T("'"), _T("&apos;"));
s.Replace(_T("<"), _T("&lt;"));
s.Replace(_T(">"), _T("&gt;"));
s.Replace(_T("\""), _T("&quot;"));
m_oWriter.WriteString(s);
}
AVSINLINE void WriteDouble(const double& val)
{
CString str = _T("");
str.Format(_T("%lf"), val);
m_oWriter.WriteString(str);
}
AVSINLINE void WriteLONG(const long& val)
{
CString str = _T("");
str.Format(_T("%d"), val);
m_oWriter.WriteString(str);
}
AVSINLINE void WriteINT(const int& val)
{
CString str = _T("");
str.Format(_T("%d"), val);
m_oWriter.WriteString(str);
}
AVSINLINE void WriteDWORD(const DWORD& val)
{
CString str = _T("");
str.Format(_T("%u"), val);
m_oWriter.WriteString(str);
}
AVSINLINE void WriteDWORD_hex(const DWORD& val)
{
CString str = _T("");
str.Format(_T("%x"), val);
m_oWriter.WriteString(str);
}
AVSINLINE void WriteBool(const bool& val)
{
if (val)
m_oWriter.WriteString(g_bstr_boolean_true2);
else
m_oWriter.WriteString(g_bstr_boolean_false2);
}
AVSINLINE void WriteAttributeCSS(const CString& strAttributeName, const CString& val)
{
m_oWriter.WriteString(strAttributeName);
m_oWriter.AddSize(15);
m_oWriter.AddCharNoCheck(WCHAR(':'));
m_oWriter.WriteString(val);
m_oWriter.AddCharNoCheck(WCHAR(';'));
}
AVSINLINE void WriteAttributeCSS_int(const CString& strAttributeName, const int& val)
{
m_oWriter.WriteString(strAttributeName);
m_oWriter.AddSize(15);
m_oWriter.AddCharNoCheck(WCHAR(':'));
m_oWriter.AddIntNoCheck(val);
m_oWriter.AddCharNoCheck(WCHAR(';'));
}
AVSINLINE void WriteAttributeCSS_double1(const CString& strAttributeName, const double& val)
{
m_oWriter.WriteString(strAttributeName);
m_oWriter.AddSize(15);
CString s = _T("");
s.Format(_T("%.1lf"), val);
m_oWriter.AddCharNoCheck(WCHAR(':'));
m_oWriter.WriteString(s);
m_oWriter.AddCharNoCheck(WCHAR(';'));
}
AVSINLINE void WriteAttributeCSS_int_pt(const CString& strAttributeName, const int& val)
{
m_oWriter.WriteString(strAttributeName);
m_oWriter.AddSize(15);
m_oWriter.AddCharNoCheck(WCHAR(':'));
m_oWriter.AddIntNoCheck(val);
m_oWriter.AddCharNoCheck(WCHAR('p'));
m_oWriter.AddCharNoCheck(WCHAR('t'));
m_oWriter.AddCharNoCheck(WCHAR(';'));
}
AVSINLINE void WriteAttributeCSS_double1_pt(const CString& strAttributeName, const double& val)
{
m_oWriter.WriteString(strAttributeName);
m_oWriter.AddSize(20);
CString s = _T("");
s.Format(_T("%.1lf"), val);
m_oWriter.AddCharNoCheck(WCHAR(':'));
m_oWriter.WriteString(s);
m_oWriter.AddCharNoCheck(WCHAR('p'));
m_oWriter.AddCharNoCheck(WCHAR('t'));
m_oWriter.AddCharNoCheck(WCHAR(';'));
}
AVSINLINE void WriteAttribute(const CString& strAttributeName, const CString& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
m_oWriter.WriteString(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute2(const CString& strAttributeName, const CString& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
m_oWriter.WriteStringXML(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute(const CString& strAttributeName, const double& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
WriteDouble(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute(const CString& strAttributeName, const int& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
WriteINT(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute(const CString& strAttributeName, const bool& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
WriteBool(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute(const CString& strAttributeName, const LONG& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
WriteLONG(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttribute(const CString& strAttributeName, const DWORD& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
WriteDWORD(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteAttributeDWORD_hex(const CString& strAttributeName, const DWORD& val)
{
m_oWriter.WriteString(g_bstr_node_space);
m_oWriter.WriteString(strAttributeName);
m_oWriter.WriteString(g_bstr_node_equal);
m_oWriter.WriteString(g_bstr_node_quote);
WriteDWORD_hex(val);
m_oWriter.WriteString(g_bstr_node_quote);
}
AVSINLINE void WriteNodeBegin(CString strNodeName, BOOL bAttributed = FALSE)
{
m_oWriter.WriteString(g_bstr_nodeopen);
m_oWriter.WriteString(strNodeName);
if (!bAttributed)
m_oWriter.WriteString(g_bstr_nodeclose);
}
AVSINLINE void WriteNodeEnd(CString strNodeName, BOOL bEmptyNode = FALSE, BOOL bEndNode = TRUE)
{
if (bEmptyNode)
{
if (bEndNode)
m_oWriter.WriteString(g_bstr_nodeclose_slash);
else
m_oWriter.WriteString(g_bstr_nodeclose);
}
else
{
m_oWriter.WriteString(g_bstr_nodeopen_slash);
m_oWriter.WriteString(strNodeName);
m_oWriter.WriteString(g_bstr_nodeclose);
}
}
AVSINLINE void WriteNodeValue(const CString& strNodeName, const CString& val)
{
WriteNodeBegin(strNodeName);
WriteString(val);
WriteNodeEnd(strNodeName);
}
AVSINLINE void WriteNodeValue(const CString& strNodeName, const bool& val)
{
WriteNodeBegin(strNodeName);
if (val)
WriteString(_T("1"));
else
WriteString(_T("0"));
WriteNodeEnd(strNodeName);
}
AVSINLINE void WriteNodeValue(const CString& strNodeName, const double& val)
{
WriteNodeBegin(strNodeName);
WriteDouble(val);
WriteNodeEnd(strNodeName);
}
AVSINLINE void WriteNodeValue(const CString& strNodeName, const LONG& val)
{
WriteNodeBegin(strNodeName);
WriteLONG(val);
WriteNodeEnd(strNodeName);
}
AVSINLINE void WriteNodeValue(const CString& strNodeName, const int& val)
{
WriteNodeBegin(strNodeName);
WriteINT(val);
WriteNodeEnd(strNodeName);
}
AVSINLINE void WriteNodeValue(const CString& strNodeName, const DWORD& val)
{
WriteNodeBegin(strNodeName);
WriteDWORD(val);
WriteNodeEnd(strNodeName);
}
AVSINLINE void WriteNodeValueDWORD_hex(const CString& strNodeName, const DWORD& val)
{
WriteNodeBegin(strNodeName);
WriteDWORD_hex(val);
WriteNodeEnd(strNodeName);
}
BOOL SaveToFile(CString strFilePath, BOOL bEncodingToUTF8 = TRUE, BOOL bIsClearNoAttack = TRUE)
{
CString strData = m_oWriter.GetData();
if (!bEncodingToUTF8)
{
CFile oFile;
oFile.CreateFile(strFilePath);
oFile.WriteFile((void*)strData.GetBuffer(), strData.GetLength());
oFile.CloseFile();
}
else
{
CDirectory::SaveToFile(strFilePath, strData);
int nLength = strData.GetLength();
CStringA saStr;
#ifdef UNICODE
WideCharToMultiByte(CP_UTF8, 0, strData.GetBuffer(), nLength + 1, saStr.GetBuffer(nLength*3 + 1), nLength*3, NULL, NULL);
saStr.ReleaseBuffer();
#else
wchar_t* pWStr = new wchar_t[nLength + 1];
if (!pWStr)
return;
pWStr[nLength] = 0;
MultiByteToWideChar(CP_ACP, 0, strData, nLength, pWStr, nLength);
int nLengthW = (int)wcslen(pWStr);
WideCharToMultiByte(CP_UTF8, 0, pWStr, nLengthW + 1, saStr.GetBuffer(nLengthW*3 + 1), nLengthW*3, NULL, NULL);
saStr.ReleaseBuffer();
delete[] pWStr;
#endif
CFile oFile;
oFile.CreateFile(strFilePath);
CString strHead = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>");
oFile.WriteStringUTF8(strHead);
oFile.WriteFile((void*)saStr.GetBuffer(), saStr.GetLength());
oFile.CloseFile();
}
if (bIsClearNoAttack)
{
m_oWriter.ClearNoAttack();
}
return TRUE;
}
public:
AVSINLINE void WriteAttribute(const CString& strName, const nullable_int& value)
{
if (value.IsInit())
WriteAttribute(strName, *value);
}
AVSINLINE void WriteAttribute(const CString& strName, const nullable_double& value)
{
if (value.IsInit())
WriteAttribute(strName, *value);
}
AVSINLINE void WriteAttribute(const CString& strName, const nullable_string& value)
{
if (value.IsInit())
WriteAttribute(strName, *value);
}
AVSINLINE void WriteAttribute2(const CString& strName, const nullable_string& value)
{
if (value.IsInit())
WriteAttribute2(strName, *value);
}
AVSINLINE void WriteAttribute(const CString& strName, const nullable_bool& value)
{
if (value.IsInit())
WriteAttribute(strName, *value);
}
template <typename T>
AVSINLINE void WriteAttribute(const CString& strName, const nullable_limit<T>& value)
{
if (value.IsInit())
WriteAttribute(strName, (*value).get());
}
AVSINLINE void WriteNodeValue(const CString& strName, const nullable_int& value)
{
if (value.IsInit())
WriteNodeValue(strName, *value);
}
AVSINLINE void WriteNodeValue(const CString& strName, const nullable_double& value)
{
if (value.IsInit())
WriteNodeValue(strName, *value);
}
AVSINLINE void WriteNodeValue(const CString& strName, const nullable_string& value)
{
if (value.IsInit())
WriteNodeValue(strName, *value);
}
AVSINLINE void WriteNodeValue(const CString& strName, const nullable_bool& value)
{
if (value.IsInit())
WriteNodeValue(strName, *value);
}
template <typename T>
AVSINLINE void WriteNodeValue(const CString& strName, const nullable_limit<T>& value)
{
if (value.IsInit())
WriteNodeValue(strName, (*value).get);
}
AVSINLINE void StartNode(const CString& name)
{
m_oWriter.WriteString(g_bstr_nodeopen);
m_oWriter.WriteString(name);
}
AVSINLINE void StartAttributes()
{
}
AVSINLINE void EndAttributes()
{
m_oWriter.WriteString(g_bstr_nodeclose);
}
AVSINLINE void EndNode(const CString& name)
{
m_oWriter.WriteString(g_bstr_nodeopen_slash);
m_oWriter.WriteString(name);
m_oWriter.WriteString(g_bstr_nodeclose);
}
template<typename T>
AVSINLINE void WriteArray(const CString& strName, const CAtlArray<T>& arr)
{
size_t nCount = arr.GetCount();
if (0 != nCount)
{
StartNode(strName);
m_oWriter.WriteString(g_bstr_nodeclose);
for (size_t i = 0; i < nCount; ++i)
arr[i].toXmlWriter(this);
EndNode(strName);
}
}
template<typename T>
AVSINLINE void WriteArray2(const CAtlArray<T>& arr)
{
size_t nCount = arr.GetCount();
if (0 != nCount)
{
for (size_t i = 0; i < nCount; ++i)
arr[i].toXmlWriter(this);
}
}
template<typename T>
AVSINLINE void Write(const nullable<T>& val)
{
if (val.is_init())
val->toXmlWriter(this);
}
void ReplaceString(CString str1, CString str2)
{
CString sCur = m_oWriter.GetData();
sCur.Replace(str1, str2);
ClearNoAttack();
WriteString(sCur);
}
};
}

View File

@@ -0,0 +1,948 @@
/*
* (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 "CalculatorCRC32.h"
#include "../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "FontPicker.h"
using namespace NSFontCutter;
#ifndef AVSINLINE
#define AVSINLINE __forceinline
#endif
#include "../../ASCPresentationEditor/PPTXWriter/FileDownloader.h"
#include "WMFToImageConverter.h"
#include "../../Common/MediaFormatDefine.h"
namespace NSShapeImageGen
{
const long c_nMaxImageSize = 2000;
static BOOL _CopyFile(CString strExists, CString strNew, LPPROGRESS_ROUTINE lpFunc, LPVOID lpData)
{
::DeleteFile(strNew);
return ::CopyFileEx(strExists, strNew, lpFunc, lpData, FALSE, 0);
}
enum ImageType
{
itJPG = 0,
itPNG = 1,
itVIF = 2,
itWMF = 3,
itEMF = 4
};
class CImageInfo
{
public:
NSShapeImageGen::ImageType m_eType;
LONG m_lID;
bool m_bValid;
CImageInfo()
{
m_eType = itJPG;
m_lID = -1;
m_bValid = true;
}
CImageInfo(const CImageInfo& oSrc)
{
*this = oSrc;
}
CImageInfo& operator=(const CImageInfo& oSrc)
{
m_eType = oSrc.m_eType;
m_lID = oSrc.m_lID;
m_bValid = oSrc.m_bValid;
return *this;
}
AVSINLINE CString GetPath(const CString& strMedia)
{
CString strExt = _T("");
strExt.Format(_T("\\image%d.%s"), m_lID, (itJPG == m_eType) ? _T("jpg") : _T("png"));
return strMedia + strExt;
}
AVSINLINE CString GetPath2()
{
CString _strExt = _T("png");
switch (m_eType)
{
case itJPG:
_strExt = _T("jpg");
break;
case itWMF:
_strExt = _T("wmf");
break;
case itEMF:
_strExt = _T("emf");
break;
default:
break;
}
CString strExt = _T("");
strExt.Format(_T("image%d.%s"), m_lID, _strExt);
return strExt;
}
};
class CImageManager
{
public:
CAtlMap<CString, CImageInfo> m_mapImagesFile;
CAtlMap<DWORD, CImageInfo> m_mapImageData;
CAtlArray<void*> m_listDrawings;
CAtlList<CImageInfo> m_listImages;
CString m_strDstMedia;
LONG m_lMaxSizeImage;
LONG m_lNextIDImage;
CCalculatorCRC32 m_oCRC;
LONG m_lDstFormat;
#ifdef BUILD_CONFIG_FULL_VERSION
NSWMFToImageConverter::CImageExt m_oExt;
#endif
public:
CImageManager()
{
m_strDstMedia = _T("");
m_lMaxSizeImage = c_nMaxImageSize;
m_lNextIDImage = 0;
m_lDstFormat = 0;
}
AVSINLINE void NewDocument()
{
m_strDstMedia = _T("");
m_lMaxSizeImage = 800;
m_lNextIDImage = 0;
m_mapImageData.RemoveAll();
m_mapImagesFile.RemoveAll();
m_listImages.RemoveAll();
}
public:
template <typename T>
void Serialize(T* pWriter)
{
pWriter->WriteINT(m_lMaxSizeImage);
pWriter->WriteINT(m_lNextIDImage);
pWriter->WriteINT(m_lDstFormat);
pWriter->WriteString(m_strDstMedia);
int lCount = (int)m_mapImagesFile.GetCount();
pWriter->WriteINT(lCount);
POSITION pos = m_mapImagesFile.GetStartPosition();
while (NULL != pos)
{
CAtlMap<CString, CImageInfo>::CPair* pPair = m_mapImagesFile.GetNext(pos);
pWriter->WriteString(pPair->m_key);
pWriter->WriteINT((int)pPair->m_value.m_eType);
pWriter->WriteINT((int)pPair->m_value.m_lID);
pWriter->WriteBYTE(pPair->m_value.m_bValid ? 1 : 0);
}
lCount = (int)m_mapImageData.GetCount();
pWriter->WriteINT(lCount);
pos = m_mapImageData.GetStartPosition();
while (NULL != pos)
{
CAtlMap<DWORD, CImageInfo>::CPair* pPair = m_mapImageData.GetNext(pos);
pWriter->WriteULONG(pPair->m_key);
pWriter->WriteINT((int)pPair->m_value.m_eType);
pWriter->WriteINT((int)pPair->m_value.m_lID);
pWriter->WriteBYTE(pPair->m_value.m_bValid ? 1 : 0);
}
}
template <typename T>
void Deserialize(T* pReader)
{
m_lMaxSizeImage = pReader->GetLong();
m_lNextIDImage = pReader->GetLong();
m_lDstFormat = pReader->GetLong();
m_strDstMedia = pReader->GetString2();
m_mapImageData.RemoveAll();
m_mapImagesFile.RemoveAll();
LONG lCount = pReader->GetLong();
for (LONG i = 0; i < lCount; ++i)
{
CString sKey = pReader->GetString2();
CImageInfo oInfo;
oInfo.m_eType = (NSShapeImageGen::ImageType)pReader->GetLong();
oInfo.m_lID = pReader->GetLong();
oInfo.m_bValid = pReader->GetBool();
m_mapImagesFile.SetAt(sKey, oInfo);
}
lCount = pReader->GetLong();
for (LONG i = 0; i < lCount; ++i)
{
DWORD dwKey = (DWORD)pReader->GetULong();
CImageInfo oInfo;
oInfo.m_eType = (NSShapeImageGen::ImageType)pReader->GetLong();
oInfo.m_lID = pReader->GetLong();
oInfo.m_bValid = pReader->GetBool();
m_mapImageData.SetAt(dwKey, oInfo);
}
}
public:
CImageInfo WriteImage(IUnknown* punkImage, double& x, double& y, double& width, double& height)
{
CImageInfo info;
if (NULL == punkImage)
return info;
if (height < 0)
{
FlipY(punkImage);
height = -height;
y -= height;
}
return GenerateImageID(punkImage, max(1.0, width), max(1.0, height));
}
CImageInfo WriteImage(CString& strFile, double& x, double& y, double& width, double& height)
{
bool bIsDownload = false;
int n1 = strFile.Find(_T("www"));
int n2 = strFile.Find(_T("http"));
int n3 = strFile.Find(_T("ftp"));
int n4 = strFile.Find(_T("https"));
if (((n1 >= 0) && (n1 < 10)) || ((n2 >= 0) && (n2 < 10)) || ((n3 >= 0) && (n3 < 10)) || ((n4 >= 0) && (n4 < 10)))
bIsDownload = true;
if (bIsDownload)
{
CString strFile1 = strFile;
strFile1.Replace(_T("\\"), _T("/"));
strFile1.Replace(_T("http:/"), _T("http://"));
strFile1.Replace(_T("https:/"), _T("https://"));
strFile1.Replace(_T("ftp:/"), _T("ftp://"));
CImageInfo oInfo;
CAtlMap<CString, CImageInfo>::CPair* pPair = m_mapImagesFile.Lookup(strFile1);
if (pPair != NULL)
return pPair->m_value;
CString strDownload = _T("");
CFileDownloader oDownloader(strFile1, TRUE);
oDownloader.Start( 1 );
while ( oDownloader.IsRunned() )
{
::Sleep( 10 );
}
if ( oDownloader.IsFileDownloaded() )
strDownload = oDownloader.GetFilePath();
return GenerateImageID_2(strDownload, strFile1, max(1.0, width), max(1.0, height));
}
CImageInfo info;
CFile oFile;
if (S_OK != oFile.OpenFile(strFile))
return info;
oFile.CloseFile();
if (-1 == width && -1 == height)
return GenerateImageID(strFile, width, height);
return GenerateImageID(strFile, max(1.0, width), max(1.0, height));
}
protected:
inline void CopyFile(CString& strFileSrc, CString& strFileDst)
{
_CopyFile(strFileSrc, strFileDst, NULL, NULL);
}
#ifdef BUILD_CONFIG_OPENSOURCE_VERSION
static IUnknown* CreateEmptyImage(int nWidth, int nHeight, BOOL bFlipVertical = TRUE)
{
if (nWidth < 1 || nHeight < 1)
return NULL;
MediaCore::IAVSUncompressedVideoFrame* pMediaData = NULL;
CoCreateInstance(MediaCore::CLSID_CAVSUncompressedVideoFrame, NULL, CLSCTX_ALL, MediaCore::IID_IAVSUncompressedVideoFrame, (void**)(&pMediaData));
if (NULL == pMediaData)
return NULL;
if (bFlipVertical)
pMediaData->put_ColorSpace(CSP_BGRA | CSP_VFLIP);
else
pMediaData->put_ColorSpace(CSP_BGRA);
pMediaData->put_Width(nWidth);
pMediaData->put_Height(nHeight);
pMediaData->put_AspectRatioX(nWidth);
pMediaData->put_AspectRatioY(nHeight);
pMediaData->put_Interlaced(VARIANT_FALSE);
pMediaData->put_Stride(0, 4*nWidth);
pMediaData->AllocateBuffer(4*nWidth*nHeight);
BYTE* pBufferPtr = 0;
long nCreatedBufferSize = 0;
pMediaData->get_Buffer(&pBufferPtr);
pMediaData->get_BufferSize(&nCreatedBufferSize);
pMediaData->put_Plane(0, pBufferPtr);
if (!pBufferPtr || nCreatedBufferSize != 4*nWidth*nHeight)
{
RELEASEINTERFACE(pMediaData);
return NULL;
}
memset(pBufferPtr, 0xFF, nCreatedBufferSize);
IUnknown* punkInterface = NULL;
pMediaData->QueryInterface(IID_IUnknown, (void**)&punkInterface);
RELEASEINTERFACE(pMediaData);
return punkInterface;
}
void SaveImage(CString& strFileSrc, CImageInfo& oInfo, LONG __width, LONG __height)
{
OfficeCore::IImageGdipFilePtr pImageFile;
pImageFile.CreateInstance(OfficeCore::CLSID_CImageGdipFile);
BSTR bsSrc = strFileSrc.AllocSysString();
pImageFile->OpenFile(bsSrc);
SysFreeString(bsSrc);
IUnknown* punkFrame = NULL;
pImageFile->get_Frame(&punkFrame);
if (NULL == punkFrame)
punkFrame = CreateEmptyImage(10, 10);
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkFrame->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
RELEASEINTERFACE(punkFrame);
LONG lWidth = 0;
LONG lHeight = 0;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
oInfo.m_eType = GetImageType(pFrame);
RELEASEINTERFACE(pFrame);
LONG lMaxSize = min(max(lWidth, lHeight), m_lMaxSizeImage);
if ((lWidth > lMaxSize) || (lHeight > lMaxSize))
{
LONG lW = 0;
LONG lH = 0;
double dAspect = (double)lWidth / lHeight;
if (lWidth >= lHeight)
{
lW = lMaxSize;
lH = (LONG)((double)lW / dAspect);
}
else
{
lH = lMaxSize;
lW = (LONG)(dAspect * lH);
}
pImageFile->Resize(lW, lH, 3);
}
LONG lSaveType = 4;
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
if (itJPG == oInfo.m_eType)
{
strSaveItem = m_strDstMedia + strSaveItem + _T("jpg");
lSaveType = 3;
}
else
{
strSaveItem = m_strDstMedia + strSaveItem + _T("png");
}
BSTR bsDst = strSaveItem.AllocSysString();
pImageFile->SaveFile(bsDst, lSaveType);
SysFreeString(bsDst);
}
void SaveImage(IUnknown* punkImage, CImageInfo& oInfo, LONG __width, LONG __height)
{
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkImage->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
if (NULL == pFrame)
return;
LONG lWidth = 0;
LONG lHeight = 0;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
oInfo.m_eType = GetImageType(pFrame);
RELEASEINTERFACE(pFrame);
OfficeCore::IImageGdipFilePtr pImageFile;
pImageFile.CreateInstance(OfficeCore::CLSID_CImageGdipFile);
pImageFile->put_Frame(punkImage);
LONG lMaxSize = min(max(lWidth, lHeight), m_lMaxSizeImage);
if ((lWidth > lMaxSize) || (lHeight > lMaxSize))
{
LONG lW = 0;
LONG lH = 0;
double dAspect = (double)lWidth / lHeight;
if (lWidth >= lHeight)
{
lW = lMaxSize;
lH = (LONG)((double)lW / dAspect);
}
else
{
lH = lMaxSize;
lW = (LONG)(dAspect * lH);
}
pImageFile->Resize(lW, lH, 3);
}
LONG lSaveType = 4;
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
if (itJPG == oInfo.m_eType)
{
strSaveItem = m_strDstMedia + strSaveItem + _T("jpg");
lSaveType = 3;
}
else
{
strSaveItem = m_strDstMedia + strSaveItem + _T("png");
}
BSTR bsDst = strSaveItem.AllocSysString();
pImageFile->SaveFile(bsDst, lSaveType);
SysFreeString(bsDst);
}
#else
void SaveImage(CString& strFileSrc, CImageInfo& oInfo, LONG __width, LONG __height)
{
CString strLoadXml = _T("<transforms><ImageFile-LoadImage sourcepath=\"") + strFileSrc + _T("\"/></transforms>");
ImageStudio::IImageTransforms* pTransform = NULL;
CoCreateInstance(ImageStudio::CLSID_ImageTransforms, NULL, CLSCTX_INPROC_SERVER, ImageStudio::IID_IImageTransforms, (void**)&pTransform);
VARIANT_BOOL vbRes = VARIANT_FALSE;
BSTR bsLoad = strLoadXml.AllocSysString();
pTransform->SetXml(bsLoad, &vbRes);
SysFreeString(bsLoad);
pTransform->Transform(&vbRes);
VARIANT var;
var.punkVal = NULL;
pTransform->GetResult(0, &var);
if (NULL == var.punkVal)
{
RELEASEINTERFACE(pTransform);
return;
}
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
var.punkVal->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
RELEASEINTERFACE((var.punkVal));
if (NULL == pFrame)
{
RELEASEINTERFACE(pTransform);
return;
}
LONG lWidth = 0;
LONG lHeight = 0;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
oInfo.m_eType = GetImageType(pFrame);
RELEASEINTERFACE(pFrame);
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
if (itJPG == oInfo.m_eType)
{
strSaveItem = _T("<ImageFile-SaveAsJpeg destinationpath=\"") + m_strDstMedia + strSaveItem + _T("jpg\" format=\"888\"/>");
}
else
{
strSaveItem = _T("<ImageFile-SaveAsPng destinationpath=\"") + m_strDstMedia + strSaveItem + _T("png\" format=\"888\"/>");
}
CString strXml = _T("");
LONG lMaxSize = min(max(lWidth, lHeight), m_lMaxSizeImage);
if ((lWidth <= lMaxSize) && (lHeight <= lMaxSize))
{
strXml = _T("<transforms>") + strSaveItem + _T("</transforms>");
}
else
{
LONG lW = 0;
LONG lH = 0;
double dAspect = (double)lWidth / lHeight;
if (lWidth >= lHeight)
{
lW = lMaxSize;
lH = (LONG)((double)lW / dAspect);
}
else
{
lH = lMaxSize;
lW = (LONG)(dAspect * lH);
}
CString strResize = _T("");
strResize.Format(_T("<ImageTransform-TransformResize type=\"65536\" width=\"%d\" height=\"%d\"/>"), lW, lH);
strXml = _T("<transforms>") + strResize + strSaveItem + _T("</transforms>");
}
VARIANT_BOOL vbSuccess = VARIANT_FALSE;
BSTR bsXml = strXml.AllocSysString();
pTransform->SetXml(bsXml, &vbSuccess);
SysFreeString(bsXml);
pTransform->Transform(&vbSuccess);
RELEASEINTERFACE(pTransform);
}
void SaveImage(IUnknown* punkImage, CImageInfo& oInfo, LONG __width, LONG __height)
{
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkImage->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
if (NULL == pFrame)
return;
LONG lWidth = 0;
LONG lHeight = 0;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
oInfo.m_eType = GetImageType(pFrame);
RELEASEINTERFACE(pFrame);
ImageStudio::IImageTransforms* pTransform = NULL;
CoCreateInstance(ImageStudio::CLSID_ImageTransforms, NULL ,CLSCTX_INPROC_SERVER, ImageStudio::IID_IImageTransforms, (void**)&pTransform);
VARIANT var;
var.vt = VT_UNKNOWN;
var.punkVal = punkImage;
pTransform->SetSource(0, var);
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
if (itJPG == oInfo.m_eType)
{
strSaveItem = _T("<ImageFile-SaveAsJpeg destinationpath=\"") + m_strDstMedia + strSaveItem + _T("jpg\" format=\"888\"/>");
}
else
{
strSaveItem = _T("<ImageFile-SaveAsPng destinationpath=\"") + m_strDstMedia + strSaveItem + _T("png\" format=\"888\"/>");
}
LONG lMaxSize = min(max(__width, __height), m_lMaxSizeImage);
CString strXml = _T("");
if ((lWidth <= lMaxSize) && (lHeight <= lMaxSize))
{
strXml = _T("<transforms>") + strSaveItem + _T("</transforms>");
}
else
{
LONG lW = 0;
LONG lH = 0;
double dAspect = (double)lWidth / lHeight;
if (lWidth >= lHeight)
{
lW = lMaxSize;
lH = (LONG)((double)lW / dAspect);
}
else
{
lH = lMaxSize;
lW = (LONG)(dAspect * lH);
}
CString strResize = _T("");
strResize.Format(_T("<ImageTransform-TransformResize type=\"65536\" width=\"%d\" height=\"%d\"/>"), lW, lH);
strXml = _T("<transforms>") + strResize + strSaveItem + _T("</transforms>");
}
VARIANT_BOOL vbSuccess = VARIANT_FALSE;
BSTR bsXml = strXml.AllocSysString();
pTransform->SetXml(bsXml, &vbSuccess);
SysFreeString(bsXml);
pTransform->Transform(&vbSuccess);
RELEASEINTERFACE(pTransform);
}
#endif
CImageInfo GenerateImageID(IUnknown* punkData, double dWidth, double dHeight)
{
CImageInfo oInfo;
if (NULL == punkData)
return oInfo;
LONG lWidth = (LONG)(dWidth * 96 / 25.4);
LONG lHeight = (LONG)(dHeight * 96 / 25.4);
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkData->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
BYTE* pBuffer = NULL;
LONG lLen = 0;
pFrame->get_Buffer(&pBuffer);
pFrame->get_BufferSize(&lLen);
DWORD dwSum = m_oCRC.Calc(pBuffer, lLen);
CAtlMap<DWORD, CImageInfo>::CPair* pPair = m_mapImageData.Lookup(dwSum);
if (NULL == pPair)
{
++m_lNextIDImage;
oInfo.m_lID = m_lNextIDImage;
SaveImage(punkData, oInfo, lWidth, lHeight);
m_mapImageData.SetAt(dwSum, oInfo);
m_listImages.AddTail(oInfo);
}
else
{
oInfo = pPair->m_value;
}
RELEASEINTERFACE(pFrame);
return oInfo;
}
CImageInfo GenerateImageID(CString& strFileName, double dWidth, double dHeight)
{
CImageInfo oInfo;
CAtlMap<CString, CImageInfo>::CPair* pPair = m_mapImagesFile.Lookup(strFileName);
LONG lWidth = (LONG)(dWidth * 96 / 25.4);
LONG lHeight = (LONG)(dHeight * 96 / 25.4);
if (NULL == pPair)
{
#ifdef BUILD_CONFIG_FULL_VERSION
LONG lImageType = m_oExt.GetImageType(strFileName);
if (1 == lImageType || 2 == lImageType)
{
++m_lNextIDImage;
oInfo.m_lID = m_lNextIDImage;
oInfo.m_eType = (1 == lImageType) ? itWMF : itEMF;
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
strSaveItem = m_strDstMedia + strSaveItem;
double dKoef = 100 * 96 / 25.4;
bool bIsSuccess = m_oExt.Convert(strFileName, LONG(dWidth * dKoef), LONG(dHeight * dKoef), strSaveItem + _T("svg"));
if (bIsSuccess)
{
if (itWMF == lImageType)
{
CDirectory::CopyFile(strFileName, strSaveItem + _T("wmf"), NULL, NULL);
}
else
{
CDirectory::CopyFile(strFileName, strSaveItem + _T("emf"), NULL, NULL);
}
m_mapImagesFile.SetAt(strFileName, oInfo);
m_listImages.AddTail(oInfo);
return oInfo;
}
else
{
--m_lNextIDImage;
oInfo.m_eType = itJPG;
}
}
#endif
++m_lNextIDImage;
oInfo.m_lID = m_lNextIDImage;
SaveImage(strFileName, oInfo, lWidth, lHeight);
m_mapImagesFile.SetAt(strFileName, oInfo);
m_listImages.AddTail(oInfo);
}
else
{
oInfo = pPair->m_value;
}
return oInfo;
}
CImageInfo GenerateImageID_2(CString& strFileName, CString& strUrl, double dWidth, double dHeight)
{
CImageInfo oInfo;
LONG lWidth = (LONG)(dWidth * 96 / 25.4);
LONG lHeight = (LONG)(dHeight * 96 / 25.4);
#ifdef BUILD_CONFIG_FULL_VERSION
LONG lImageType = m_oExt.GetImageType(strFileName);
if (1 == lImageType || 2 == lImageType)
{
++m_lNextIDImage;
oInfo.m_lID = m_lNextIDImage;
oInfo.m_eType = (1 == lImageType) ? itWMF : itEMF;
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
strSaveItem = m_strDstMedia + strSaveItem;
double dKoef = 100 * 96 / 25.4;
bool bIsSuccess = m_oExt.Convert(strFileName, LONG(dWidth * dKoef), LONG(dHeight * dKoef), strSaveItem + _T("svg"));
if (bIsSuccess)
{
if (itWMF == lImageType)
{
CDirectory::CopyFile(strFileName, strSaveItem + _T("wmf"), NULL, NULL);
}
else
{
CDirectory::CopyFile(strFileName, strSaveItem + _T("emf"), NULL, NULL);
}
m_mapImagesFile.SetAt(strFileName, oInfo);
m_listImages.AddTail(oInfo);
return oInfo;
}
else
{
--m_lNextIDImage;
oInfo.m_eType = itJPG;
}
}
#endif
++m_lNextIDImage;
oInfo.m_lID = m_lNextIDImage;
SaveImage(strFileName, oInfo, lWidth, lHeight);
m_mapImagesFile.SetAt(strUrl, oInfo);
m_listImages.AddTail(oInfo);
return oInfo;
}
ImageType GetImageType(MediaCore::IAVSUncompressedVideoFrame* pFrame)
{
if (2 == m_lDstFormat)
return itJPG;
LONG lWidth = 0;
LONG lHeight = 0;
BYTE* pBuffer = NULL;
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
pFrame->get_Buffer(&pBuffer);
BYTE* pBufferMem = pBuffer + 3;
LONG lCountPix = lWidth * lHeight;
for (LONG i = 0; i < lCountPix; ++i, pBufferMem += 4)
{
if (255 != *pBufferMem)
return itPNG;
}
return itJPG;
}
void FlipY(IUnknown* punkImage)
{
if (NULL == punkImage)
return;
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkImage->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
if (NULL == pFrame)
return;
BYTE* pBuffer = NULL;
LONG lWidth = 0;
LONG lHeight = 0;
LONG lStride = 0;
pFrame->get_Buffer(&pBuffer);
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
pFrame->get_Stride(0, &lStride);
if (lStride < 0)
lStride = -lStride;
if ((lWidth * 4) != lStride)
{
RELEASEINTERFACE(pFrame);
return;
}
BYTE* pBufferMem = new BYTE[lStride];
BYTE* pBufferEnd = pBuffer + lStride * (lHeight - 1);
LONG lCountV = lHeight / 2;
for (LONG lIndexV = 0; lIndexV < lCountV; ++lIndexV)
{
memcpy(pBufferMem, pBuffer, lStride);
memcpy(pBuffer, pBufferEnd, lStride);
memcpy(pBufferEnd, pBufferMem, lStride);
pBuffer += lStride;
pBufferEnd -= lStride;
}
RELEASEARRAYOBJECTS(pBufferMem);
RELEASEINTERFACE(pFrame);
}
void FlipX(IUnknown* punkImage)
{
if (NULL == punkImage)
return;
MediaCore::IAVSUncompressedVideoFrame* pFrame = NULL;
punkImage->QueryInterface(MediaCore::IID_IAVSUncompressedVideoFrame, (void**)&pFrame);
if (NULL == pFrame)
return;
BYTE* pBuffer = NULL;
LONG lWidth = 0;
LONG lHeight = 0;
LONG lStride = 0;
pFrame->get_Buffer(&pBuffer);
pFrame->get_Width(&lWidth);
pFrame->get_Height(&lHeight);
pFrame->get_Stride(0, &lStride);
if (lStride < 0)
lStride = -lStride;
if ((lWidth * 4) != lStride)
{
RELEASEINTERFACE(pFrame);
return;
}
DWORD* pBufferDWORD = (DWORD*)pBuffer;
LONG lW2 = lWidth / 2;
for (LONG lIndexV = 0; lIndexV < lHeight; ++lIndexV)
{
DWORD* pMem1 = pBufferDWORD;
DWORD* pMem2 = pBufferDWORD + lWidth - 1;
LONG lI = 0;
while (lI < lW2)
{
DWORD dwMem = *pMem1;
*pMem1++ = *pMem2;
*pMem2-- = dwMem;
}
}
RELEASEINTERFACE(pFrame);
}
};
}

View File

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

View File

@@ -0,0 +1,46 @@
/*
* (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 "Settings.h"
#include <windows.h>
namespace FileSystem {
class File {
public:
static bool Exists(LPCTSTR path);
static bool Exists(const String& path);
static void Create(LPCTSTR path);
static void Create(const String& path);
};
}

View File

@@ -0,0 +1,328 @@
/*
* (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 PPTX_APP_FILE_INCLUDE_H_
#define PPTX_APP_FILE_INCLUDE_H_
#include "WrapperFile.h"
#include "Logic/PartTitle.h"
#include "Logic/HeadingVariant.h"
#include "DocxFormat/FileTypes.h"
using namespace NSBinPptxRW;
namespace PPTX
{
class App : public WrapperFile
{
public:
App()
{
}
App(const OOX::CPath& filename, FileMap& map)
{
read(filename, map);
}
virtual ~App()
{
}
public:
virtual void read(const OOX::CPath& filename, FileMap& map)
{
HeadingPairs.RemoveAll();
TitlesOfParts.RemoveAll();
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile2(filename.m_strFilename);
oNode.ReadNodeValueBase(L"Template", Template);
oNode.ReadNodeValueBase(L"TotalTime", TotalTime);
oNode.ReadNodeValueBase(L"Words", Words);
oNode.ReadNodeValueBase(L"Application", Application);
oNode.ReadNodeValueBase(L"PresentationFormat", PresentationFormat);
oNode.ReadNodeValueBase(L"Paragraphs", Paragraphs);
oNode.ReadNodeValueBase(L"Slides", Slides);
oNode.ReadNodeValueBase(L"Notes", Notes);
oNode.ReadNodeValueBase(L"HiddenSlides", HiddenSlides);
oNode.ReadNodeValueBase(L"MMClips", MMClips);
oNode.ReadNodeValueBase(L"ScaleCrop", ScaleCrop);
XmlUtils::CXmlNode oHP = oNode.ReadNode(_T("HeadingPairs"));
XmlUtils::CXmlNode oNodeVector1;
if (oHP.GetNode(_T("vt:vector"), oNodeVector1))
{
oNodeVector1.ReadAttributeBase(_T("size"), m_Headings);
oNodeVector1.LoadArray(_T("vt:variant"), HeadingPairs);
}
XmlUtils::CXmlNode oTP = oNode.ReadNode(_T("TitlesOfParts"));
XmlUtils::CXmlNode oNodeVector2;
if (oTP.GetNode(_T("vt:vector"), oNodeVector2))
{
oNodeVector2.ReadAttributeBase(_T("size"), m_VectorSize);
oNodeVector2.LoadArray(_T("vt:variant"), TitlesOfParts);
}
oNode.ReadNodeValueBase(L"Company", Company);
oNode.ReadNodeValueBase(L"LinksUpToDate", LinksUpToDate);
oNode.ReadNodeValueBase(L"SharedDoc", SharedDoc);
oNode.ReadNodeValueBase(L"HyperlinksChanged", HyperlinksChanged);
oNode.ReadNodeValueBase(L"AppVersion", AppVersion);
Normalize();
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content)const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("xmlns"), OOX::g_Namespaces.xmlns.m_strLink);
oAttr.Write(_T("xmlns:vt"), OOX::g_Namespaces.vt.m_strLink);
XmlUtils::CNodeValue oValue;
oValue.Write2(_T("Template"), Template);
oValue.Write2(_T("TotalTime"), TotalTime);
oValue.Write2(_T("Words"), Words);
oValue.Write2(_T("Application"), Application);
oValue.Write2(_T("PresentationFormat"), PresentationFormat);
oValue.Write2(_T("Paragraphs"), Paragraphs);
oValue.Write2(_T("Slides"), Slides);
oValue.Write2(_T("Notes"), Notes);
oValue.Write2(_T("HiddenSlides"), HiddenSlides);
oValue.Write2(_T("MMClips"), MMClips);
oValue.Write2(_T("ScaleCrop"), ScaleCrop);
XmlUtils::CAttribute oAttr1;
oAttr1.Write(_T("size"), m_Headings);
oAttr1.Write(_T("baseType"), _T("variant"));
XmlUtils::CNodeValue oValue1;
oValue1.WriteArray(HeadingPairs);
oValue.Write2(_T("HeadingPairs"), XmlUtils::CreateNode(_T("vt:vector"), oAttr1, oValue1));
XmlUtils::CAttribute oAttr2;
oAttr2.Write(_T("size"), m_Headings);
oAttr2.Write(_T("baseType"), _T("lpstr"));
XmlUtils::CNodeValue oValue2;
oValue2.WriteArray(HeadingPairs);
oValue.Write2(_T("TitlesOfParts"), XmlUtils::CreateNode(_T("vt:vector"), oAttr2, oValue2));
oValue.Write2(_T("Company"), Company);
oValue.Write2(_T("LinksUpToDate"), LinksUpToDate);
oValue.Write2(_T("SharedDoc"), SharedDoc);
oValue.Write2(_T("HyperlinksChanged"), HyperlinksChanged);
oValue.Write2(_T("AppVersion"), AppVersion);
XmlUtils::SaveToFile(filename.m_strFilename, XmlUtils::CreateNode(_T("Properties"), oAttr, oValue));
content.registration(type().OverrideType(), directory, filename);
m_written = true;
m_WrittenFileName.m_strFilename = filename.GetFilename();
}
public:
virtual const OOX::FileType type() const
{
return OOX::FileTypes::App;
}
virtual const OOX::CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const OOX::CPath DefaultFileName() const
{
return type().DefaultFileName();
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->StartRecord(NSMainTables::App);
pWriter->WriteBYTE(g_nodeAttributeStart);
pWriter->WriteString2(0, Template);
pWriter->WriteString2(1, Application);
pWriter->WriteString2(2, PresentationFormat);
pWriter->WriteString2(3, Company);
pWriter->WriteString2(4, AppVersion);
pWriter->WriteInt2(5, TotalTime);
pWriter->WriteInt2(6, Words);
pWriter->WriteInt2(7, Paragraphs);
pWriter->WriteInt2(8, Slides);
pWriter->WriteInt2(9, Notes);
pWriter->WriteInt2(10, HiddenSlides);
pWriter->WriteInt2(11, MMClips);
pWriter->WriteBool2(12, ScaleCrop);
pWriter->WriteBool2(13, LinksUpToDate);
pWriter->WriteBool2(14, SharedDoc);
pWriter->WriteBool2(15, HyperlinksChanged);
pWriter->WriteBYTE(g_nodeAttributeEnd);
pWriter->EndRecord();
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("Properties"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns"), OOX::g_Namespaces.xmlns.m_strLink);
pWriter->WriteAttribute(_T("xmlns:vt"), OOX::g_Namespaces.vt.m_strLink);
pWriter->EndAttributes();
pWriter->WriteNodeValue(_T("Template"), Template);
pWriter->WriteNodeValue(_T("TotalTime"), TotalTime);
pWriter->WriteNodeValue(_T("Words"), Words);
pWriter->WriteNodeValue(_T("Application"), Application);
pWriter->WriteNodeValue(_T("PresentationFormat"), PresentationFormat);
pWriter->WriteNodeValue(_T("Paragraphs"), Paragraphs);
pWriter->WriteNodeValue(_T("Slides"), Slides);
pWriter->WriteNodeValue(_T("Notes"), Notes);
pWriter->WriteNodeValue(_T("HiddenSlides"), HiddenSlides);
pWriter->WriteNodeValue(_T("MMClips"), MMClips);
pWriter->WriteNodeValue(_T("ScaleCrop"), ScaleCrop);
pWriter->StartNode(_T("HeadingPairs"));
pWriter->EndAttributes();
pWriter->StartNode(_T("vt:vector"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("size"), (int)HeadingPairs.GetCount());
pWriter->WriteAttribute(_T("baseType"), (CString)_T("variant"));
pWriter->EndAttributes();
pWriter->WriteArray2(HeadingPairs);
pWriter->EndNode(_T("vt:vector"));
pWriter->EndNode(_T("HeadingPairs"));
pWriter->StartNode(_T("TitlesOfParts"));
pWriter->EndAttributes();
pWriter->StartNode(_T("vt:vector"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("size"), (int)TitlesOfParts.GetCount());
pWriter->WriteAttribute(_T("baseType"), (CString)_T("lpstr"));
pWriter->EndAttributes();
pWriter->WriteArray2(TitlesOfParts);
pWriter->EndNode(_T("vt:vector"));
pWriter->EndNode(_T("TitlesOfParts"));
pWriter->WriteNodeValue(_T("Company"), Company);
pWriter->WriteNodeValue(_T("LinksUpToDate"), LinksUpToDate);
pWriter->WriteNodeValue(_T("SharedDoc"), SharedDoc);
pWriter->WriteNodeValue(_T("HyperlinksChanged"), HyperlinksChanged);
pWriter->WriteNodeValue(_T("AppVersion"), AppVersion);
pWriter->EndNode(_T("Properties"));
}
public:
nullable_string Template;
nullable_int TotalTime;
nullable_int Words;
nullable_string Application;
nullable_string PresentationFormat;
nullable_int Paragraphs;
nullable_int Slides;
nullable_int Notes;
nullable_int HiddenSlides;
nullable_int MMClips;
nullable_bool ScaleCrop;
CAtlArray<Logic::HeadingVariant> HeadingPairs;
CAtlArray<Logic::PartTitle> TitlesOfParts;
nullable_string Company;
nullable_bool LinksUpToDate;
nullable_bool SharedDoc;
nullable_bool HyperlinksChanged;
nullable_string AppVersion;
private:
nullable_int m_VectorSize;
nullable_int m_Headings;
AVSINLINE void Normalize()
{
TotalTime.normalize_positive();
Words.normalize_positive();
Paragraphs.normalize_positive();
Slides.normalize_positive();
Notes.normalize_positive();
HiddenSlides.normalize_positive();
MMClips.normalize_positive();
m_VectorSize.normalize_positive();
m_Headings.normalize_positive();
}
};
}
#endif // PPTX_APP_FILE_INCLUDE_H_

View File

@@ -0,0 +1,250 @@
/*
* (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 PPTX_COMMENTS_COMMENTSAUTHORS_H_
#define PPTX_COMMENTS_COMMENTSAUTHORS_H_
#include "WrapperFile.h"
#include "FileContainer.h"
namespace PPTX
{
namespace Logic
{
class CommentAuthor : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(CommentAuthor)
private:
nullable_int id;
nullable_int last_idx;
nullable_int clr_idx;
nullable_string name;
nullable_string initials;
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"id", id);
node.ReadAttributeBase(L"lastIdx", last_idx);
node.ReadAttributeBase(L"clrIdx", clr_idx);
node.ReadAttributeBase(L"name", name);
node.ReadAttributeBase(L"initials", initials);
}
virtual CString toXML() const
{
return _T("");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:cmAuthor"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("id"), id);
pWriter->WriteAttribute(_T("name"), name);
pWriter->WriteAttribute(_T("initials"), initials);
pWriter->WriteAttribute(_T("lastIdx"), last_idx);
pWriter->WriteAttribute(_T("clrIdx"), clr_idx);
pWriter->EndAttributes();
pWriter->EndNode(_T("p:cmAuthor"));
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt2(0, id);
pWriter->WriteInt2(1, last_idx);
pWriter->WriteInt2(2, clr_idx);
pWriter->WriteString2(3, name);
pWriter->WriteString2(4, initials);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1);
while (true)
{
BYTE _at = pReader->GetUChar();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
id = pReader->GetLong();
break;
case 1:
last_idx = pReader->GetLong();
break;
case 2:
clr_idx = pReader->GetLong();
break;
case 3:
name = pReader->GetString2();
break;
case 4:
initials = pReader->GetString2();
break;
default:
break;
}
}
pReader->Seek(_end_rec);
}
virtual void FillParentPointersForChilds()
{
}
};
}
class Authors : public WrapperFile
{
private:
CAtlArray<PPTX::Logic::CommentAuthor> m_arAuthors;
public:
Authors()
{
}
Authors(const OOX::CPath& filename, FileMap& map)
{
read(filename, map);
}
virtual ~Authors()
{
}
public:
virtual void read(const OOX::CPath& filename, FileMap& map)
{
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile2(filename.m_strFilename);
XmlUtils::CXmlNodes oNodes;
oNode.GetNodes(_T("p:cmAuthor"), oNodes);
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oCm;
oNodes.GetAt(i, oCm);
m_arAuthors.Add();
m_arAuthors[m_arAuthors.GetCount() - 1].fromXML(oCm);
}
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content)const
{
}
public:
virtual const OOX::FileType type() const
{
return OOX::FileTypes::CommentAuthors;
}
virtual const OOX::CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const OOX::CPath DefaultFileName() const
{
return type().DefaultFileName();
}
public:
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteRecordArray(0, 0, m_arAuthors);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:cmAuthorLst"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:a"), OOX::g_Namespaces.a.m_strLink);
pWriter->WriteAttribute(_T("xmlns:r"), OOX::g_Namespaces.r.m_strLink);
pWriter->WriteAttribute(_T("xmlns:p"), OOX::g_Namespaces.p.m_strLink);
pWriter->EndAttributes();
pWriter->WriteArray2(m_arAuthors);
pWriter->EndNode(_T("p:cmAuthorLst"));
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG end = pReader->GetPos() + pReader->GetLong() + 4;
while (pReader->GetPos() < end)
{
BYTE _rec = pReader->GetUChar();
switch (_rec)
{
case 0:
{
pReader->Skip(4);
ULONG lCount = pReader->GetULong();
for (ULONG i = 0; i < lCount; ++i)
{
pReader->Skip(1);
m_arAuthors.Add();
m_arAuthors[m_arAuthors.GetCount() - 1].fromPPTY(pReader);
}
break;
}
default:
{
pReader->SkipRecord();
break;
}
}
}
pReader->Seek(end);
}
};
}
#endif // PPTX_COMMENTS_COMMENTSAUTHORS_H_

View File

@@ -0,0 +1,402 @@
/*
* (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 PPTX_COMMENTS_COMMENTS_H_
#define PPTX_COMMENTS_COMMENTS_H_
#include "WrapperFile.h"
#include "FileContainer.h"
namespace PPTX
{
namespace Logic
{
class Comment : public WrapperWritingElement
{
public:
PPTX_LOGIC_BASE(Comment)
private:
nullable_int authorId;
nullable_int idx;
nullable_string dt;
nullable_int pos_x;
nullable_int pos_y;
nullable_string text;
nullable_int parentAuthorId;
nullable_int parentCommentId;
nullable_string additional_data;
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
node.ReadAttributeBase(L"authorId", authorId);
node.ReadAttributeBase(L"dt", dt);
node.ReadAttributeBase(L"idx", idx);
XmlUtils::CXmlNode oNodePos = node.ReadNode(_T("p:pos"));
if (oNodePos.IsValid())
{
oNodePos.ReadAttributeBase(L"x", pos_x);
oNodePos.ReadAttributeBase(L"y", pos_y);
}
XmlUtils::CXmlNode oNodeText = node.ReadNode(_T("p:text"));
if (oNodeText.IsValid())
text = oNodeText.GetTextExt();
XmlUtils::CXmlNode oNodeExtLst = node.ReadNode(_T("p:extLst"));
bool bIsFound1 = false;
bool bIsFound2 = false;
if (oNodeExtLst.IsValid())
{
XmlUtils::CXmlNodes oNodesExt;
if (oNodeExtLst.GetNodes(_T("p:ext"), oNodesExt))
{
int nCountExts = oNodesExt.GetCount();
for (int nIndex = 0; nIndex < nCountExts; ++nIndex)
{
XmlUtils::CXmlNode oNodeExt;
oNodesExt.GetAt(nIndex, oNodeExt);
if (!bIsFound1)
{
XmlUtils::CXmlNode oNodeTI = oNodeExt.ReadNode(_T("p15:threadingInfo"));
if (oNodeTI.IsValid())
{
XmlUtils::CXmlNode oNodeParent = oNodeTI.ReadNode(_T("p15:parentCm"));
oNodeParent.ReadAttributeBase(L"authorId", parentAuthorId);
oNodeParent.ReadAttributeBase(L"idx", parentCommentId);
bIsFound1 = true;
}
}
if (!bIsFound2)
{
XmlUtils::CXmlNode oNodeAU = oNodeExt.ReadNode(_T("p15:presenceInfo"));
if (oNodeAU.IsValid())
{
CString strData = oNodeAU.GetAttribute(_T("userId"));
strData.Replace(_T("&amp;"), _T("&"));
strData.Replace(_T("&apos;"), _T("'"));
strData.Replace(_T("&lt;"), _T("<"));
strData.Replace(_T("&gt;"), _T(">"));
strData.Replace(_T("&quot;"), _T("\""));
if (_T("") != strData)
additional_data = strData;
bIsFound2 = true;
}
}
}
}
XmlUtils::CXmlNode oNodeExt = oNodeExtLst.ReadNode(_T("p:ext"));
if (oNodeExt.IsValid())
{
XmlUtils::CXmlNode oNodeTI = oNodeExt.ReadNode(_T("p15:threadingInfo"));
if (oNodeTI.IsValid())
{
XmlUtils::CXmlNode oNodeParent = oNodeTI.ReadNode(_T("p15:parentCm"));
oNodeParent.ReadAttributeBase(L"authorId", parentAuthorId);
oNodeParent.ReadAttributeBase(L"idx", parentCommentId);
}
}
}
}
virtual CString toXML() const
{
return _T("");
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:cm"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("authorId"), authorId);
pWriter->WriteAttribute(_T("dt"), dt);
pWriter->WriteAttribute(_T("idx"), idx);
pWriter->EndAttributes();
if (pos_x.is_init() && pos_y.is_init())
{
CString sPos = _T("");
sPos.Format(_T("<p:pos x=\"%d\" y=\"%d\"/>"), *pos_x, *pos_y);
pWriter->WriteString(sPos);
}
if (text.is_init())
{
pWriter->WriteString(_T("<p:text>"));
pWriter->WriteString(*text);
pWriter->WriteString(_T("</p:text>"));
}
bool bIsExtLst = false;
if ((parentAuthorId.is_init() && parentCommentId.is_init()) || additional_data.is_init())
bIsExtLst = true;
if (bIsExtLst)
pWriter->WriteString(_T("<p:extLst>"));
if (parentAuthorId.is_init() && parentCommentId.is_init())
{
pWriter->WriteString(_T("<p:ext uri=\"{C676402C-5697-4E1C-873F-D02D1690AC5C}\">\
<p15:threadingInfo xmlns:p15=\"http://schemas.microsoft.com/office/powerpoint/2012/main\" timeZoneBias=\"-240\">"));
CString sPos = _T("");
sPos.Format(_T("<p15:parentCm authorId=\"%d\" idx=\"%d\"/>"), *parentAuthorId, *parentCommentId);
pWriter->WriteString(sPos);
pWriter->WriteString(_T("</p15:threadingInfo></p:ext>"));
}
if (additional_data.is_init())
{
pWriter->WriteString(_T("<p:ext uri=\"{19B8F6BF-5375-455C-9EA6-DF929625EA0E}\">\
<p15:presenceInfo xmlns:p15=\"http://schemas.microsoft.com/office/powerpoint/2012/main\" userId=\""));
CString strData = additional_data.get();
strData.Replace ( _T("&"), _T("&amp;") );
strData.Replace ( _T("'"), _T("&apos;") );
strData.Replace ( _T("<"), _T("&lt;") );
strData.Replace ( _T(">"), _T("&gt;") );
strData.Replace ( _T("\""), _T("&quot;") );
pWriter->WriteString(strData);
pWriter->WriteString(_T("\" providerId=\"AD\"/></p:ext>"));
}
if (bIsExtLst)
pWriter->WriteString(_T("</p:extLst>"));
pWriter->EndNode(_T("p:cm"));
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteInt2(0, authorId);
pWriter->WriteString2(1, dt);
pWriter->WriteInt2(2, idx);
pWriter->WriteInt2(3, pos_x);
pWriter->WriteInt2(4, pos_y);
pWriter->WriteString2(5, text);
pWriter->WriteInt2(6, parentAuthorId);
pWriter->WriteInt2(7, parentCommentId);
pWriter->WriteString2(8, additional_data);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1);
while (true)
{
BYTE _at = pReader->GetUChar();
if (_at == NSBinPptxRW::g_nodeAttributeEnd)
break;
switch (_at)
{
case 0:
authorId = pReader->GetLong();
break;
case 1:
dt = pReader->GetString2();
break;
case 2:
idx = pReader->GetLong();
break;
case 3:
pos_x = pReader->GetLong();
break;
case 4:
pos_y = pReader->GetLong();
break;
case 5:
text = pReader->GetString2();
break;
case 6:
parentAuthorId = pReader->GetLong();
break;
case 7:
parentCommentId = pReader->GetLong();
break;
case 8:
additional_data = pReader->GetString2();
default:
break;
}
}
pReader->Seek(_end_rec);
}
virtual void FillParentPointersForChilds()
{
}
};
}
class Comments : public WrapperFile
{
private:
CAtlArray<PPTX::Logic::Comment> m_arComments;
public:
Comments()
{
}
Comments(const OOX::CPath& filename, FileMap& map)
{
read(filename, map);
}
virtual ~Comments()
{
}
public:
virtual void read(const OOX::CPath& filename, FileMap& map)
{
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile2(filename.m_strFilename);
XmlUtils::CXmlNodes oNodes;
oNode.GetNodes(_T("p:cm"), oNodes);
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oCm;
oNodes.GetAt(i, oCm);
m_arComments.Add();
m_arComments[m_arComments.GetCount() - 1].fromXML(oCm);
}
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content)const
{
}
public:
virtual const OOX::FileType type() const
{
return OOX::FileTypes::SlideComments;
}
virtual const OOX::CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const OOX::CPath DefaultFileName() const
{
return type().DefaultFileName();
}
public:
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteRecordArray(0, 0, m_arComments);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("p:cmLst"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:a"), OOX::g_Namespaces.a.m_strLink);
pWriter->WriteAttribute(_T("xmlns:r"), OOX::g_Namespaces.r.m_strLink);
pWriter->WriteAttribute(_T("xmlns:p"), OOX::g_Namespaces.p.m_strLink);
pWriter->EndAttributes();
pWriter->WriteArray2(m_arComments);
pWriter->EndNode(_T("p:cmLst"));
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG end = pReader->GetPos() + pReader->GetLong() + 4;
while (pReader->GetPos() < end)
{
BYTE _rec = pReader->GetUChar();
switch (_rec)
{
case 0:
{
pReader->Skip(4);
ULONG lCount = pReader->GetULong();
for (ULONG i = 0; i < lCount; ++i)
{
pReader->Skip(1);
m_arComments.Add();
m_arComments[m_arComments.GetCount() - 1].fromPPTY(pReader);
}
break;
}
default:
{
pReader->SkipRecord();
break;
}
}
}
pReader->Seek(end);
}
};
}
#endif // PPTX_COMMENTS_COMMENTS_H_

View File

@@ -0,0 +1,179 @@
/*
* (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 PPTX_CORE_FILE_INCLUDE_H_
#define PPTX_CORE_FILE_INCLUDE_H_
#include "WrapperFile.h"
#include "DocxFormat/WritingElement.h"
#include "Limit/ContentStatus.h"
#include "DocxFormat/FileTypes.h"
using namespace NSBinPptxRW;
namespace PPTX
{
class Core : public WrapperFile
{
public:
Core()
{
}
Core(const OOX::CPath& filename, FileMap& map)
{
read(filename, map);
}
virtual ~Core()
{
}
public:
virtual void read(const OOX::CPath& filename, FileMap& map)
{
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile2(filename.m_strFilename);
oNode.ReadNodeValueBase(_T("dc:title"), title);
oNode.ReadNodeValueBase(_T("dc:creator"), creator);
oNode.ReadNodeValueBase(_T("cp:lastModifiedBy"), lastModifiedBy);
oNode.ReadNodeValueBase(_T("cp:revision"), revision);
oNode.ReadNodeValueBase(_T("dcterms:modified"), modified);
oNode.ReadNodeValueBase(_T("dcterms:created"), created);
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content)const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("xmlns:dc"), OOX::g_Namespaces.dc.m_strLink);
oAttr.Write(_T("xmlns:dcterms"), OOX::g_Namespaces.dcterms.m_strLink);
oAttr.Write(_T("xmlns:xsi"), OOX::g_Namespaces.xsi.m_strLink);
XmlUtils::CNodeValue oValue;
oValue.Write2(_T("dc:title"), title);
oValue.Write2(_T("dc:creator"), creator);
oValue.Write2(_T("cp:lastModifiedBy"), lastModifiedBy);
oValue.Write2(_T("cp:revision"), revision);
if (created.IsInit())
{
oValue.m_strValue += _T("<dcterms:created xsi:type=\"dcterms:W3CDTF\">");
oValue.m_strValue += *created;
oValue.m_strValue += _T("</dcterms:created>");
}
oValue.m_strValue += _T("<dcterms:modified xsi:type=\"dcterms:W3CDTF\">");
if (modified.IsInit())
oValue.m_strValue += *modified;
oValue.m_strValue += _T("</dcterms:modified>");
XmlUtils::SaveToFile(filename.m_strFilename, XmlUtils::CreateNode(_T("cp:coreProperties"), oAttr, oValue));
content.registration(type().OverrideType(), directory, filename);
m_written = true;
m_WrittenFileName = filename.GetFilename();
}
public:
virtual const OOX::FileType type() const
{
return OOX::FileTypes::Core;
}
virtual const OOX::CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const OOX::CPath DefaultFileName() const
{
return type().DefaultFileName();
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->StartRecord(NSMainTables::Core);
pWriter->WriteBYTE(g_nodeAttributeStart);
pWriter->WriteString2(0, title);
pWriter->WriteString2(1, creator);
pWriter->WriteString2(2, lastModifiedBy);
pWriter->WriteString2(3, revision);
pWriter->WriteString2(4, created);
pWriter->WriteString2(5, modified);
pWriter->WriteBYTE(g_nodeAttributeEnd);
pWriter->EndRecord();
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(_T("cp:coreProperties"));
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("xmlns:cp"), OOX::g_Namespaces.cp.m_strLink);
pWriter->WriteAttribute(_T("xmlns:dc"), OOX::g_Namespaces.dc.m_strLink);
pWriter->WriteAttribute(_T("xmlns:dcterms"), OOX::g_Namespaces.dcterms.m_strLink);
pWriter->WriteAttribute(_T("xmlns:xsi"), OOX::g_Namespaces.xsi.m_strLink);
pWriter->EndAttributes();
pWriter->WriteNodeValue(_T("dc:title"), title);
pWriter->WriteNodeValue(_T("dc:creator"), creator);
pWriter->WriteNodeValue(_T("cp:lastModifiedBy"), lastModifiedBy);
pWriter->WriteNodeValue(_T("cp:revision"), revision);
pWriter->WriteNodeValue(_T("dcterms:created xsi:type=\"dcterms:W3CDTF\""), created);
pWriter->WriteNodeValue(_T("dcterms:modified xsi:type=\"dcterms:W3CDTF\""), modified);
pWriter->EndNode(_T("cp:coreProperties"));
}
public:
nullable_string title;
nullable_string creator;
nullable_string lastModifiedBy;
nullable_string revision;
nullable_string created;
nullable_string modified;
};
}
#endif // PPTX_CORE_FILE_INCLUDE_H_

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,229 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "./stdafx.h"
#include "FileContainer.h"
#include "DocxFormat/Rels/File.h"
#include "FileFactory.h"
#include "DocxFormat/ContentTypes/File.h"
#include "DocxFormat/FileType.h"
#include "DocxFormat/FileTypes.h"
#include "DocxFormat/External/Hyperlink.h"
#include "WrapperFile.h"
namespace PPTX
{
void FileContainer::read(const OOX::CPath& filename)
{
}
void FileContainer::read(const OOX::Rels::File& rels, const OOX::CPath& path)
{
}
void FileContainer::read(const OOX::CPath& filename, FileMap& map, IPPTXEvent* Event)
{
OOX::Rels::File rels(filename);
OOX::CPath path = filename.GetDirectory();
read(rels, path, map, Event);
}
void FileContainer::read(const OOX::Rels::File& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event)
{
bool bIsSlide = false;
OOX::File* pSrcFile = dynamic_cast<OOX::File*>(this);
if (NULL != pSrcFile)
bIsSlide = (pSrcFile->type() == OOX::FileTypes::Slide) ? true : false;
size_t nCount = rels.Relations.m_items.GetCount();
for (size_t i = 0; i < nCount; ++i)
{
const OOX::Rels::RelationShip* pRelation = &(rels.Relations.m_items[i]);
OOX::CPath normPath = path / pRelation->target();
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = map.find(normPath);
if (bIsSlide && (pRelation->type() == OOX::FileTypes::Slide))
{
long percent = Event->GetPercent();
smart_ptr<OOX::File> file = smart_ptr<OOX::File>(new OOX::HyperLink(pRelation->target()));
bool res = Event->Progress(0, percent + m_lPercent);
if (res)
{
m_bCancelled = true;
break;
}
add(pRelation->rId(), file);
}
else
{
if (NULL != pPair)
{
add(pRelation->rId(), pPair->m_value);
}
else
{
long percent = Event->GetPercent();
smart_ptr<OOX::File> file = PPTX::FileFactory::CreateFilePPTX(path, *pRelation, map);
bool res = Event->Progress(0, percent + m_lPercent);
if (res)
{
m_bCancelled = true;
break;
}
map.add(normPath, file);
add(pRelation->rId(), file);
smart_ptr<FileContainer> pContainer = file.smart_dynamic_cast<FileContainer>();
if (pContainer.IsInit())
{
pContainer->m_lPercent = m_lPercent;
Event->AddPercent(m_lPercent);
pContainer->read(normPath, map, Event);
m_bCancelled = pContainer->m_bCancelled;
}
}
}
}
}
void FileContainer::write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content) const
{
OOX::Rels::File rels;
OOX::CPath current = filename.GetDirectory();
write(rels, current, directory, content);
rels.write(filename);
}
void FileContainer::write(OOX::Rels::File& rels, const OOX::CPath& curdir, const OOX::CPath& directory, OOX::ContentTypes::File& content) const
{
CAtlMap<CString, size_t> namepair;
POSITION pos = m_container.GetStartPosition();
while (NULL != pos)
{
const CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = m_container.GetNext(pos);
smart_ptr<OOX::File> pFile = pPair->m_value;
smart_ptr<OOX::External> pExt = pFile.smart_dynamic_cast<OOX::External>();
if (!pExt.IsInit())
{
smart_ptr<PPTX::WrapperFile> file = pFile.smart_dynamic_cast<PPTX::WrapperFile>();
if (file.IsInit())
{
if (file->GetWrittenStatus() == false)
{
OOX::CPath defdir = pFile->DefaultDirectory();
OOX::CPath name = pFile->DefaultFileName();
OOX::CSystemUtility::CreateDirectories(directory / defdir);
pFile->write(directory / defdir / name, directory, content);
rels.registration(pPair->m_key, pFile->type(), defdir / name);
}
else
{
OOX::CPath defdir = pFile->DefaultDirectory();
OOX::CPath name = file->GetWrittenFileName();
rels.registration(pPair->m_key, pFile->type(), defdir / name);
}
}
else
{
OOX::CPath defdir = pFile->DefaultDirectory();
OOX::CPath name = pFile->DefaultFileName();
OOX::CSystemUtility::CreateDirectories(directory / defdir);
pFile->write(directory / defdir / name, directory, content);
rels.registration(pPair->m_key, pFile->type(), defdir / name);
}
}
else
{
rels.registration(pPair->m_key, pExt);
}
}
}
void FileContainer::WrittenSetFalse()
{
POSITION pos = m_container.GetStartPosition();
while (NULL != pos)
{
smart_ptr<OOX::File> pFile = m_container.GetNextValue(pos);
smart_ptr<PPTX::WrapperFile> pWrapFile = pFile.smart_dynamic_cast<PPTX::WrapperFile>();
smart_ptr<PPTX::FileContainer> pWrapCont = pFile.smart_dynamic_cast<PPTX::FileContainer>();
if (pWrapFile.is_init() && !pWrapFile->GetWrittenStatus())
{
pWrapFile->WrittenSetFalse();
if (pWrapCont.is_init())
{
pWrapCont->WrittenSetFalse();
}
}
}
}
void CCommonRels::_read(const OOX::Rels::File& rels, const OOX::CPath& path)
{
size_t nCount = rels.Relations.m_items.GetCount();
for (size_t i = 0; i < nCount; ++i)
{
const OOX::Rels::RelationShip* pRelation = &(rels.Relations.m_items[i]);
smart_ptr<OOX::File> _file = PPTX::FileFactory::CreateFilePPTX_OnlyMedia(path, *pRelation);
add(pRelation->rId(), _file);
}
}
void CCommonRels::_read(const OOX::CPath& filename)
{
OOX::Rels::File rels(filename);
OOX::CPath path = filename.GetDirectory();
_read(rels, path);
}
} // namespace PPTX

View File

@@ -0,0 +1,80 @@
/*
* (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 PPTX_IFILE_CONTAINER_INCLUDE_H_
#define PPTX_IFILE_CONTAINER_INCLUDE_H_
#include "DocxFormat/IFileContainer.h"
#include "FileMap.h"
#include "PPTXEvent.h"
namespace PPTX
{
class FileContainer : public OOX::IFileContainer
{
public:
FileContainer()
{
m_lPercent = 0;
m_bCancelled = false;
}
virtual ~FileContainer()
{
}
protected:
void read(const OOX::CPath& filename);
void read(const OOX::Rels::File& rels, const OOX::CPath& path);
void read(const OOX::CPath& filename, FileMap& map, IPPTXEvent* Event);
void read(const OOX::Rels::File& rels, const OOX::CPath& path, FileMap& map, IPPTXEvent* Event);
void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content) const;
void write(OOX::Rels::File& rels, const OOX::CPath& current, const OOX::CPath& directory, OOX::ContentTypes::File& content) const;
void WrittenSetFalse();
long m_lPercent;
bool m_bCancelled;
};
class CCommonRels : public PPTX::FileContainer
{
public:
CCommonRels() : PPTX::FileContainer()
{
}
void _read(const OOX::CPath& filename);
void _read(const OOX::Rels::File& rels, const OOX::CPath& path);
};
}
#endif // PPTX_IFILE_CONTAINER_INCLUDE_H_

View File

@@ -0,0 +1,158 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "./stdafx.h"
#include "FileFactory.h"
#include "DocxFormat/File.h"
#include "DocxFormat/FileTypes.h"
#include "DocxFormat/Rels/RelationShip.h"
#include "App.h"
#include "Core.h"
#include "Theme.h"
#include "HandoutMaster.h"
#include "Presentation.h"
#include "PresProps.h"
#include "SlideLayout.h"
#include "SlideMaster.h"
#include "Slide.h"
#include "CommentAuthors.h"
#include "Comments.h"
#include "TableStyles.h"
#include "ViewProps.h"
#include "NotesSlide.h"
#include "NotesMaster.h"
#include "DocxFormat/Media/Image.h"
#include "DocxFormat/Media/Audio.h"
#include "DocxFormat/Media/Video.h"
#include "DocxFormat/External/HyperLink.h"
#include "DocxFormat/External/ExternalImage.h"
#include "DocxFormat/External/ExternalAudio.h"
#include "DocxFormat/External/ExternalVideo.h"
#include "VmlDrawing.h"
#include "DocxFormat/UnknowTypeFile.h"
#include "FileMap.h"
namespace PPTX
{
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX(const OOX::CPath& path, const OOX::Rels::RelationShip& relation, FileMap& map)
{
OOX::CPath filename = path / relation.filename();
if (relation.type() == OOX::FileTypes::App)
return smart_ptr<OOX::File>(new PPTX::App(filename, map));
else if (relation.type() == OOX::FileTypes::Core)
return smart_ptr<OOX::File>(new PPTX::Core(filename, map));
else if (relation.type() == OOX::FileTypes::Presentation)
return smart_ptr<OOX::File>(new PPTX::Presentation(filename, map));
else if (relation.type() == OOX::FileTypes::Theme)
return smart_ptr<OOX::File>(new PPTX::Theme(filename, map));
else if (relation.type() == OOX::FileTypes::SlideMaster)
return smart_ptr<OOX::File>(new PPTX::SlideMaster(filename, map));
else if (relation.type() == OOX::FileTypes::SlideLayout)
return smart_ptr<OOX::File>(new PPTX::SlideLayout(filename, map));
else if (relation.type() == OOX::FileTypes::Slide)
return smart_ptr<OOX::File>(new PPTX::Slide(filename, map));
else if (relation.type() == OOX::FileTypes::HandoutMaster)
return smart_ptr<OOX::File>(new PPTX::HandoutMaster(filename, map));
else if (relation.type() == OOX::FileTypes::NotesMaster)
return smart_ptr<OOX::File>(new PPTX::NotesMaster(filename, map));
else if (relation.type() == OOX::FileTypes::NotesSlide)
return smart_ptr<OOX::File>(new PPTX::NotesSlide(filename, map));
else if (relation.type() == OOX::FileTypes::PresProps)
return smart_ptr<OOX::File>(new PPTX::PresProps(filename, map));
else if (relation.type() == OOX::FileTypes::ViewProps)
return smart_ptr<OOX::File>(new PPTX::ViewProps(filename, map));
else if (relation.type() == OOX::FileTypes::TableStyles)
return smart_ptr<OOX::File>(new PPTX::TableStyles(filename, map));
else if (relation.type() == OOX::FileTypes::VmlDrawing)
return smart_ptr<OOX::File>(new PPTX::VmlDrawing(filename, map));
else if (relation.type() == OOX::FileTypes::HyperLink)
return smart_ptr<OOX::File>(new OOX::HyperLink(relation.target()));
else if ((relation.type() == OOX::FileTypes::ExternalImage) && (relation.isExternal()))
return smart_ptr<OOX::File>(new OOX::ExternalImage(relation.target()));
else if ((relation.type() == OOX::FileTypes::ExternalAudio) && (relation.isExternal()))
return smart_ptr<OOX::File>(new OOX::ExternalAudio(relation.target()));
else if ((relation.type() == OOX::FileTypes::ExternalVideo) && (relation.isExternal()))
return smart_ptr<OOX::File>(new OOX::ExternalVideo(relation.target()));
else if (relation.type() == OOX::FileTypes::Image)
return smart_ptr<OOX::File>(new OOX::Image(filename));
else if (relation.type() == OOX::FileTypes::Audio)
return smart_ptr<OOX::File>(new OOX::Audio(filename));
else if (relation.type() == OOX::FileTypes::Video)
return smart_ptr<OOX::File>(new OOX::Video(filename));
else if (relation.type() == OOX::FileTypes::Media)
return smart_ptr<OOX::File>(new OOX::HyperLink(filename));
else if (relation.type() == OOX::FileTypes::Data)
return smart_ptr<OOX::File>(new OOX::Image(filename));
else if (relation.type() == OOX::FileTypes::DrawingDiag)
return smart_ptr<OOX::File>(new OOX::Image(filename));
else if (relation.type() == OOX::FileTypes::Chart)
return smart_ptr<OOX::File>(new OOX::Image(filename));
else if (relation.type() == OOX::FileTypes::CommentAuthors)
return smart_ptr<OOX::File>(new PPTX::Authors(filename, map));
else if (relation.type() == OOX::FileTypes::SlideComments)
return smart_ptr<OOX::File>(new PPTX::Comments(filename, map));
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
}
const smart_ptr<OOX::File> FileFactory::CreateFilePPTX_OnlyMedia(const OOX::CPath& path, const OOX::Rels::RelationShip& relation)
{
bool bIsDownload = false;
CString strFile = relation.filename().GetPath();
int n1 = strFile.Find(_T("www"));
int n2 = strFile.Find(_T("http"));
int n3 = strFile.Find(_T("ftp"));
int n4 = strFile.Find(_T("https://"));
if (((n1 >= 0) && (n1 < 10)) || ((n2 >= 0) && (n2 < 10)) || ((n3 >= 0) && (n3 < 10)) || ((n4 >= 0) && (n4 < 10)))
bIsDownload = true;
OOX::CPath filename = path / relation.filename();
if (bIsDownload)
filename = relation.filename();
CString strT = relation.type();
if (strT == OOX::FileTypes::Image ||
strT == OOX::FileTypes::Data ||
strT == OOX::FileTypes::DrawingDiag ||
strT == OOX::FileTypes::Chart)
{
return smart_ptr<OOX::File>(new OOX::Image(filename));
}
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
}
} // namespace PPTX

View File

@@ -0,0 +1,51 @@
/*
* (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 PPTX_FILE_FACTORY_INCLUDE_H_
#define PPTX_FILE_FACTORY_INCLUDE_H_
#include "DocxFormat/File.h"
namespace OOX {namespace Rels {class RelationShip;}}
namespace PPTX {class FileMap;}
namespace PPTX
{
class FileFactory
{
public:
static const smart_ptr<OOX::File> CreateFilePPTX(const OOX::CPath& path, const OOX::Rels::RelationShip& relation, FileMap& map);
static const smart_ptr<OOX::File> CreateFilePPTX_OnlyMedia(const OOX::CPath& path, const OOX::Rels::RelationShip& relation);
};
}
#endif // PPTX_FILE_FACTORY_INCLUDE_H_

View File

@@ -0,0 +1,32 @@
/*
* (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
*
*/

View File

@@ -0,0 +1,69 @@
/*
* (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 PPTX_FILEMAP_INCLUDE_H_
#define PPTX_FILEMAP_INCLUDE_H_
#include "DocxFormat/File.h"
namespace PPTX
{
class FileMap
{
public:
FileMap()
{
}
~FileMap()
{
}
public:
CAtlMap<CString, smart_ptr<OOX::File>> m_map;
public:
AVSINLINE CAtlMap<CString, smart_ptr<OOX::File>>::CPair* find(const OOX::CPath& path)
{
return m_map.Lookup(path.m_strFilename);
}
AVSINLINE void add(const OOX::CPath& key, const smart_ptr<OOX::File>& value)
{
m_map.SetAt(key.m_strFilename, value);
}
AVSINLINE bool empty() const {return m_map.IsEmpty();}
AVSINLINE size_t size() const {return m_map.GetCount();}
};
}
#endif // PPTX_FILEMAP_INCLUDE_H_

View File

@@ -0,0 +1,189 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "./stdafx.h"
#include "Folder.h"
#include "DocxFormat/Rels/File.h"
#include "FileMap.h"
#include "DocxFormat/FileTypes.h"
#include "Presentation.h"
#include "Theme.h"
#include "SlideMaster.h"
#include "SlideLayout.h"
#include "Slide.h"
#include "NotesMaster.h"
namespace PPTX
{
Folder::Folder()
{
}
Folder::Folder(const OOX::CPath& path, IPPTXEvent* Event)
{
read(path, Event);
}
void Folder::read(const OOX::CPath& path, IPPTXEvent* Event)
{
OOX::Rels::File rels(path);
PPTX::FileMap map;
long files = CountFiles(path);
if(files == 0)
return;
m_lPercent = 1000000 / files;
FileContainer::read(rels, path, map, Event);
if(m_bCancelled)
return;
POSITION pos = NULL;
smart_ptr<PPTX::Presentation> _presentation = FileContainer::get(OOX::FileTypes::Presentation).smart_dynamic_cast<PPTX::Presentation>();
if (_presentation.is_init())
{
_presentation->commentAuthors = _presentation->get(OOX::FileTypes::CommentAuthors).smart_dynamic_cast<PPTX::Authors>();
}
pos = map.m_map.GetStartPosition();
while (NULL != pos)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = map.m_map.GetNext(pos);
const OOX::FileType& curType = pPair->m_value->type();
if (OOX::FileTypes::ThemePPTX == curType)
{
smart_ptr<PPTX::Theme> pTheme = pPair->m_value.smart_dynamic_cast<PPTX::Theme>();
if (pTheme.IsInit())
pTheme->Presentation = _presentation;
}
}
pos = map.m_map.GetStartPosition();
while (NULL != pos)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = map.m_map.GetNext(pos);
const OOX::FileType& curType = pPair->m_value->type();
if (OOX::FileTypes::SlideMaster == curType)
{
smart_ptr<PPTX::SlideMaster> pointer = pPair->m_value.smart_dynamic_cast<PPTX::SlideMaster>();
if (pointer.is_init())
pointer->ApplyRels();
}
}
pos = map.m_map.GetStartPosition();
while (NULL != pos)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = map.m_map.GetNext(pos);
const OOX::FileType& curType = pPair->m_value->type();
if (OOX::FileTypes::SlideLayout == curType)
{
smart_ptr<PPTX::SlideLayout> pointer = pPair->m_value.smart_dynamic_cast<PPTX::SlideLayout>();
if (pointer.is_init())
pointer->ApplyRels();
}
}
pos = map.m_map.GetStartPosition();
while (NULL != pos)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = map.m_map.GetNext(pos);
const OOX::FileType& curType = pPair->m_value->type();
if (OOX::FileTypes::Slide == curType)
{
smart_ptr<PPTX::Slide> pointer = pPair->m_value.smart_dynamic_cast<PPTX::Slide>();
if (pointer.is_init())
pointer->ApplyRels();
}
}
pos = map.m_map.GetStartPosition();
while (NULL != pos)
{
CAtlMap<CString, smart_ptr<OOX::File>>::CPair* pPair = map.m_map.GetNext(pos);
const OOX::FileType& curType = pPair->m_value->type();
if (OOX::FileTypes::NotesMaster == curType)
{
smart_ptr<PPTX::NotesMaster> pointer = pPair->m_value.smart_dynamic_cast<PPTX::NotesMaster>();
if (pointer.is_init())
pointer->ApplyRels();
}
}
Event->Progress(0, 1000000);
}
void Folder::write(const OOX::CPath& path)
{
OOX::CSystemUtility::CreateDirectories(path);
OOX::Rels::File rels;
OOX::ContentTypes::File content;
OOX::CPath dir = path;
FileContainer::write(rels, path, dir, content);
rels.write(path / _T("/"));
content.write(path);
FileContainer::WrittenSetFalse();
}
void Folder::createFromTemplate(const OOX::CPath& path)
{
}
const bool Folder::isValid(const OOX::CPath& path) const
{
return true;
}
void Folder::extractPictures(const OOX::CPath& path)
{
OOX::CSystemUtility::CreateDirectories(path);
FileContainer::extractPictures(path);
}
void Folder::extractPictures(const OOX::CPath& source, const OOX::CPath& path)
{
extractPictures(path);
}
long Folder::CountFiles(const OOX::CPath& path)
{
return OOX::CSystemUtility::GetFilesCount(path.GetDirectory(), true);
}
} // namespace PPTX

View File

@@ -0,0 +1,63 @@
/*
* (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 PPTX_FOLDER_INCLUDE_H_
#define PPTX_FOLDER_INCLUDE_H_
#include "FileContainer.h"
#include "DocxFormat/RId.h"
namespace PPTX
{
class Folder : public PPTX::FileContainer
{
public:
Folder();
Folder(const OOX::CPath& path, IPPTXEvent* Event);
public:
void read(const OOX::CPath& path, IPPTXEvent* Event);
void write(const OOX::CPath& path);
void createFromTemplate(const OOX::CPath& path);
public:
const bool isValid(const OOX::CPath& path) const;
public:
void extractPictures(const OOX::CPath& path);
void extractPictures(const OOX::CPath& source, const OOX::CPath& path);
private:
long CountFiles(const OOX::CPath& path);
};
}
#endif //PPTX_FOLDER_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 PPTX_SLIDES_HANDOUTMASTER_INCLUDE_H_
#define PPTX_SLIDES_HANDOUTMASTER_INCLUDE_H_
#include "WrapperFile.h"
#include "FileContainer.h"
#include "Logic/ClrMap.h"
#include "Logic/CSld.h"
#include "Logic/Hf.h"
#include "DocxFormat/FileTypes.h"
namespace PPTX
{
class HandoutMaster : public WrapperFile, public PPTX::FileContainer
{
public:
HandoutMaster()
{
}
HandoutMaster(const OOX::CPath& filename, FileMap& map)
{
read(filename, map);
}
virtual ~HandoutMaster()
{
}
public:
virtual void read(const OOX::CPath& filename, FileMap& map)
{
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile2(filename.m_strFilename);
cSld = oNode.ReadNode(_T("p:cSld"));
cSld.SetParentFilePointer(this);
clrMap = oNode.ReadNode(_T("p:clrMap"));
clrMap.SetParentFilePointer(this);
hf = oNode.ReadNode(_T("p:hf"));
if (hf.is_init())
hf->SetParentFilePointer(this);
}
virtual void write(const OOX::CPath& filename, const OOX::CPath& directory, OOX::ContentTypes::File& content)const
{
XmlUtils::CAttribute oAttr;
oAttr.Write(_T("xmlns:a"), OOX::g_Namespaces.a.m_strLink);
oAttr.Write(_T("xmlns:r"), OOX::g_Namespaces.r.m_strLink);
XmlUtils::CNodeValue oValue;
oValue.Write(cSld);
oValue.Write(clrMap);
oValue.WriteNullable(hf);
XmlUtils::SaveToFile(filename.m_strFilename, XmlUtils::CreateNode(_T("p:handoutMaster"), oAttr, oValue));
content.registration(type().OverrideType(), directory, filename);
m_written = true;
m_WrittenFileName = filename.GetFilename();
FileContainer::write(filename, directory, content);
}
public:
virtual const OOX::FileType type() const
{
return OOX::FileTypes::HandoutMaster;
}
virtual const OOX::CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const OOX::CPath DefaultFileName() const
{
return type().DefaultFileName();
}
public:
Logic::CSld cSld;
Logic::ClrMap clrMap;
nullable<Logic::HF> hf;
};
}
#endif // PPTX_SLIDES_HANDOUTMASTER_INCLUDE_H_

View File

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

View File

@@ -0,0 +1,66 @@
/*
* (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 PPTX_LIMIT_ANIMATIONDGMBUILD_INCLUDE_H_
#define PPTX_LIMIT_ANIMATIONDGMBUILD_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class AnimationDgmBuild : public BaseLimit
{
public:
AnimationDgmBuild()
{
m_strValue = _T("allAtOnce");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((strValue == _T("allAtOnce")) ||
(strValue == _T("lvlAtOnce")) ||
(strValue == _T("lvlOne")) ||
(strValue == _T("one")))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_ANIMATIONDGMBUILD_INCLUDE_H_

View File

@@ -0,0 +1,122 @@
/*
* (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 PPTX_LIMIT_BWMODE_INCLUDE_H_
#define PPTX_LIMIT_BWMODE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class BWMode : public BaseLimit
{
public:
BWMode()
{
m_strValue = _T("auto");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("auto") == strValue) ||
(_T("black") == strValue) ||
(_T("blackGray") == strValue) ||
(_T("blackWhite") == strValue) ||
(_T("clr") == strValue) ||
(_T("gray") == strValue) ||
(_T("grayWhite") == strValue) ||
(_T("hidden") == strValue) ||
(_T("invGray") == strValue) ||
(_T("ltGray") == strValue) ||
(_T("white") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("auto") == m_strValue)
return 0;
if (_T("black") == m_strValue)
return 1;
if (_T("blackGray") == m_strValue)
return 2;
if (_T("blackWhite") == m_strValue)
return 3;
if (_T("clr") == m_strValue)
return 4;
if (_T("gray") == m_strValue)
return 5;
if (_T("grayWhite") == m_strValue)
return 6;
if (_T("hidden") == m_strValue)
return 7;
if (_T("invGray") == m_strValue)
return 8;
if (_T("ltGray") == m_strValue)
return 9;
if (_T("white") == m_strValue)
return 10;
return 0;
}
virtual void SetBYTECode(const BYTE& src)
{
switch (src)
{
case 0: m_strValue = _T("auto"); break;
case 1: m_strValue = _T("black"); break;
case 2: m_strValue = _T("blackGray"); break;
case 3: m_strValue = _T("blackWhite"); break;
case 4: m_strValue = _T("clr"); break;
case 5: m_strValue = _T("gray"); break;
case 6: m_strValue = _T("grayWhite"); break;
case 7: m_strValue = _T("hidden"); break;
case 8: m_strValue = _T("invGray"); break;
case 9: m_strValue = _T("ltGray"); break;
case 10: m_strValue = _T("white"); break;
default:
m_strValue = _T("auto");
break;
}
}
};
}
}
#endif // PPTX_LIMIT_BWMODE_INCLUDE_H_

View File

@@ -0,0 +1,105 @@
/*
* (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 PPTX_LIMIT_BASE_INCLUDE_H_
#define PPTX_LIMIT_BASE_INCLUDE_H_
#include "../../../Common/DocxFormat/Source/Base/Base.h"
#define _USE_STRING_OPERATOR \
virtual void operator=(const CString& value) \
{ \
set(value); \
} \
virtual void operator=(const BSTR& value) \
{ \
set((CString)value); \
}
namespace PPTX
{
namespace Limit
{
class BaseLimit
{
public:
BaseLimit(const CString& str = _T("")) : m_strValue(str)
{
}
BaseLimit(const BaseLimit& oSrc)
{
*this = oSrc;
}
BaseLimit& operator=(const BaseLimit& oSrc)
{
m_strValue = oSrc.m_strValue;
return *this;
}
void operator=(const CString& str)
{
set(str);
}
AVSINLINE void _set(const CString& strValue)
{
set(strValue);
}
public:
virtual void set(const CString& strValue) = 0;
AVSINLINE CString& get()
{
return m_strValue;
}
AVSINLINE const CString& get() const
{
return m_strValue;
}
virtual BYTE GetBYTECode() const
{
return 0;
}
virtual void SetBYTECode(const BYTE& src)
{
}
protected:
CString m_strValue;
};
}
}
#endif // PPTX_LIMIT_BASE_INCLUDE_H_

View File

@@ -0,0 +1,103 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef PPTX_LIMIT_BEVELTYPE_INCLUDE_H_
#define PPTX_LIMIT_BEVELTYPE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class BevelType : public BaseLimit
{
public:
BevelType()
{
m_strValue = _T("circle");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("angle") == strValue) ||
(_T("artDeco") == strValue) ||
(_T("circle") == strValue) ||
(_T("convex") == strValue) ||
(_T("coolSlant") == strValue) ||
(_T("cross") == strValue) ||
(_T("divot") == strValue) ||
(_T("hardEdge") == strValue) ||
(_T("relaxedInset") == strValue) ||
(_T("riblet") == strValue) ||
(_T("slope") == strValue) ||
(_T("softRound") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("angle") == m_strValue)
return 0;
if (_T("artDeco") == m_strValue)
return 1;
if (_T("circle") == m_strValue)
return 2;
if (_T("convex") == m_strValue)
return 3;
if (_T("coolSlant") == m_strValue)
return 4;
if (_T("cross") == m_strValue)
return 5;
if (_T("divot") == m_strValue)
return 6;
if (_T("hardEdge") == m_strValue)
return 7;
if (_T("relaxedInset") == m_strValue)
return 8;
if (_T("riblet") == m_strValue)
return 9;
if (_T("slope") == m_strValue)
return 10;
if (_T("softRound") == m_strValue)
return 11;
return 0;
}
};
}
}
#endif // PPTX_LIMIT_BEVELTYPE_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 PPTX_LIMIT_BLENDMODE_INCLUDE_H_
#define PPTX_LIMIT_BLENDMODE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class BlendMode : public BaseLimit
{
public:
BlendMode()
{
m_strValue = _T("screen");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("darken") == strValue) ||
(_T("lighten") == strValue) ||
(_T("mult") == strValue) ||
(_T("over") == strValue) ||
(_T("screen") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("darken") == m_strValue)
return 0;
if (_T("lighten") == m_strValue)
return 1;
if (_T("mult") == m_strValue)
return 2;
if (_T("over") == m_strValue)
return 3;
if (_T("screen") == m_strValue)
return 4;
return 4;
}
};
}
}
#endif // PPTX_LIMIT_BLENDMODE_INCLUDE_H_

View File

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

View File

@@ -0,0 +1,125 @@
/*
* (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 PPTX_LIMIT_CAMERATYPE_INCLUDE_H_
#define PPTX_LIMIT_CAMERATYPE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class CameraType : public BaseLimit
{
public:
CameraType()
{
m_strValue = _T("legacyObliqueFront");
}
_USE_STRING_OPERATOR
virtual void CameraType::set(const CString& strValue)
{
if ((_T("isometricBottomDown") == strValue) ||
(_T("isometricBottomUp") == strValue) ||
(_T("isometricLeftDown") == strValue) ||
(_T("isometricLeftUp") == strValue) ||
(_T("isometricOffAxis1Left") == strValue) ||
(_T("isometricOffAxis1Right") == strValue) ||
(_T("isometricOffAxis1Top") == strValue) ||
(_T("isometricOffAxis2Left") == strValue) ||
(_T("isometricOffAxis2Right") == strValue) ||
(_T("isometricOffAxis2Top") == strValue) ||
(_T("isometricOffAxis3Bottom") == strValue) ||
(_T("isometricOffAxis3Left") == strValue) ||
(_T("isometricOffAxis3Right") == strValue) ||
(_T("isometricOffAxis4Bottom") == strValue) ||
(_T("isometricOffAxis4Left") == strValue) ||
(_T("isometricOffAxis4Right") == strValue) ||
(_T("isometricRightDown") == strValue) ||
(_T("isometricRightUp") == strValue) ||
(_T("isometricTopDown") == strValue) ||
(_T("isometricTopUp") == strValue) ||
(_T("legacyObliqueBottom") == strValue) ||
(_T("legacyObliqueBottomLeft") == strValue) ||
(_T("legacyObliqueBottomRight") == strValue) ||
(_T("legacyObliqueFront") == strValue) ||
(_T("legacyObliqueLeft") == strValue) ||
(_T("legacyObliqueRight") == strValue) ||
(_T("legacyObliqueTop") == strValue) ||
(_T("legacyObliqueTopLeft") == strValue) ||
(_T("legacyObliqueTopRight") == strValue) ||
(_T("legacyPerspectiveBottom") == strValue) ||
(_T("legacyPerspectiveBottomLeft") == strValue) ||
(_T("legacyPerspectiveBottomRight") == strValue) ||
(_T("legacyPerspectiveFront") == strValue) ||
(_T("legacyPerspectiveLeft") == strValue) ||
(_T("legacyPerspectiveRight") == strValue) ||
(_T("legacyPerspectiveTop") == strValue) ||
(_T("legacyPerspectiveTopLeft") == strValue) ||
(_T("legacyPerspectiveTopRight") == strValue) ||
(_T("obliqueBottom") == strValue) ||
(_T("obliqueBottomLeft") == strValue) ||
(_T("obliqueBottomRight") == strValue) ||
(_T("obliqueLeft") == strValue) ||
(_T("obliqueRight") == strValue) ||
(_T("obliqueTop") == strValue) ||
(_T("obliqueTopLeft") == strValue) ||
(_T("obliqueTopRight") == strValue) ||
(_T("orthographicFront") == strValue) ||
(_T("perspectiveAbove") == strValue) ||
(_T("perspectiveAboveLeftFacing") == strValue) ||
(_T("perspectiveAboveRightFacing") == strValue) ||
(_T("perspectiveBelow") == strValue) ||
(_T("perspectiveContrastingLeftFacing") == strValue) ||
(_T("perspectiveContrastingRightFacing") == strValue) ||
(_T("perspectiveFront") == strValue) ||
(_T("perspectiveHeroicExtremeLeftFacing") == strValue) ||
(_T("perspectiveHeroicExtremeRightFacing") == strValue) ||
(_T("perspectiveHeroicLeftFacing") == strValue) ||
(_T("perspectiveHeroicRightFacing") == strValue) ||
(_T("perspectiveLeft") == strValue) ||
(_T("perspectiveRelaxed") == strValue) ||
(_T("perspectiveRelaxedModerately") == strValue) ||
(_T("perspectiveRight") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_CAMERATYPE_INCLUDE_H_

View File

@@ -0,0 +1,69 @@
/*
* (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 PPTX_LIMIT_CHARTBUILD_INCLUDE_H_
#define PPTX_LIMIT_CHARTBUILD_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class ChartBuild : public BaseLimit
{
public:
ChartBuild()
{
m_strValue = _T("allPts");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("allPts") == strValue) ||
(_T("category") == strValue) ||
(_T("gridLegend") == strValue) ||
(_T("ptInCategory") == strValue) ||
(_T("ptInSeries") == strValue) ||
(_T("series") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_CHARTBUILD_INCLUDE_H_

View File

@@ -0,0 +1,68 @@
/*
* (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 PPTX_LIMIT_CHARTBUILDTYPE_INCLUDE_H_
#define PPTX_LIMIT_CHARTBUILDTYPE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class ChartBuildType : public BaseLimit
{
public:
ChartBuildType::ChartBuildType()
{
m_strValue = _T("allAtOnce");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("allAtOnce") == strValue) ||
(_T("category") == strValue) ||
(_T("categoryEl") == strValue) ||
(_T("series") == strValue) ||
(_T("seriesEl") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_CHARTBUILDTYPE_INCLUDE_H_

View File

@@ -0,0 +1,177 @@
/*
* (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 PPTX_LIMIT_COLORSCHEMEINDEX_INCLUDE_H_
#define PPTX_LIMIT_COLORSCHEMEINDEX_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class ColorSchemeIndex : public BaseLimit
{
public:
ColorSchemeIndex()
{
m_strValue = _T("accent1");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("accent1") == strValue) ||
(_T("accent2") == strValue) ||
(_T("accent3") == strValue) ||
(_T("accent4") == strValue) ||
(_T("accent5") == strValue) ||
(_T("accent6") == strValue) ||
(_T("dk1") == strValue) ||
(_T("dk2") == strValue) ||
(_T("folHlink") == strValue) ||
(_T("hlink") == strValue) ||
(_T("lt1") == strValue) ||
(_T("lt2") == strValue))
{
m_strValue = strValue;
}
else
{
if (_T("light1") == strValue)
m_strValue = _T("lt1");
else if (_T("light2") == strValue)
m_strValue = _T("lt2");
else if (_T("dark1") == strValue)
m_strValue = _T("dk1");
else if (_T("dark2") == strValue)
m_strValue = _T("dk2");
else if (_T("hyperlink") == strValue)
m_strValue = _T("hlink");
else if (_T("followedHyperlink") == strValue)
m_strValue = _T("folHlink");
}
}
virtual BYTE GetBYTECode() const
{
if (_T("accent1") == m_strValue)
return 0;
if (_T("accent2") == m_strValue)
return 1;
if (_T("accent3") == m_strValue)
return 2;
if (_T("accent4") == m_strValue)
return 3;
if (_T("accent5") == m_strValue)
return 4;
if (_T("accent6") == m_strValue)
return 5;
if (_T("bg1") == m_strValue)
return 6;
if (_T("bg2") == m_strValue)
return 7;
if (_T("dk1") == m_strValue)
return 8;
if (_T("dk2") == m_strValue)
return 9;
if (_T("folHlink") == m_strValue)
return 10;
if (_T("hlink") == m_strValue)
return 11;
if (_T("lt1") == m_strValue)
return 12;
if (_T("lt2") == m_strValue)
return 13;
if (_T("phClr") == m_strValue)
return 14;
if (_T("tx1") == m_strValue)
return 15;
if (_T("tx2") == m_strValue)
return 16;
return 0;
}
void SetStringCode(const BYTE& val)
{
switch (val)
{
case 0:
m_strValue = _T("accent1");
break;
case 1:
m_strValue = _T("accent2");
break;
case 2:
m_strValue = _T("accent3");
break;
case 3:
m_strValue = _T("accent4");
break;
case 4:
m_strValue = _T("accent5");
break;
case 5:
m_strValue = _T("accent6");
break;
case 8:
m_strValue = _T("dk1");
break;
case 9:
m_strValue = _T("dk2");
break;
case 10:
m_strValue = _T("folHlink");
break;
case 11:
m_strValue = _T("hlink");
break;
case 12:
m_strValue = _T("lt1");
break;
case 13:
m_strValue = _T("lt2");
break;
default:
m_strValue = _T("accent1");
break;
}
}
};
}
}
#endif // PPTX_LIMIT_COLORSCHEMEINDEX_INCLUDE_H_

View File

@@ -0,0 +1,105 @@
/*
* (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 PPTX_LIMIT_COMPOUNDLINE_INCLUDE_H_
#define PPTX_LIMIT_COMPOUNDLINE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class CompoundLine : public BaseLimit
{
public:
CompoundLine()
{
m_strValue = _T("sng");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("dbl") == strValue) ||
(_T("sng") == strValue) ||
(_T("thickThin") == strValue) ||
(_T("thinThick") == strValue) ||
(_T("tri") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("dbl") == m_strValue)
return 0;
if (_T("sng") == m_strValue)
return 1;
if (_T("thickThin") == m_strValue)
return 2;
if (_T("thinThick") == m_strValue)
return 3;
if (_T("tri") == m_strValue)
return 4;
return 1;
}
virtual void SetBYTECode(const BYTE& src)
{
switch (src)
{
case 0:
m_strValue = _T("dbl");
break;
case 2:
m_strValue = _T("thickThin");
break;
case 3:
m_strValue = _T("thinThick");
break;
case 4:
m_strValue = _T("tri");
break;
default:
m_strValue = _T("sng");
break;
}
}
};
}
}
#endif // PPTX_LIMIT_COMPOUNDLINE_INCLUDE_H_

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 PPTX_LIMIT_CONFORMANCE_INCLUDE_H_
#define PPTX_LIMIT_CONFORMANCE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class Conformance : public BaseLimit
{
public:
Conformance()
{
m_strValue = _T("transitional");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("strict") == strValue) ||
(_T("transitional") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("strict") == m_strValue)
return 0;
if (_T("transitional") == m_strValue)
return 1;
return 1;
}
};
}
}
#endif // PPTX_LIMIT_CONFORMANCE_INCLUDE_H_

View File

@@ -0,0 +1,67 @@
/*
* (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 PPTX_LIMIT_CONTENT_STATUS_INCLUDE_H_
#define PPTX_LIMIT_CONTENT_STATUS_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class ContentStatus : public BaseLimit
{
public:
ContentStatus()
{
m_strValue = _T("Draft");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("Draft") == strValue) ||
(_T("Reviewed") == strValue) ||
(_T("Final") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_CONTENT_STATUS_INCLUDE_H_

View File

@@ -0,0 +1,67 @@
/*
* (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 PPTX_LIMIT_CORNERDIRECTIONVAL_INCLUDE_H_
#define PPTX_LIMIT_CORNERDIRECTIONVAL_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class CornerDirectionVal : public BaseLimit
{
public:
CornerDirectionVal()
{
m_strValue = _T("lu");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("ld") == strValue) ||
(_T("lu") == strValue) ||
(_T("rd") == strValue) ||
(_T("ru") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_CORNERDIRECTIONVAL_INCLUDE_H_

View File

@@ -0,0 +1,65 @@
/*
* (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 PPTX_LIMIT_DGMBUILD_INCLUDE_H_
#define PPTX_LIMIT_DGMBUILD_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class DgmBuild : public BaseLimit
{
public:
DgmBuild()
{
m_strValue = _T("sp");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("bg") == strValue) ||
(_T("sp") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_DGMBUILD_INCLUDE_H_

View File

@@ -0,0 +1,80 @@
/*
* (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 PPTX_LIMIT_DGMBUILDTYPE_INCLUDE_H_
#define PPTX_LIMIT_DGMBUILDTYPE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class DgmBuildType : public BaseLimit
{
public:
DgmBuildType()
{
m_strValue = _T("whole");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("allAtOnce") == strValue) ||
(_T("breadthByLvl") == strValue) ||
(_T("breadthByNode") == strValue) ||
(_T("ccw") == strValue) ||
(_T("ccwIn") == strValue) ||
(_T("ccwOut") == strValue) ||
(_T("cust") == strValue) ||
(_T("cw") == strValue) ||
(_T("cwIn") == strValue) ||
(_T("cwOut") == strValue) ||
(_T("depthByBranch") == strValue) ||
(_T("depthByNode") == strValue) ||
(_T("down") == strValue) ||
(_T("inByRing") == strValue) ||
(_T("outByRing") == strValue) ||
(_T("up") == strValue) ||
(_T("whole") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_DGMBUILDTYPE_INCLUDE_H_

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 PPTX_LIMIT_EFFECTCONTAINERTYPE_INCLUDE_H_
#define PPTX_LIMIT_EFFECTCONTAINERTYPE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class EffectContainerType : public BaseLimit
{
public:
EffectContainerType()
{
m_strValue = _T("sib");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("sib") == strValue) ||
(_T("tree") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("sib") == m_strValue)
return 0;
if (_T("tree") == m_strValue)
return 1;
return 0;
}
};
}
}
#endif // PPTX_LIMIT_EFFECTCONTAINERTYPE_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 PPTX_LIMIT_EIGHTDIRECTIONVAL_INCLUDE_H_
#define PPTX_LIMIT_EIGHTDIRECTIONVAL_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class EightDirectionVal : public BaseLimit
{
public:
EightDirectionVal()
{
m_strValue = _T("l");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("ld") == strValue) ||
(_T("lu") == strValue) ||
(_T("rd") == strValue) ||
(_T("ru") == strValue) ||
(_T("d") == strValue) ||
(_T("l") == strValue) ||
(_T("r") == strValue) ||
(_T("u") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_EIGHTDIRECTIONVAL_INCLUDE_H_

View File

@@ -0,0 +1,95 @@
/*
* (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 PPTX_LIMIT_FILLPATH_INCLUDE_H_
#define PPTX_LIMIT_FILLPATH_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class FillPath : public BaseLimit
{
public:
FillPath()
{
m_strValue = _T("circle");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("circle") == strValue) ||
(_T("rect") == strValue) ||
(_T("shape") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("circle") == m_strValue)
return 0;
if (_T("rect") == m_strValue)
return 1;
if (_T("shape") == m_strValue)
return 2;
return 0;
}
virtual void SetBYTECode(const BYTE& src)
{
switch (src)
{
case 0:
m_strValue = _T("circle");
break;
case 1:
m_strValue = _T("rect");
break;
case 2:
m_strValue = _T("shape");
break;
default:
break;
}
}
};
}
}
#endif // PPTX_LIMIT_FILLPATH_INCLUDE_H_

View File

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

View File

@@ -0,0 +1,108 @@
/*
* (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 PPTX_LIMIT_FONTALIGN_INCLUDE_H_
#define PPTX_LIMIT_FONTALIGN_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class FontAlign : public BaseLimit
{
public:
FontAlign()
{
m_strValue = _T("auto");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("auto") == strValue) ||
(_T("b") == strValue) ||
(_T("base") == strValue) ||
(_T("ctr") == strValue) ||
(_T("t") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("auto") == m_strValue)
return 0;
if (_T("b") == m_strValue)
return 1;
if (_T("base") == m_strValue)
return 2;
if (_T("ctr") == m_strValue)
return 3;
if (_T("t") == m_strValue)
return 4;
return 0;
}
virtual void SetBYTECode(const BYTE& val)
{
switch (val)
{
case 0:
m_strValue = _T("auto");
break;
case 1:
m_strValue = _T("b");
break;
case 2:
m_strValue = _T("base");
break;
case 3:
m_strValue = _T("ctr");
break;
case 4:
m_strValue = _T("t");
break;
default:
m_strValue = _T("auto");
break;
}
}
};
}
}
#endif // PPTX_LIMIT_FONTALIGN_INCLUDE_H_

View File

@@ -0,0 +1,92 @@
/*
* (c) Copyright Ascensio System SIA 2010-2014
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef PPTX_LIMIT_FONTSTYLEINDEX_INCLUDE_H_
#define PPTX_LIMIT_FONTSTYLEINDEX_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class FontStyleIndex : public BaseLimit
{
public:
FontStyleIndex()
{
m_strValue = _T("none");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("major") == strValue) ||
(_T("minor") == strValue) ||
(_T("none") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("major") == m_strValue)
return 0;
if (_T("minor") == m_strValue)
return 1;
if (_T("none") == m_strValue)
return 2;
return 2;
}
virtual void SetBYTECode(const BYTE& src)
{
switch (src)
{
case 0:
m_strValue = _T("major");
break;
case 1:
m_strValue = _T("minor");
break;
default:
m_strValue = _T("none");
}
}
};
}
}
#endif // PPTX_LIMIT_FONTSTYLEINDEX_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 PPTX_LIMIT_FRAMESHAPE_INCLUDE_H_
#define PPTX_LIMIT_FRAMESHAPE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class FrameShape : public BaseLimit
{
public:
FrameShape()
{
m_strValue = _T("frameStyle1");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("frameStyle1") == strValue) ||
(_T("frameStyle2") == strValue) ||
(_T("frameStyle3") == strValue) ||
(_T("frameStyle4") == strValue) ||
(_T("frameStyle5") == strValue) ||
(_T("frameStyle6") == strValue) ||
(_T("frameStyle7") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_FRAMESHAPE_INCLUDE_H_

View File

@@ -0,0 +1,81 @@
/*
* (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 PPTX_LIMIT_HORZOVERFLOW_INCLUDE_H_
#define PPTX_LIMIT_HORZOVERFLOW_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class HorzOverflow : public BaseLimit
{
public:
HorzOverflow()
{
m_strValue = _T("clip");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("clip") == strValue) ||
(_T("overflow") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("clip") == m_strValue)
return 0;
if (_T("overflow") == m_strValue)
return 1;
return 0;
}
virtual void SetBYTECode(const BYTE& src)
{
if (1 == src)
m_strValue = _T("overflow");
else
m_strValue = _T("clip");
}
};
}
}
#endif // PPTX_LIMIT_HORZOVERFLOW_INCLUDE_H_

View File

@@ -0,0 +1,65 @@
/*
* (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 PPTX_LIMIT_INOUTDIRECTIONVAL_INCLUDE_H_
#define PPTX_LIMIT_INOUTDIRECTIONVAL_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class InOutDirectionVal : public BaseLimit
{
public:
InOutDirectionVal()
{
m_strValue = _T("out");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("in") == strValue) ||
(_T("out") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_INOUTDIRECTIONVAL_INCLUDE_H_

View File

@@ -0,0 +1,66 @@
/*
* (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 PPTX_LIMIT_ITERATETYPE_INCLUDE_H_
#define PPTX_LIMIT_ITERATETYPE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class IterateType : public BaseLimit
{
public:
IterateType()
{
m_strValue = _T("el");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("el") == strValue) ||
(_T("lt") == strValue) ||
(_T("wd") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_ITERATETYPE_INCLUDE_H_

View File

@@ -0,0 +1,93 @@
/*
* (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 PPTX_LIMIT_LASTVIEW_INCLUDE_H_
#define PPTX_LIMIT_LASTVIEW_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class LastView : public BaseLimit
{
public:
LastView()
{
m_strValue = _T("sldThumbnailView");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("handoutView") == strValue) ||
(_T("notesMasterView") == strValue) ||
(_T("notesView") == strValue) ||
(_T("outlineView") == strValue) ||
(_T("sldMasterView") == strValue) ||
(_T("sldSorterView") == strValue) ||
(_T("sldThumbnailView") == strValue) ||
(_T("sldView") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("handoutView") == m_strValue)
return 0;
if (_T("notesMasterView") == m_strValue)
return 1;
if (_T("notesView") == m_strValue)
return 2;
if (_T("outlineView") == m_strValue)
return 3;
if (_T("sldMasterView") == m_strValue)
return 4;
if (_T("sldSorterView") == m_strValue)
return 5;
if (_T("sldThumbnailView") == m_strValue)
return 6;
if (_T("sldView") == m_strValue)
return 7;
return 6;
}
};
}
}
#endif // PPTX_LIMIT_LASTVIEW_INCLUDE_H_

View File

@@ -0,0 +1,90 @@
/*
* (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 PPTX_LIMIT_LIGHTRIGTYPE_INCLUDE_H_
#define PPTX_LIMIT_LIGHTRIGTYPE_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class LightRigType : public BaseLimit
{
public:
LightRigType()
{
m_strValue = _T("balanced");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("balanced") == strValue) ||
(_T("brightRoom") == strValue) ||
(_T("chilly") == strValue) ||
(_T("contrasting") == strValue) ||
(_T("flat") == strValue) ||
(_T("flood") == strValue) ||
(_T("freezing") == strValue) ||
(_T("glow") == strValue) ||
(_T("harsh") == strValue) ||
(_T("legacyFlat1") == strValue) ||
(_T("legacyFlat2") == strValue) ||
(_T("legacyFlat3") == strValue) ||
(_T("legacyFlat4") == strValue) ||
(_T("legacyHarsh1") == strValue) ||
(_T("legacyHarsh2") == strValue) ||
(_T("legacyHarsh3") == strValue) ||
(_T("legacyHarsh4") == strValue) ||
(_T("legacyNormal1") == strValue) ||
(_T("legacyNormal2") == strValue) ||
(_T("legacyNormal3") == strValue) ||
(_T("legacyNormal4") == strValue) ||
(_T("morning") == strValue) ||
(_T("soft") == strValue) ||
(_T("sunrise") == strValue) ||
(_T("sunset") == strValue) ||
(_T("threePt") == strValue) ||
(_T("twoPt") == strValue))
{
m_strValue = strValue;
}
}
};
}
}
#endif // PPTX_LIMIT_LIGHTRIGTYPE_INCLUDE_H_

View File

@@ -0,0 +1,93 @@
/*
* (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 PPTX_LIMIT_LINECAP_INCLUDE_H_
#define PPTX_LIMIT_LINECAP_INCLUDE_H_
#include "BaseLimit.h"
namespace PPTX
{
namespace Limit
{
class LineCap : public BaseLimit
{
public:
LineCap()
{
m_strValue = _T("flat");
}
_USE_STRING_OPERATOR
virtual void set(const CString& strValue)
{
if ((_T("flat") == strValue) ||
(_T("rnd") == strValue) ||
(_T("sq") == strValue))
{
m_strValue = strValue;
}
}
virtual BYTE GetBYTECode() const
{
if (_T("flat") == m_strValue)
return 0;
if (_T("rnd") == m_strValue)
return 1;
if (_T("sq") == m_strValue)
return 2;
return 0;
}
virtual void SetBYTECode(const BYTE& src)
{
switch (src)
{
case 1:
m_strValue = _T("rnd");
break;
case 2:
m_strValue = _T("sq");
break;
default:
m_strValue = _T("flat");
break;
}
}
};
}
}
#endif // PPTX_LIMIT_LINECAP_INCLUDE_H_

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