Commit 7f643170 authored by ElenaSubbotina's avatar ElenaSubbotina

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

parent 7977bcf0
......@@ -1229,38 +1229,18 @@
</File>
</Filter>
<Filter
Name="DrawingML"
>
<File
RelativePath="..\Source\DocxFormat\Drawing\Drawing.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"
Name="Drawing"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingCoreInfo.h"
RelativePath="..\Source\DocxFormat\Diagram\DiagramData.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingEffects.cpp"
RelativePath="..\Source\DocxFormat\Diagram\DiagramDrawing.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Drawing\DrawingEffects.h"
RelativePath="..\Source\DocxFormat\Drawing\Drawing.h"
>
</File>
<File
......@@ -1271,62 +1251,6 @@
RelativePath="..\Source\DocxFormat\Drawing\DrawingExt.h"
>
</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
Name="Utility"
......@@ -1532,19 +1456,15 @@
>
</File>
<File
RelativePath="..\Source\XlsxFormat\IFileContainer_Spreadsheet.cpp"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\IFileContainer_Spreadsheet.h"
RelativePath="..\Source\XlsxFormat\SimpleTypes_Spreadsheet.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\SimpleTypes_Spreadsheet.h"
RelativePath="..\Source\XlsxFormat\Workbook.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Workbook.h"
RelativePath="..\Source\XlsxFormat\Worksheets\WorksheetChildOther.h"
>
</File>
<File
......@@ -1603,21 +1523,13 @@
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Drawing\Image.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Drawing\Pic.h"
RelativePath="..\Source\XlsxFormat\Ole\oleobjects.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Drawing\Pos.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Drawing\Shape.h"
>
</File>
</Filter>
<Filter
Name="SharedStrings"
......@@ -1762,10 +1674,6 @@
RelativePath="..\Source\XlsxFormat\Worksheets\Worksheet.h"
>
</File>
<File
RelativePath="..\Source\XlsxFormat\Worksheets\WorksheetChildOther.h"
>
</File>
</Filter>
<Filter
Name="ExternalLinks"
......@@ -1852,18 +1760,6 @@
>
</File>
</Filter>
<Filter
Name="DiagramML"
>
<File
RelativePath="..\Source\DocxFormat\Diagram\DiagramData.h"
>
</File>
<File
RelativePath="..\Source\DocxFormat\Diagram\DiagramDrawing.h"
>
</File>
</Filter>
<Filter
Name="Base"
>
......@@ -1980,6 +1876,100 @@
>
</File>
</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
RelativePath="..\Source\DocxFormat\Docx.cpp"
>
......
......@@ -84,7 +84,6 @@ namespace NSCommon
*m_pCountRef += 1;
}
public:
smart_ptr<Type>& operator=(const Type& oSrc)
{
Release();
......@@ -115,8 +114,6 @@ namespace NSCommon
return *this;
}
public:
inline bool IsInit() const
{
return (NULL != m_pData);
......
......@@ -229,18 +229,17 @@ namespace OOX
public:
CContentTypes()
{
AddDefault(OOX::CPath(_T(".bin")));
AddDefault(OOX::CPath(_T(".rels")));
AddDefault(OOX::CPath(_T(".bmp")));
AddDefault(OOX::CPath(_T(".jpg")));
AddDefault(OOX::CPath(_T(".jpeg")));
AddDefault(OOX::CPath(_T(".jpe")));
AddDefault(OOX::CPath(_T(".png")));
AddDefault(OOX::CPath(_T(".gif")));
AddDefault(OOX::CPath(_T(".emf")));
AddDefault(OOX::CPath(_T(".wmf")));
AddDefault(OOX::CPath(_T(".jpeg")));
AddDefault(OOX::CPath(_T(".xlsx")));
AddDefault(L"bin");
AddDefault(L"rels");
AddDefault(L"jpeg");
AddDefault(L"png");
AddDefault(L"wmf");
//AddDefault(L"bmp");
//AddDefault(OOX::CPath(_T(".jpg")));
//AddDefault(OOX::CPath(_T(".jpe")));
//AddDefault(OOX::CPath(_T(".gif")));
//AddDefault(OOX::CPath(_T(".emf")));
//AddDefault(OOX::CPath(_T(".xlsx")));
}
CContentTypes(const CPath& oPath)
{
......@@ -248,16 +247,8 @@ namespace OOX
}
~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)
{
OOX::CPath oFullPath = oDirPath / c_oContentTypeFileName;
......@@ -274,20 +265,32 @@ namespace OOX
return false;
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)
{
sXml += m_arrDefault[nIndex]->toXML();
if (m_mapOverrides.find(it->first) == m_mapOverrides.end())
{
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();
}
......@@ -299,36 +302,26 @@ namespace OOX
return true;
}
public:
void Registration(const std::wstring& sType, const CPath& oDirectory, const CPath& oFilename)
{
OOX::CPath oFullPath = oDirectory / oFilename;
AddOverride( sType, oFullPath.m_strFilename );
AddDefault ( oFullPath );
AddDefault ( oFullPath.GetExtention(false) );
}
void AddDefault(const OOX::CPath& oPath)
void Registration(const std::wstring& sType, const std::wstring& sDirectory, const std::wstring& sFilename)
{
std::wstring sExt(oPath.GetExtention().c_str());
const std::wstring sExtension = sExt.substr( 1 );
size_t nCount = m_arrDefault.size();
size_t nIndex = 0;
while ( nIndex < nCount )
Registration(sType, OOX::CPath(sDirectory), OOX::CPath(sFilename));
}
void AddDefault(const std::wstring& sExtension)
{
if (( m_arrDefault[(int) nIndex]) && (m_arrDefault[(int) nIndex]->m_sExtension == sExtension ))
break;
if (sExtension.empty()) return;
++nIndex;
if (m_mapDefaults.find (sExtension) == m_mapDefaults.end())
{
m_mapDefaults [sExtension] = ContentTypes::CDefault( sExtension );
}
if ( nIndex == nCount )
m_arrDefault.push_back(new ContentTypes::CDefault( sExtension ) );
}
private:
bool ReadFromReader (XmlUtils::CXmlLiteReader& oReader)
{
......@@ -343,13 +336,13 @@ namespace OOX
if ( _T("Default") == sName )
{
ContentTypes::CDefault *oDefault = new ContentTypes::CDefault(oReader);
if (oDefault) m_arrDefault.push_back( oDefault );
ContentTypes::CDefault oDefault = oReader;
m_mapDefaults [ oDefault.m_sExtension] = oDefault ;
}
else if ( _T("Override") == sName )
{
ContentTypes::COverride oOverride = oReader;
m_arrOverride [oOverride.filename().GetPath()] = oOverride;
m_mapOverrides [oOverride.filename().GetPath()] = oOverride;
}
}
return true;
......@@ -361,13 +354,14 @@ namespace OOX
sPath.erase(0, 1);
}
ContentTypes::COverride oOverride( sType, sPath );
m_arrOverride [oOverride.filename().GetPath()] = oOverride;
m_mapOverrides [oOverride.filename().GetPath()] = oOverride;
}
public:
std::vector<ContentTypes::CDefault*> m_arrDefault;
std::map<std::wstring, ContentTypes::COverride> m_arrOverride;
std::map<std::wstring, ContentTypes::CDefault> m_mapDefaults;
std::map<std::wstring, ContentTypes::COverride> m_mapOverrides;
};
} // namespace OOX
......
......@@ -37,10 +37,7 @@
#include "../../Base/Nullable.h"
#include "../WritingElement.h"
#include "../Drawing/DrawingCoreInfo.h"
#include "../Drawing/DrawingText.h"
#include "../Drawing/DrawingExt.h"
namespace OOX
{
......@@ -101,8 +98,8 @@ namespace OOX
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<OOX::Drawing::CShapeProperties> m_oSpPr;
nullable<OOX::Drawing::CTxBody> m_oTxBody;
nullable<PPTX::Logic::SpPr> m_oSpPr;
nullable<PPTX::Logic::TxBody> m_oTxBody;
nullable<std::wstring> m_sModelId; //guid
};
......
......@@ -215,28 +215,7 @@ namespace OOX
{
m_oReadPath = 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;
if (oNodeDW.FromXmlFile(oFilePath.GetPath() ))
{
......
......@@ -120,7 +120,7 @@ namespace OOX {
// Ищем файл с темами
pFile = pDocumentContainer->Find(OOX::FileTypes::Theme);
if (pFile.IsInit() && OOX::FileTypes::Theme == pFile->type())
m_pTheme = (OOX::CTheme*)pFile.operator->();
m_pTheme = (PPTX::Theme*)pFile.operator->();
else
m_pTheme = NULL;
}
......
......@@ -53,8 +53,8 @@
#include "Media/Image.h"
#include "Media/OleObject.h"
#include "HeaderFooter.h"
#include "Theme/Theme.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
#if !defined(_WIN32) && !defined (_WIN64)
#include <sys/stat.h>
......@@ -101,8 +101,6 @@ namespace OOX
Read( oFilePath );
}
public:
bool Read(const CPath& oFilePath);
bool Write(const CPath& oFilePath)
{
......@@ -129,10 +127,6 @@ namespace OOX
return true;
}
public:
OOX::CDocument *GetDocument () const
{
return m_pDocument;
......@@ -182,7 +176,7 @@ namespace OOX
return m_pPeople;
}
OOX::CTheme *GetTheme () const
PPTX::Theme *GetTheme () const
{
return m_pTheme;
}
......@@ -203,8 +197,6 @@ namespace OOX
return NULL;
}
public:
OOX::CApp *m_pApp;
OOX::CCore *m_pCore;
......@@ -219,7 +211,7 @@ namespace OOX
OOX::CCommentsExt *m_pCommentsExt;// word/commentsExtended.xml
OOX::CPeople *m_pPeople; // word/people.xml
OOX::CTheme *m_pTheme;
PPTX::Theme *m_pTheme;
};
} // OOX
......
......@@ -33,6 +33,7 @@
#include "../../XlsxFormat/Worksheets/Sparkline.h"
#include "../../XlsxFormat/Table/Table.h"
#include "../Diagram/DiagramData.h"
#include "../../XlsxFormat/Worksheets/ConditionalFormatting.h"
namespace OOX
{
......@@ -42,6 +43,15 @@ namespace OOX
{
m_oSparklineGroups.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)
{
......@@ -50,6 +60,7 @@ namespace OOX
if ((m_sUri.IsInit()) && (*m_sUri == L"{63B3BB69-23CF-44E3-9099-C40C66FF867C}" ||
*m_sUri == L"{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" ||
*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"))
{
int nCurDepth = oReader.GetDepth();
......@@ -72,6 +83,17 @@ namespace OOX
{
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
......
......@@ -42,6 +42,7 @@ namespace OOX
{
class CSparklineGroups;
class CAltTextTable;
class CConditionalFormatting;
}
namespace Drawing
{
......@@ -194,6 +195,8 @@ namespace OOX
nullable<OOX::Spreadsheet::CSparklineGroups> m_oSparklineGroups;
nullable<CDataModelExt> m_oDataModelExt;
nullable<OOX::Spreadsheet::CAltTextTable> m_oAltTextTable;
std::vector<OOX::Spreadsheet::CConditionalFormatting*> m_arrConditionalFormatting;
};
//--------------------------------------------------------------------------------
// COfficeArtExtensionList 20.1.2.2.15 (Part 1)
......
This diff is collapsed.
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