Commit 7f643170 authored by ElenaSubbotina's avatar ElenaSubbotina

DocxFormat - refactoring, move common drawing in pptx format, ...

parent 7977bcf0
...@@ -1229,38 +1229,18 @@ ...@@ -1229,38 +1229,18 @@
</File> </File>
</Filter> </Filter>
<Filter <Filter
Name="DrawingML" Name="Drawing"
> >
<File <File
RelativePath="..\Source\DocxFormat\Drawing\Drawing.h" RelativePath="..\Source\DocxFormat\Diagram\DiagramData.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\Drawing3D.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingBody.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingColors.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingCoreInfo.cpp"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingCoreInfo.h"
> >
</File> </File>
<File <File
RelativePath="..\Source\DocxFormat\Drawing\DrawingEffects.cpp" RelativePath="..\Source\DocxFormat\Diagram\DiagramDrawing.h"
> >
</File> </File>
<File <File
RelativePath="..\Source\DocxFormat\Drawing\DrawingEffects.h" RelativePath="..\Source\DocxFormat\Drawing\Drawing.h"
> >
</File> </File>
<File <File
...@@ -1271,62 +1251,6 @@ ...@@ -1271,62 +1251,6 @@
RelativePath="..\Source\DocxFormat\Drawing\DrawingExt.h" RelativePath="..\Source\DocxFormat\Drawing\DrawingExt.h"
> >
</File> </File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingGraphic.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingParagraph.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingParagraphElements.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingPicture.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingRun.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingShape.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingShapeElements.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingShared.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingStyles.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingStyles2.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingTables.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingText.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingTextProperties.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingTransform.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="Utility" Name="Utility"
...@@ -1532,19 +1456,15 @@ ...@@ -1532,19 +1456,15 @@
> >
</File> </File>
<File <File
RelativePath="..\Source\XlsxFormat\IFileContainer_Spreadsheet.cpp" RelativePath="..\Source\XlsxFormat\SimpleTypes_Spreadsheet.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\IFileContainer_Spreadsheet.h"
> >
</File> </File>
<File <File
RelativePath="..\Source\XlsxFormat\SimpleTypes_Spreadsheet.h" RelativePath="..\Source\XlsxFormat\Workbook.h"
> >
</File> </File>
<File <File
RelativePath="..\Source\XlsxFormat\Workbook.h" RelativePath="..\Source\XlsxFormat\Worksheets\WorksheetChildOther.h"
> >
</File> </File>
<File <File
...@@ -1603,21 +1523,13 @@ ...@@ -1603,21 +1523,13 @@
> >
</File> </File>
<File <File
RelativePath="..\Source\XlsxFormat\Drawing\Image.h" RelativePath="..\Source\XlsxFormat\Ole\oleobjects.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Drawing\Pic.h"
> >
</File> </File>
<File <File
RelativePath="..\Source\XlsxFormat\Drawing\Pos.h" RelativePath="..\Source\XlsxFormat\Drawing\Pos.h"
> >
</File> </File>
<File
RelativePath="..\Source\XlsxFormat\Drawing\Shape.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="SharedStrings" Name="SharedStrings"
...@@ -1762,10 +1674,6 @@ ...@@ -1762,10 +1674,6 @@
RelativePath="..\Source\XlsxFormat\Worksheets\Worksheet.h" RelativePath="..\Source\XlsxFormat\Worksheets\Worksheet.h"
> >
</File> </File>
<File
RelativePath="..\Source\XlsxFormat\Worksheets\WorksheetChildOther.h"
>
</File>
</Filter> </Filter>
<Filter <Filter
Name="ExternalLinks" Name="ExternalLinks"
...@@ -1852,18 +1760,6 @@ ...@@ -1852,18 +1760,6 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="DiagramML"
>
<File
RelativePath="..\Source\DocxFormat\Diagram\DiagramData.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Diagram\DiagramDrawing.h"
>
</File>
</Filter>
<Filter <Filter
Name="Base" Name="Base"
> >
...@@ -1980,6 +1876,100 @@ ...@@ -1980,6 +1876,100 @@
> >
</File> </File>
</Filter> </Filter>
<Filter
Name="PPTX"
>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\PPTXFormat\Core.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\PPTXFormat\FileContainer.cpp"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\PPTXFormat\FileContainer.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\PPTXFormat\FileFactory.cpp"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="ReleaseOpenSource|Win32"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
<FileConfiguration
Name="ReleaseOpenSource|x64"
>
<Tool
Name="VCCLCompilerTool"
ObjectFile="$(IntDir)\$(InputName)1.obj"
XMLDocumentationFileName="$(IntDir)\$(InputName)1.xdc"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\PPTXFormat\FileFactory.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\PPTXFormat\FileMap.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\PPTXFormat\FileTypes.h"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\PPTXFormat\Folder.cpp"
>
</File>
<File
RelativePath="..\..\..\ASCOfficePPTXFile\PPTXFormat\Folder.h"
>
</File>
</Filter>
<File <File
RelativePath="..\Source\DocxFormat\Docx.cpp" RelativePath="..\Source\DocxFormat\Docx.cpp"
> >
......
...@@ -84,7 +84,6 @@ namespace NSCommon ...@@ -84,7 +84,6 @@ namespace NSCommon
*m_pCountRef += 1; *m_pCountRef += 1;
} }
public:
smart_ptr<Type>& operator=(const Type& oSrc) smart_ptr<Type>& operator=(const Type& oSrc)
{ {
Release(); Release();
...@@ -115,8 +114,6 @@ namespace NSCommon ...@@ -115,8 +114,6 @@ namespace NSCommon
return *this; return *this;
} }
public:
inline bool IsInit() const inline bool IsInit() const
{ {
return (NULL != m_pData); return (NULL != m_pData);
......
...@@ -4205,12 +4205,12 @@ namespace SimpleTypes ...@@ -4205,12 +4205,12 @@ namespace SimpleTypes
case 'p': case 'p':
if ( (L"parallelogram") == sValue ) this->m_eValue = shapetypeParallelogram; if ( (L"parallelogram") == sValue ) this->m_eValue = shapetypeParallelogram;
else if ( (L"pentagon") == sValue ) this->m_eValue = shapetypePentagon; else if ( (L"pentagon") == sValue ) this->m_eValue = shapetypePentagon;
else if ( (L"pie") == sValue ) this->m_eValue = shapetypePie; else if ( (L"pie") == sValue ) this->m_eValue = shapetypePie;
else if ( (L"pieWedge") == sValue ) this->m_eValue = shapetypePieWedge; else if ( (L"pieWedge") == sValue ) this->m_eValue = shapetypePieWedge;
else if ( (L"plaque") == sValue ) this->m_eValue = shapetypePlaque; else if ( (L"plaque") == sValue ) this->m_eValue = shapetypePlaque;
else if ( (L"plaqueTabs") == sValue ) this->m_eValue = shapetypePlaqueTabs; else if ( (L"plaqueTabs") == sValue ) this->m_eValue = shapetypePlaqueTabs;
else if ( (L"plus") == sValue ) this->m_eValue = shapetypePlus; else if ( (L"plus") == sValue ) this->m_eValue = shapetypePlus;
break; break;
case 'q': case 'q':
......
...@@ -108,18 +108,18 @@ namespace OOX ...@@ -108,18 +108,18 @@ namespace OOX
} }
public: public:
virtual void fromXML(XmlUtils::CXmlNode& oNode) virtual void fromXML(XmlUtils::CXmlNode& oNode)
{ {
m_sExtension = oNode.GetAttribute(_T("Extension")); m_sExtension = oNode.GetAttribute(_T("Extension"));
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
ReadAttributes( oReader ); ReadAttributes( oReader );
if ( !oReader.IsEmptyNode() ) if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd(); oReader.ReadTillEnd();
} }
virtual std::wstring toXML() const virtual std::wstring toXML() const
{ {
static const CExtensionTable oTable; static const CExtensionTable oTable;
...@@ -134,7 +134,7 @@ namespace OOX ...@@ -134,7 +134,7 @@ namespace OOX
return et_Default; return et_Default;
} }
std::wstring m_sExtension; std::wstring m_sExtension;
private: private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader) void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
...@@ -216,8 +216,8 @@ namespace OOX ...@@ -216,8 +216,8 @@ namespace OOX
private: private:
std::wstring m_sType; std::wstring m_sType;
OOX::CPath m_oPart; OOX::CPath m_oPart;
}; };
} // namespace ContentTypes } // namespace ContentTypes
...@@ -229,18 +229,17 @@ namespace OOX ...@@ -229,18 +229,17 @@ namespace OOX
public: public:
CContentTypes() CContentTypes()
{ {
AddDefault(OOX::CPath(_T(".bin"))); AddDefault(L"bin");
AddDefault(OOX::CPath(_T(".rels"))); AddDefault(L"rels");
AddDefault(OOX::CPath(_T(".bmp"))); AddDefault(L"jpeg");
AddDefault(OOX::CPath(_T(".jpg"))); AddDefault(L"png");
AddDefault(OOX::CPath(_T(".jpeg"))); AddDefault(L"wmf");
AddDefault(OOX::CPath(_T(".jpe"))); //AddDefault(L"bmp");
AddDefault(OOX::CPath(_T(".png"))); //AddDefault(OOX::CPath(_T(".jpg")));
AddDefault(OOX::CPath(_T(".gif"))); //AddDefault(OOX::CPath(_T(".jpe")));
AddDefault(OOX::CPath(_T(".emf"))); //AddDefault(OOX::CPath(_T(".gif")));
AddDefault(OOX::CPath(_T(".wmf"))); //AddDefault(OOX::CPath(_T(".emf")));
AddDefault(OOX::CPath(_T(".jpeg"))); //AddDefault(OOX::CPath(_T(".xlsx")));
AddDefault(OOX::CPath(_T(".xlsx")));
} }
CContentTypes(const CPath& oPath) CContentTypes(const CPath& oPath)
{ {
...@@ -248,46 +247,50 @@ namespace OOX ...@@ -248,46 +247,50 @@ namespace OOX
} }
~CContentTypes() ~CContentTypes()
{ {
for ( unsigned int nIndex = 0; nIndex < m_arrDefault.size(); nIndex++ )
{
if ( m_arrDefault[nIndex] ) delete m_arrDefault[nIndex];
m_arrDefault[nIndex] = NULL;
}
m_arrDefault.clear();
} }
public:
bool Read (const CPath& oDirPath) bool Read (const CPath& oDirPath)
{ {
OOX::CPath oFullPath = oDirPath / c_oContentTypeFileName; OOX::CPath oFullPath = oDirPath / c_oContentTypeFileName;
XmlUtils::CXmlLiteReader oReader; XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromFile( oFullPath.m_strFilename ) ) if ( !oReader.FromFile( oFullPath.m_strFilename ) )
return false; return false;
return ReadFromReader(oReader); return ReadFromReader(oReader);
} }
bool ReadFromString (std::wstring& sXml) bool ReadFromString (std::wstring& sXml)
{ {
XmlUtils::CXmlLiteReader oReader; XmlUtils::CXmlLiteReader oReader;
if ( !oReader.FromString( sXml ) ) if ( !oReader.FromString( sXml ) )
return false; return false;
return ReadFromReader(oReader); return ReadFromReader(oReader);
} }
bool Write(const CPath& oDirPath) const void Merge(CContentTypes * pSrcContentTypes)
{ {
std::wstring sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">"); if (pSrcContentTypes == NULL) return;
for (unsigned int nIndex = 0; nIndex < m_arrDefault.size(); nIndex++ ) for (std::map<std::wstring, ContentTypes::CDefault>::iterator it = pSrcContentTypes->m_mapDefaults.begin(); it != pSrcContentTypes->m_mapDefaults.end(); ++it)
{ {
if (m_arrDefault[nIndex]) AddDefault(it->first);
}
for (std::map<std::wstring, ContentTypes::COverride>::iterator it = pSrcContentTypes->m_mapOverrides.begin(); it != pSrcContentTypes->m_mapOverrides.end(); ++it)
{
if (m_mapOverrides.find(it->first) == m_mapOverrides.end())
{ {
sXml += m_arrDefault[nIndex]->toXML(); m_mapOverrides [it->first] = it->second;
} }
} }
}
bool Write(const CPath& oDirPath) const
{
std::wstring sXml = _T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Types xmlns=\"http://schemas.openxmlformats.org/package/2006/content-types\">");
for (std::map<std::wstring, ContentTypes::CDefault>::const_iterator it = m_mapDefaults.begin(); it != m_mapDefaults.end(); ++it)
{
sXml += it->second.toXML();
}
for (std::map<std::wstring, ContentTypes::COverride>::const_iterator it = m_arrOverride.begin(); it != m_arrOverride.end(); ++it) for (std::map<std::wstring, ContentTypes::COverride>::const_iterator it = m_mapOverrides.begin(); it != m_mapOverrides.end(); ++it)
{ {
sXml += it->second.toXML(); sXml += it->second.toXML();
} }
...@@ -299,36 +302,26 @@ namespace OOX ...@@ -299,36 +302,26 @@ namespace OOX
return true; return true;
} }
public:
void Registration(const std::wstring& sType, const CPath& oDirectory, const CPath& oFilename) void Registration(const std::wstring& sType, const CPath& oDirectory, const CPath& oFilename)
{ {
OOX::CPath oFullPath = oDirectory / oFilename; OOX::CPath oFullPath = oDirectory / oFilename;
AddOverride( sType, oFullPath.m_strFilename ); AddOverride( sType, oFullPath.m_strFilename );
AddDefault ( oFullPath ); AddDefault ( oFullPath.GetExtention(false) );
} }
void Registration(const std::wstring& sType, const std::wstring& sDirectory, const std::wstring& sFilename)
void AddDefault(const OOX::CPath& oPath)
{ {
std::wstring sExt(oPath.GetExtention().c_str()); Registration(sType, OOX::CPath(sDirectory), OOX::CPath(sFilename));
const std::wstring sExtension = sExt.substr( 1 ); }
void AddDefault(const std::wstring& sExtension)
size_t nCount = m_arrDefault.size(); {
size_t nIndex = 0; if (sExtension.empty()) return;
while ( nIndex < nCount ) if (m_mapDefaults.find (sExtension) == m_mapDefaults.end())
{ {
if (( m_arrDefault[(int) nIndex]) && (m_arrDefault[(int) nIndex]->m_sExtension == sExtension )) m_mapDefaults [sExtension] = ContentTypes::CDefault( sExtension );
break;
++nIndex;
} }
if ( nIndex == nCount )
m_arrDefault.push_back(new ContentTypes::CDefault( sExtension ) );
} }
private: private:
bool ReadFromReader (XmlUtils::CXmlLiteReader& oReader) bool ReadFromReader (XmlUtils::CXmlLiteReader& oReader)
{ {
...@@ -343,13 +336,13 @@ namespace OOX ...@@ -343,13 +336,13 @@ namespace OOX
if ( _T("Default") == sName ) if ( _T("Default") == sName )
{ {
ContentTypes::CDefault *oDefault = new ContentTypes::CDefault(oReader); ContentTypes::CDefault oDefault = oReader;
if (oDefault) m_arrDefault.push_back( oDefault ); m_mapDefaults [ oDefault.m_sExtension] = oDefault ;
} }
else if ( _T("Override") == sName ) else if ( _T("Override") == sName )
{ {
ContentTypes::COverride oOverride = oReader; ContentTypes::COverride oOverride = oReader;
m_arrOverride [oOverride.filename().GetPath()] = oOverride; m_mapOverrides [oOverride.filename().GetPath()] = oOverride;
} }
} }
return true; return true;
...@@ -361,13 +354,14 @@ namespace OOX ...@@ -361,13 +354,14 @@ namespace OOX
sPath.erase(0, 1); sPath.erase(0, 1);
} }
ContentTypes::COverride oOverride( sType, sPath ); ContentTypes::COverride oOverride( sType, sPath );
m_arrOverride [oOverride.filename().GetPath()] = oOverride;
m_mapOverrides [oOverride.filename().GetPath()] = oOverride;
} }
public: public:
std::vector<ContentTypes::CDefault*> m_arrDefault; std::map<std::wstring, ContentTypes::CDefault> m_mapDefaults;
std::map<std::wstring, ContentTypes::COverride> m_arrOverride; std::map<std::wstring, ContentTypes::COverride> m_mapOverrides;
}; };
} // namespace OOX } // namespace OOX
......
...@@ -37,10 +37,7 @@ ...@@ -37,10 +37,7 @@
#include "../../Base/Nullable.h" #include "../../Base/Nullable.h"
#include "../WritingElement.h" #include "../WritingElement.h"
#include "../Drawing/DrawingExt.h"
#include "../Drawing/DrawingCoreInfo.h"
#include "../Drawing/DrawingText.h"
namespace OOX namespace OOX
{ {
...@@ -101,9 +98,9 @@ namespace OOX ...@@ -101,9 +98,9 @@ namespace OOX
WritingElement_ReadAttributes_End( oReader ) WritingElement_ReadAttributes_End( oReader )
} }
public: public:
nullable<OOX::Drawing::CShapeProperties> m_oSpPr; nullable<PPTX::Logic::SpPr> m_oSpPr;
nullable<OOX::Drawing::CTxBody> m_oTxBody; nullable<PPTX::Logic::TxBody> m_oTxBody;
nullable<std::wstring> m_sModelId; //guid nullable<std::wstring> m_sModelId; //guid
}; };
......
...@@ -215,28 +215,7 @@ namespace OOX ...@@ -215,28 +215,7 @@ namespace OOX
{ {
m_oReadPath = oFilePath; m_oReadPath = oFilePath;
IFileContainer::Read( oRootPath, oFilePath ); IFileContainer::Read( oRootPath, oFilePath );
//#ifdef USE_LITE_READER
// XmlUtils::CXmlLiteReader oReader;
// if ( !oReader.FromFile( oFilePath.GetPath() ) )
// return;
// if ( !oReader.ReadNextNode() )
// return;
// std::wstring sName = oReader.GetName();
// if ( _T("dsp:drawing") == sName && !oReader.IsEmptyNode() )
// {
// int nNumberingDepth = oReader.GetDepth();
// while ( oReader.ReadNextSiblingNode( nNumberingDepth ) )
// {
// sName = oReader.GetName();
// if ( _T("dsp:spTree") == sName )
// m_arrShapeTree.push_back( new PPTX::Logic::SpTree(oReader) );
// }
// }
//#endif
XmlUtils::CXmlNode oNodeDW; XmlUtils::CXmlNode oNodeDW;
if (oNodeDW.FromXmlFile(oFilePath.GetPath() )) if (oNodeDW.FromXmlFile(oFilePath.GetPath() ))
{ {
......
...@@ -120,7 +120,7 @@ namespace OOX { ...@@ -120,7 +120,7 @@ namespace OOX {
// Ищем файл с темами // Ищем файл с темами
pFile = pDocumentContainer->Find(OOX::FileTypes::Theme); pFile = pDocumentContainer->Find(OOX::FileTypes::Theme);
if (pFile.IsInit() && OOX::FileTypes::Theme == pFile->type()) if (pFile.IsInit() && OOX::FileTypes::Theme == pFile->type())
m_pTheme = (OOX::CTheme*)pFile.operator->(); m_pTheme = (PPTX::Theme*)pFile.operator->();
else else
m_pTheme = NULL; m_pTheme = NULL;
} }
......
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
#include "Media/Image.h" #include "Media/Image.h"
#include "Media/OleObject.h" #include "Media/OleObject.h"
#include "HeaderFooter.h" #include "HeaderFooter.h"
#include "Theme/Theme.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
#if !defined(_WIN32) && !defined (_WIN64) #if !defined(_WIN32) && !defined (_WIN64)
#include <sys/stat.h> #include <sys/stat.h>
...@@ -101,8 +101,6 @@ namespace OOX ...@@ -101,8 +101,6 @@ namespace OOX
Read( oFilePath ); Read( oFilePath );
} }
public:
bool Read(const CPath& oFilePath); bool Read(const CPath& oFilePath);
bool Write(const CPath& oFilePath) bool Write(const CPath& oFilePath)
{ {
...@@ -129,10 +127,6 @@ namespace OOX ...@@ -129,10 +127,6 @@ namespace OOX
return true; return true;
} }
public:
OOX::CDocument *GetDocument () const OOX::CDocument *GetDocument () const
{ {
return m_pDocument; return m_pDocument;
...@@ -182,12 +176,12 @@ namespace OOX ...@@ -182,12 +176,12 @@ namespace OOX
return m_pPeople; return m_pPeople;
} }
OOX::CTheme *GetTheme () const PPTX::Theme *GetTheme () const
{ {
return m_pTheme; return m_pTheme;
} }
OOX::CHdrFtr *GetHeaderOrFooter(const OOX::RId& rId) const OOX::CHdrFtr *GetHeaderOrFooter(const OOX::RId& rId) const
{ {
if ( m_pDocument ) if ( m_pDocument )
{ {
...@@ -203,8 +197,6 @@ namespace OOX ...@@ -203,8 +197,6 @@ namespace OOX
return NULL; return NULL;
} }
public:
OOX::CApp *m_pApp; OOX::CApp *m_pApp;
OOX::CCore *m_pCore; OOX::CCore *m_pCore;
...@@ -219,7 +211,7 @@ namespace OOX ...@@ -219,7 +211,7 @@ namespace OOX
OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml
OOX::CPeople *m_pPeople; // word/people.xml OOX::CPeople *m_pPeople; // word/people.xml
OOX::CTheme *m_pTheme; PPTX::Theme *m_pTheme;
}; };
} // OOX } // OOX
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "../../XlsxFormat/Worksheets/Sparkline.h" #include "../../XlsxFormat/Worksheets/Sparkline.h"
#include "../../XlsxFormat/Table/Table.h" #include "../../XlsxFormat/Table/Table.h"
#include "../Diagram/DiagramData.h" #include "../Diagram/DiagramData.h"
#include "../../XlsxFormat/Worksheets/ConditionalFormatting.h"
namespace OOX namespace OOX
{ {
...@@ -42,14 +43,24 @@ namespace OOX ...@@ -42,14 +43,24 @@ namespace OOX
{ {
m_oSparklineGroups.reset(); m_oSparklineGroups.reset();
m_oAltTextTable.reset(); m_oAltTextTable.reset();
m_oDataModelExt.reset();
m_oCompatExt.reset();
// delete Conditional Formatting
for (size_t nIndex = 0, nLength = m_arrConditionalFormatting.size(); nIndex < nLength; ++nIndex)
{
delete m_arrConditionalFormatting[nIndex];
}
m_arrConditionalFormatting.clear();
} }
void COfficeArtExtension::fromXML(XmlUtils::CXmlLiteReader& oReader) void COfficeArtExtension::fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
ReadAttributes( oReader ); ReadAttributes( oReader );
if ((m_sUri.IsInit()) && (*m_sUri == L"{63B3BB69-23CF-44E3-9099-C40C66FF867C}" || if ((m_sUri.IsInit()) && (*m_sUri == L"{63B3BB69-23CF-44E3-9099-C40C66FF867C}" ||
*m_sUri == L"{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" || *m_sUri == L"{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" ||
*m_sUri == L"{504A1905-F514-4f6f-8877-14C23A59335A}" || *m_sUri == L"{504A1905-F514-4f6f-8877-14C23A59335A}" ||
*m_sUri == L"{78C0D931-6437-407d-A8EE-F0AAD7539E65}" ||
*m_sUri == L"http://schemas.microsoft.com/office/drawing/2008/diagram")) *m_sUri == L"http://schemas.microsoft.com/office/drawing/2008/diagram"))
{ {
int nCurDepth = oReader.GetDepth(); int nCurDepth = oReader.GetDepth();
...@@ -72,6 +83,17 @@ namespace OOX ...@@ -72,6 +83,17 @@ namespace OOX
{ {
m_oAltTextTable = oReader; m_oAltTextTable = oReader;
} }
else if (sName == L"conditionalFormattings")
{
if ( oReader.IsEmptyNode() )
continue;
int nCurDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nCurDepth1 ) )
{
m_arrConditionalFormatting.push_back(new OOX::Spreadsheet::CConditionalFormatting(oReader));
}
}
} }
} }
else else
......
...@@ -42,6 +42,7 @@ namespace OOX ...@@ -42,6 +42,7 @@ namespace OOX
{ {
class CSparklineGroups; class CSparklineGroups;
class CAltTextTable; class CAltTextTable;
class CConditionalFormatting;
} }
namespace Drawing namespace Drawing
{ {
...@@ -194,6 +195,8 @@ namespace OOX ...@@ -194,6 +195,8 @@ namespace OOX
nullable<OOX::Spreadsheet::CSparklineGroups> m_oSparklineGroups; nullable<OOX::Spreadsheet::CSparklineGroups> m_oSparklineGroups;
nullable<CDataModelExt> m_oDataModelExt; nullable<CDataModelExt> m_oDataModelExt;
nullable<OOX::Spreadsheet::CAltTextTable> m_oAltTextTable; nullable<OOX::Spreadsheet::CAltTextTable> m_oAltTextTable;
std::vector<OOX::Spreadsheet::CConditionalFormatting*> m_arrConditionalFormatting;
}; };
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
// COfficeArtExtensionList 20.1.2.2.15 (Part 1) // COfficeArtExtensionList 20.1.2.2.15 (Part 1)
...@@ -217,11 +220,11 @@ namespace OOX ...@@ -217,11 +220,11 @@ namespace OOX
public: public:
virtual void fromXML(XmlUtils::CXmlNode& oNode) virtual void fromXML(XmlUtils::CXmlNode& oNode)
{ {
// TO DO: Реализовать // TO DO: Реализовать
} }
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader) virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{ {
if ( oReader.IsEmptyNode() ) if ( oReader.IsEmptyNode() )
return; return;
......
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* 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
\ No newline at end of file
...@@ -53,7 +53,6 @@ namespace OOX ...@@ -53,7 +53,6 @@ namespace OOX
virtual void read(const CPath& filename) = 0; virtual void read(const CPath& filename) = 0;
virtual void write(const CPath& filename, const CPath& directory, CContentTypes& content) const = 0; virtual void write(const CPath& filename, const CPath& directory, CContentTypes& content) const = 0;
public:
virtual const OOX::FileType type() const = 0; virtual const OOX::FileType type() const = 0;
virtual const CPath DefaultDirectory() const = 0; virtual const CPath DefaultDirectory() const = 0;
virtual const CPath DefaultFileName() const = 0; virtual const CPath DefaultFileName() const = 0;
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#include "App.h" #include "App.h"
#include "Core.h" #include "Core.h"
#include "Document.h" #include "Document.h"
#include "Theme/Theme.h"
#include "Theme/ThemeOverride.h"
#include "Settings/Settings.h" #include "Settings/Settings.h"
#include "Settings/WebSettings.h" #include "Settings/WebSettings.h"
#include "FontTable.h" #include "FontTable.h"
...@@ -59,7 +57,9 @@ ...@@ -59,7 +57,9 @@
#include "UnknowTypeFile.h" #include "UnknowTypeFile.h"
#include "Diagram/DiagramDrawing.h" #include "Diagram/DiagramDrawing.h"
#include "Diagram/DiagramData.h" #include "Diagram/DiagramData.h"
#include "VmlDrawing.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
namespace OOX namespace OOX
{ {
...@@ -72,18 +72,8 @@ namespace OOX ...@@ -72,18 +72,8 @@ namespace OOX
else else
oFileName = oPath / oRelationFilename; oFileName = oPath / oRelationFilename;
if ( oRelation.Type() == FileTypes::App ) if ( oRelation.Type() == FileTypes::Document)
return smart_ptr<OOX::File>(new CApp( oFileName ));
else if ( oRelation.Type() == FileTypes::Core)
return smart_ptr<OOX::File>(new CCore( oFileName ));
else if ( oRelation.Type() == FileTypes::Document)
return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Theme)
return smart_ptr<OOX::File>(new CTheme( oFileName ));
else if ( oRelation.Type() == FileTypes::ThemeOverride)
return smart_ptr<OOX::File>(new CThemeOverride( oFileName ));
else if ( oRelation.Type() == FileTypes::Setting)
return smart_ptr<OOX::File>(new CSettings( oFileName ));
else if ( oRelation.Type() == FileTypes::FontTable) else if ( oRelation.Type() == FileTypes::FontTable)
return smart_ptr<OOX::File>(new CFontTable( oFileName )); return smart_ptr<OOX::File>(new CFontTable( oFileName ));
else if ( oRelation.Type() == FileTypes::Style) else if ( oRelation.Type() == FileTypes::Style)
...@@ -96,6 +86,29 @@ namespace OOX ...@@ -96,6 +86,29 @@ namespace OOX
return smart_ptr<OOX::File>(new CEndnotes( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CEndnotes( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::WebSetting) else if ( oRelation.Type() == FileTypes::WebSetting)
return smart_ptr<OOX::File>(new CWebSettings( oFileName )); return smart_ptr<OOX::File>(new CWebSettings( oFileName ));
else if ( oRelation.Type() == FileTypes::Numbering)
return smart_ptr<OOX::File>(new CNumbering( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Header)
return smart_ptr<OOX::File>(new CHdrFtr( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Footer)
return smart_ptr<OOX::File>(new CHdrFtr( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Comments)
return smart_ptr<OOX::File>(new CComments( oFileName ));
else if ( oRelation.Type() == FileTypes::CommentsExt )
return smart_ptr<OOX::File>(new CCommentsExt( oFileName ));
else if ( oRelation.Type() == FileTypes::People )
return smart_ptr<OOX::File>(new CPeople( oFileName ));
//common
else if ( oRelation.Type() == FileTypes::Setting)
return smart_ptr<OOX::File>(new CSettings( oFileName ));
else if ( oRelation.Type() == FileTypes::App )
return smart_ptr<OOX::File>(new CApp( oFileName ));
else if ( oRelation.Type() == FileTypes::Core)
return smart_ptr<OOX::File>(new CCore( oFileName ));
else if ( oRelation.Type() == FileTypes::Theme)
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
else if ( oRelation.Type() == FileTypes::ThemeOverride)
return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
else if ( oRelation.Type() == FileTypes::HyperLink) else if ( oRelation.Type() == FileTypes::HyperLink)
return smart_ptr<OOX::File>(new HyperLink( oRelation.Target())); return smart_ptr<OOX::File>(new HyperLink( oRelation.Target()));
else if (( oRelation.Type() == FileTypes::ExternalVideo ) && ( oRelation.IsExternal() )) else if (( oRelation.Type() == FileTypes::ExternalVideo ) && ( oRelation.IsExternal() ))
...@@ -112,22 +125,14 @@ namespace OOX ...@@ -112,22 +125,14 @@ namespace OOX
return smart_ptr<OOX::File>(new Audio( oFileName )); return smart_ptr<OOX::File>(new Audio( oFileName ));
else if ( oRelation.Type() == FileTypes::Video) else if ( oRelation.Type() == FileTypes::Video)
return smart_ptr<OOX::File>(new Video( oFileName )); return smart_ptr<OOX::File>(new Video( oFileName ));
else if ( oRelation.Type() == FileTypes::Numbering)
return smart_ptr<OOX::File>(new CNumbering( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Header)
return smart_ptr<OOX::File>(new CHdrFtr( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Footer)
return smart_ptr<OOX::File>(new CHdrFtr( oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Comments)
return smart_ptr<OOX::File>(new CComments( oFileName ));
else if ( oRelation.Type() == FileTypes::CommentsExt )
return smart_ptr<OOX::File>(new CCommentsExt( oFileName ));
else if ( oRelation.Type() == FileTypes::People )
return smart_ptr<OOX::File>(new CPeople( oFileName ));
else if (oRelation.Type() == FileTypes::Data) else if (oRelation.Type() == FileTypes::Data)
return smart_ptr<OOX::File>(new CDiagramData( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CDiagramData( oRootPath, oFileName ));
else if (oRelation.Type() == FileTypes::DiagDrawing) else if (oRelation.Type() == FileTypes::DiagDrawing)
return smart_ptr<OOX::File>(new CDiagramDrawing( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CDiagramDrawing( oRootPath, oFileName ));
else if (oRelation.Type() == FileTypes::MicrosoftOfficeUnknown) //ms package
return smart_ptr<OOX::File>(new OleObject( oFileName, true ));
else if ( oRelation.Type() == OOX::FileTypes::VmlDrawing )
return smart_ptr<OOX::File>(new CVmlDrawing( oRootPath, oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() ); return smart_ptr<OOX::File>( new UnknowTypeFile() );
} }
...@@ -150,9 +155,9 @@ namespace OOX ...@@ -150,9 +155,9 @@ namespace OOX
else if ( pRelation->Type() == FileTypes::Document) else if ( pRelation->Type() == FileTypes::Document)
return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CDocument( oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::Theme) else if ( pRelation->Type() == FileTypes::Theme)
return smart_ptr<OOX::File>(new CTheme( oFileName )); return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
else if ( pRelation->Type() == FileTypes::ThemeOverride) else if ( pRelation->Type() == FileTypes::ThemeOverride)
return smart_ptr<OOX::File>(new CThemeOverride( oFileName )); return smart_ptr<OOX::File>(new PPTX::Theme( oFileName ));
else if ( pRelation->Type() == FileTypes::Setting) else if ( pRelation->Type() == FileTypes::Setting)
return smart_ptr<OOX::File>(new CSettings( oFileName )); return smart_ptr<OOX::File>(new CSettings( oFileName ));
else if ( pRelation->Type() == FileTypes::FontTable) else if ( pRelation->Type() == FileTypes::FontTable)
...@@ -199,6 +204,8 @@ namespace OOX ...@@ -199,6 +204,8 @@ namespace OOX
return smart_ptr<OOX::File>(new CDiagramData( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CDiagramData( oRootPath, oFileName ));
else if (pRelation->Type() == FileTypes::DiagDrawing) else if (pRelation->Type() == FileTypes::DiagDrawing)
return smart_ptr<OOX::File>(new CDiagramDrawing( oRootPath, oFileName )); return smart_ptr<OOX::File>(new CDiagramDrawing( oRootPath, oFileName ));
else if (pRelation->Type() == FileTypes::MicrosoftOfficeUnknown) //ms package
return smart_ptr<OOX::File>(new OleObject( oFileName, true ));
return smart_ptr<OOX::File>( new UnknowTypeFile() ); return smart_ptr<OOX::File>( new UnknowTypeFile() );
} }
......
...@@ -253,6 +253,9 @@ namespace OOX ...@@ -253,6 +253,9 @@ namespace OOX
m_oTextOutline = oReader; m_oTextOutline = oReader;
else if (_T("w14:textFill") == sName) else if (_T("w14:textFill") == sName)
{ {
if ( oReader.IsEmptyNode() )
continue;
int nParentDepth1 = oReader.GetDepth(); int nParentDepth1 = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth1 ) ) while( oReader.ReadNextSiblingNode( nParentDepth1 ) )
{ {
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment