diff --git a/ASCOfficeDocxFile2/ASCOfficeDocxFile2.rc b/ASCOfficeDocxFile2/ASCOfficeDocxFile2.rc
index 3c3b8f7162..586bd36887 100644
--- a/ASCOfficeDocxFile2/ASCOfficeDocxFile2.rc
+++ b/ASCOfficeDocxFile2/ASCOfficeDocxFile2.rc
@@ -137,12 +137,6 @@ END
// Generated from the TEXTINCLUDE 3 resource.
//
-//IDB_DEFAULT_DOC_RELS DOCXWR "Resources\\.rels"
-//IDB_DEFAULT_DOC_APP DOCXWR "Resources\\app.xml"
-//IDB_DEFAULT_DOC_CORE DOCXWR "Resources\\core.xml"
-//IDB_DEFAULT_DOC_THEME DOCXWR "Resources\\theme.xml"
-//IDB_DEFAULT_DOC_WEBSETTINGS DOCXWR "Resources\\webSettings.xml"
-IDB_DEFAULT_XLSX_THEME XLSXSER "..\\XlsxSerializerCom\\Resource\\theme1.xml"
IDB_XML_NOTESTHEME PPTXW "..\\ASCOfficePPTXFile\\Editor\\ResourceFiles\\notesTheme.xml"
IDB_XML_NOTESMASTER PPTXW "..\\ASCOfficePPTXFile\\Editor\\ResourceFiles\\notesMaster.xml"
/////////////////////////////////////////////////////////////////////////////
diff --git a/ASCOfficeDocxFile2/BinReader/DefaultThemeWriterWin.h b/ASCOfficeDocxFile2/BinReader/DefaultThemeWriterWin.h
index 1e1d43f9cf..fbfa676c1e 100644
Binary files a/ASCOfficeDocxFile2/BinReader/DefaultThemeWriterWin.h and b/ASCOfficeDocxFile2/BinReader/DefaultThemeWriterWin.h differ
diff --git a/ASCOfficeDocxFile2/BinReader/DocumentRelsWriter.h b/ASCOfficeDocxFile2/BinReader/DocumentRelsWriter.h
index 14ceb5602b..d57b35b4f0 100644
--- a/ASCOfficeDocxFile2/BinReader/DocumentRelsWriter.h
+++ b/ASCOfficeDocxFile2/BinReader/DocumentRelsWriter.h
@@ -18,11 +18,11 @@ namespace Writers
CString s_Common;
s_Common = _T(" \
- \
- \
- \
- \
- ");
+ \
+ \
+ \
+ \
+");
m_oWriter.WriteString(s_Common);
diff --git a/ASCOfficeDocxFile2/BinReader/FileWriter.h b/ASCOfficeDocxFile2/BinReader/FileWriter.h
index 7d66ad0da7..f98ebbaa77 100644
--- a/ASCOfficeDocxFile2/BinReader/FileWriter.h
+++ b/ASCOfficeDocxFile2/BinReader/FileWriter.h
@@ -61,7 +61,6 @@ namespace Writers
m_oChartWriter(sDirOutput, m_oContentTypesWriter),
m_oDocumentRelsWriter(sDirOutput),
m_oWebSettingsWriter(sDirOutput),
- m_oDefaultTheme(sDirOutput),
m_nDocPrIndex(0),
m_pComments(NULL)
{
diff --git a/ASCOfficeDocxFile2/BinReader/Readers.h b/ASCOfficeDocxFile2/BinReader/Readers.h
index 4bb5ff369a..92dd1725f6 100644
--- a/ASCOfficeDocxFile2/BinReader/Readers.h
+++ b/ASCOfficeDocxFile2/BinReader/Readers.h
@@ -5549,10 +5549,10 @@ public:
{
if(false == m_oFileWriter.m_bSaveChartAsImg)
{
- OOX::CPath pathChartsDir = m_oFileWriter.m_oChartWriter.m_sDir + _T("\\word\\charts");
+ OOX::CPath pathChartsDir = m_oFileWriter.m_oChartWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR +_T("charts");
OOX::CSystemUtility::CreateDirectories(pathChartsDir.GetPath());
- OOX::CPath pathChartsRelsDir = pathChartsDir.GetPath() + _T("\\_rels");
+ OOX::CPath pathChartsRelsDir = pathChartsDir.GetPath() + FILE_SEPARATOR_STR + _T("_rels");
OOX::CSystemUtility::CreateDirectories(pathChartsRelsDir.GetPath());
m_oFileWriter.m_pDrawingConverter->SetDstContentRels();
@@ -5579,7 +5579,7 @@ public:
m_oFileWriter.m_oChartWriter.AddChart(sChartContent, sRelsName, sFilename, nChartIndex);
m_oFileWriter.m_oContentTypesWriter.AddOverrideRaw(oSaveParams.sAdditionalContentTypes);
- OOX::CPath pathChartsRels = pathChartsRelsDir.GetPath() + _T("\\") + sFilename + _T(".rels");
+ OOX::CPath pathChartsRels = pathChartsRelsDir.GetPath() + FILE_SEPARATOR_STR + sFilename + _T(".rels");
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(pathChartsRels.GetPath());
long rId;
@@ -5945,7 +5945,9 @@ int Binary_HdrFtrTableReader::ReadHdrFtrItem(BYTE type, long length, void* poRes
Binary_DocumentTableReader oBinary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, poHdrFtrItem->Header, m_pComments);
res = Read1(length, &Binary_HdrFtrTableReader::ReadHdrFtrItemContent, this, &oBinary_DocumentTableReader);
- OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + _T("\\word\\_rels\\") + poHdrFtrItem->m_sFilename + _T(".rels");
+ OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word") +
+ FILE_SEPARATOR_STR + _T("_rels")+
+ FILE_SEPARATOR_STR + poHdrFtrItem->m_sFilename + _T(".rels");
m_oFileWriter.m_pDrawingConverter->SaveDstContentRels(fileRelsPath.GetPath());
}
@@ -6136,7 +6138,9 @@ public: BinaryFileReader(CString& sFileInDir, NSBinPptxRW::CBinaryFileReader& oB
}
res = Binary_DocumentTableReader(m_oBufferedStream, m_oFileWriter, m_oFileWriter.m_oDocumentWriter, &oBinary_CommentsTableReader.m_oComments).Read();
- OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + _T("\\word\\_rels\\document.xml.rels");
+ OOX::CPath fileRelsPath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + _T("word")
+ + FILE_SEPARATOR_STR + _T("_rels")
+ + FILE_SEPARATOR_STR + _T("document.xml.rels");
CComments& oComments = oBinary_CommentsTableReader.m_oComments;
Writers::CommentsWriter& oCommentsWriter = m_oFileWriter.m_oCommentsWriter;
diff --git a/ASCOfficeDocxFile2/BinReader/webSettingsWriter.h b/ASCOfficeDocxFile2/BinReader/webSettingsWriter.h
index 9d1f17334f..1d6c1f9b0b 100644
--- a/ASCOfficeDocxFile2/BinReader/webSettingsWriter.h
+++ b/ASCOfficeDocxFile2/BinReader/webSettingsWriter.h
@@ -18,9 +18,9 @@ namespace Writers
CString s_Common;
s_Common = _T(" \
- \
- \
- ");
+ \
+ \
+");
m_oWriter.WriteString(s_Common);
diff --git a/ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp b/ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
index fc5309002f..a354679287 100644
--- a/ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
+++ b/ASCOfficeDocxFile2/DocWrapper/DocxSerializer.cpp
@@ -241,7 +241,8 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
var.bstrVal = sFileInDir.GetString();
oDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir"), var);
#endif
-// m_pCurFileWriter->m_oDefaultTheme.Write();
+ //default theme
+ m_pCurFileWriter->m_oDefaultTheme.Write(sThemePath);
BinaryFileReader oBinaryFileReader(sFileInDir, oBufferedStream, *m_pCurFileWriter);
oBinaryFileReader.ReadFile();
@@ -264,7 +265,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
pApp->SetSharedDoc(false);
pApp->SetHyperlinksChanged(false);
- pApp->write(pathDocProps + _T("//app.xml"), DocProps, oContentTypes);
+ pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, oContentTypes);
delete pApp;
}
OOX::CCore* pCore = new OOX::CCore();
@@ -272,9 +273,9 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
{
pCore->SetCreator(_T(""));
pCore->SetLastModifiedBy(_T(""));
- pCore->write(pathDocProps + _T("//core.xml"), DocProps, oContentTypes);
+ pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, oContentTypes);
delete pCore;
- }
+ }
/////////////////////////////////////////////////////////////////////////////////////
VARIANT vt;
oDrawingConverter.GetAdditionalParam(CString(_T("ContentTypes")), &vt);
diff --git a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
index 0e807f3cfd..99087598ef 100644
--- a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
+++ b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.cpp
@@ -7,6 +7,12 @@
#include "../../XlsxSerializerCom/Writer/BinaryReader.h"
#include "../../ASCOfficePPTXFile/Editor/FontPicker.h"
+#ifdef _WIN32
+ #include "../BinReader/DefaultThemeWriterWin.h"
+#else
+ #include "../BinReader/DefaultThemeWriterLinux.h"
+#endif
+
namespace BinXlsxRW{
int g_nCurFormatVersion = 0;
@@ -17,6 +23,41 @@ namespace BinXlsxRW{
CXlsxSerializer::~CXlsxSerializer()
{
}
+
+ void CXlsxSerializer::CreateXlsxFolders(CString& sXmlOptions, CString sDstPath, CString& sMediaPath)
+ {
+ OOX::CPath pathMediaDir = sDstPath + _T("\\xl\\media");
+
+ // File Type (Ìîæíî ïàðñèòü íå äâà ðàçà, à îäèí, åñëè ïåðåäàâàòü â ReadFile íå îïöèè, à ïàðàìåòðû)
+ BYTE fileType;
+ UINT nCodePage;
+ WCHAR wcDelimiter;
+ SerializeCommon::ReadFileType(sXmlOptions, fileType, nCodePage, wcDelimiter);
+
+ if (c_oFileTypes::CSV != fileType)
+ {
+ OOX::CPath pathXlDir = sDstPath + _T("\\xl");
+
+ OOX::CPath pathThemeDir = pathXlDir + FILE_SEPARATOR_STR + OOX::FileTypes::Theme.DefaultDirectory().GetPath();
+
+ OOX::CPath pathThemeFile = pathThemeDir + FILE_SEPARATOR_STR + OOX::FileTypes::Theme.DefaultFileName().GetPath();
+
+ OOX::CPath pathThemeThemeRelsDir = pathThemeDir + _T("\\_rels");
+
+ NSDirectory::CreateDirectory(string2std_string(pathXlDir.GetPath()));
+ NSDirectory::CreateDirectory(string2std_string(pathThemeDir.GetPath()));
+ NSDirectory::CreateDirectory(string2std_string(pathThemeThemeRelsDir.GetPath()));
+ NSDirectory::CreateDirectory(string2std_string(pathMediaDir.GetPath()));
+
+ //Create Default Theme
+ {
+ Writers::DefaultThemeWriter oDefaultThemeWriter;
+ oDefaultThemeWriter.Write(pathThemeFile.GetPath());
+ }
+ }
+
+ sMediaPath = pathMediaDir.GetPath();
+ }
bool CXlsxSerializer::loadFromFile(CString& sSrcFileName, CString& sDstPath, CString& sXMLOptions, CString& sMediaDir)
{
NSBinPptxRW::CDrawingConverter oOfficeDrawingConverter;
diff --git a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h
index c7574461ee..9345c7d91f 100644
--- a/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h
+++ b/ASCOfficeDocxFile2/DocWrapper/XlsxSerializer.h
@@ -25,10 +25,15 @@ namespace BinXlsxRW {
public:
CXlsxSerializer();
~CXlsxSerializer();
+
+ void CreateXlsxFolders(CString& sXmlOptions, CString sDstPath, CString& sMediaPath);
+
bool loadFromFile(CString& sSrcFileName, CString& sDstPath, CString& sXMLOptions, CString& sMediaDir);
bool saveToFile(CString& sSrcFileName, CString& sDstPath, CString& sXMLOptions);
+
bool loadChart(CString& sChartPath, NSBinPptxRW::CBinaryFileWriter& oBufferedStream, long& lDataSize);
bool saveChart(NSBinPptxRW::CBinaryFileReader& oBufferedStream, long lLength, CString& sFilename, CString& sContentTypePath, CString** sContentTypeElement);
+
void setFontDir(CString& sFontDir);
void setEmbeddedFontsDir(CString& sEmbeddedFontsDir);
void setDrawingConverter(NSBinPptxRW::CDrawingConverter* pDrawingConverter);
diff --git a/ASCOfficeDocxFile2/DocxFile2.h b/ASCOfficeDocxFile2/DocxFile2.h
index 61a34ff4c8..ca0a3f9b27 100644
--- a/ASCOfficeDocxFile2/DocxFile2.h
+++ b/ASCOfficeDocxFile2/DocxFile2.h
@@ -149,21 +149,4 @@ public:
return bRes ? S_OK : S_FALSE;
}
private:
- //void LoadResourceFile(HINSTANCE hInst, LPCTSTR sResName, LPCTSTR sResType, const CString& strDstFile)
- //{
- // HRSRC hrRes = FindResource(hInst, sResName, sResType);
- // if (!hrRes)
- // return;
-
- // HGLOBAL hGlobal = LoadResource(hInst, hrRes);
- // DWORD sz = SizeofResource(hInst, hrRes);
- // void* ptrRes = LockResource(hGlobal);
-
- // CFile oFile;
- // oFile.CreateFile(strDstFile);
- // oFile.WriteFile(ptrRes, sz);
-
- // UnlockResource(hGlobal);
- // FreeResource(hGlobal);
- //}
};
\ No newline at end of file
diff --git a/ASCOfficeDocxFile2/XlsxFile2.h b/ASCOfficeDocxFile2/XlsxFile2.h
index c0ae9eec82..5de02128ab 100644
--- a/ASCOfficeDocxFile2/XlsxFile2.h
+++ b/ASCOfficeDocxFile2/XlsxFile2.h
@@ -59,32 +59,11 @@ public:
STDMETHOD(LoadFromFile)(BSTR sSrcFileName, BSTR bstrDstPath, BSTR bstrXMLOptions)
{
CString sDstPath = bstrDstPath;
- OOX::CPath pathMediaDir = sDstPath + _T("\\xl\\media");
+ CString sMediaPath;
- // File Type (Ìîæíî ïàðñèòü íå äâà ðàçà, à îäèí, åñëè ïåðåäàâàòü â ReadFile íå îïöèè, à ïàðàìåòðû)
- BYTE fileType;
- UINT nCodePage;
- WCHAR wcDelimiter;
- SerializeCommon::ReadFileType(CString(bstrXMLOptions), fileType, nCodePage, wcDelimiter);
+ m_oXlsxSerializer.CreateXlsxFolders(CString(bstrXMLOptions), sDstPath, sMediaPath);
- if (BinXlsxRW::c_oFileTypes::CSV != fileType)
- {
- OOX::CPath pathXlDir = sDstPath + _T("\\xl");
-
- OOX::CPath pathThemeDir = pathXlDir + FILE_SEPARATOR_STR + OOX::FileTypes::Theme.DefaultDirectory().GetPath();
-
- OOX::CPath pathThemeFile = pathThemeDir + FILE_SEPARATOR_STR + OOX::FileTypes::Theme.DefaultFileName().GetPath();
-
- OOX::CPath pathThemeThemeRelsDir = pathThemeDir + _T("\\_rels");
-
- NSDirectory::CreateDirectory(string2std_string(pathXlDir.GetPath()));
- NSDirectory::CreateDirectory(string2std_string(pathThemeDir.GetPath()));
- NSDirectory::CreateDirectory(string2std_string(pathThemeThemeRelsDir.GetPath()));
- NSDirectory::CreateDirectory(string2std_string(pathMediaDir.GetPath()));
-
- CreateTheme(pathThemeFile.GetPath());
- }
- bool bRes = m_oXlsxSerializer.loadFromFile(CString(sSrcFileName), CString(sDstPath), CString(bstrXMLOptions), pathMediaDir.GetPath());
+ bool bRes = m_oXlsxSerializer.loadFromFile(CString(sSrcFileName), sDstPath, CString(bstrXMLOptions), sMediaPath);
return bRes ? S_OK : S_FALSE;
}
STDMETHOD(SaveToFile)(BSTR sDstFileName, BSTR sSrcPath, BSTR sXMLOptions)
@@ -148,26 +127,5 @@ public:
return S_OK;
}
private:
- void CreateTheme(CString sThemePath)
- {
- HINSTANCE hInst = _AtlBaseModule.GetModuleInstance();
- LoadResourceFile(hInst, MAKEINTRESOURCE(IDB_DEFAULT_XLSX_THEME), _T("XLSXSER"), sThemePath);
- }
- void LoadResourceFile(HINSTANCE hInst, LPCTSTR sResName, LPCTSTR sResType, const CString& strDstFile)
- {
- HRSRC hrRes = FindResource(hInst, sResName, sResType);
- if (!hrRes)
- return;
- HGLOBAL hGlobal = LoadResource(hInst, hrRes);
- DWORD sz = SizeofResource(hInst, hrRes);
- void* ptrRes = LockResource(hGlobal);
-
- CFile oFile;
- oFile.CreateFile(strDstFile);
- oFile.WriteFile(ptrRes, sz);
-
- UnlockResource(hGlobal);
- FreeResource(hGlobal);
- }
};
\ No newline at end of file
diff --git a/Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.cpp b/Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.cpp
index 0064a21fd1..00af9659ce 100644
--- a/Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.cpp
+++ b/Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.cpp
@@ -2,6 +2,11 @@
#include
+#ifndef FILE_SEPARATOR
+ #define FILE_SEPARATOR
+ #define FILE_SEPARATOR_CHAR '\\'
+ #define FILE_SEPARATOR_STR _T("\\")
+#endif
namespace FileSystem
{
@@ -44,7 +49,7 @@ namespace FileSystem
bool Directory::CreateDirectory(String strFolderPathRoot, String strFolderName)
{
String strFolder = strFolderPathRoot;
- strFolder += _T("/");
+ strFolder += FILE_SEPARATOR_STR;
strFolder += strFolderName;
return CreateDirectory(strFolder);
}
diff --git a/Common/DocxFormat/Source/SystemUtility/SystemUtility.cpp b/Common/DocxFormat/Source/SystemUtility/SystemUtility.cpp
index 535feddf41..efdf71150d 100644
--- a/Common/DocxFormat/Source/SystemUtility/SystemUtility.cpp
+++ b/Common/DocxFormat/Source/SystemUtility/SystemUtility.cpp
@@ -162,7 +162,7 @@ namespace OOX
bool CSystemUtility::CreateDirectories(const CPath& oPath)
{
- return FileSystem::Directory::CreateDirectories(oPath.m_strFilename);
+ return FileSystem::Directory::CreateDirectory(oPath.GetPath());
}
void CSystemUtility::ReplaceExtention(CString& strName, CString& str1, CString& str2)
diff --git a/Common/DocxFormat/Source/XlsxFormat/Xlsx.h b/Common/DocxFormat/Source/XlsxFormat/Xlsx.h
index 3b51290d73..ba87e878cd 100644
--- a/Common/DocxFormat/Source/XlsxFormat/Xlsx.h
+++ b/Common/DocxFormat/Source/XlsxFormat/Xlsx.h
@@ -154,7 +154,7 @@ namespace OOX
CPath oXlPath = oDirPath / m_pWorkbook->DefaultDirectory();
WriteWorkbook(oXlPath);
- IFileContainer::Write(oDirPath / _T("/"), OOX::CPath(_T("")), oContentTypes);
+ IFileContainer::Write(oDirPath / FILE_SEPARATOR_STR , OOX::CPath(_T("")), oContentTypes);
if(!sAdditionalContentTypes.IsEmpty())
{
CString sAdditionalContentTypesWrapped;
diff --git a/XlsxSerializerCom/Resource/theme1.xml b/XlsxSerializerCom/Resource/theme1.xml
deleted file mode 100644
index 012e24966b..0000000000
--- a/XlsxSerializerCom/Resource/theme1.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file