Commit a9fb2ecc authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

fix Win32 build

fix linux build

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59519 954022d7-b5bf-4e40-9824-e11837661b57
parent ba0f88a9
...@@ -47,8 +47,10 @@ namespace Writers ...@@ -47,8 +47,10 @@ namespace Writers
CString sRelPath = _T("/word/charts/") + elem->filename; CString sRelPath = _T("/word/charts/") + elem->filename;
CString sAbsPath = m_sDir + sRelPath; CString sAbsPath = m_sDir + sRelPath;
OOX::CPath filePath = sAbsPath;
CFile oFile; CFile oFile;
oFile.CreateFile(sAbsPath); oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n"))); oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\r\n")));
oFile.WriteStringUTF8(elem->content); oFile.WriteStringUTF8(elem->content);
oFile.CloseFile(); oFile.CloseFile();
......
...@@ -34,8 +34,10 @@ namespace Writers ...@@ -34,8 +34,10 @@ namespace Writers
{ {
if(false == m_sComment.IsEmpty()) if(false == m_sComment.IsEmpty())
{ {
OOX::CPath filePath = m_sDir + _T("\\word\\comments.xml");
CFile oFile; CFile oFile;
oFile.CreateFile(m_sDir + _T("\\word\\comments.xml")); oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(g_string_comment_Start); oFile.WriteStringUTF8(g_string_comment_Start);
oFile.WriteStringUTF8(m_sComment); oFile.WriteStringUTF8(m_sComment);
oFile.WriteStringUTF8(g_string_comment_End); oFile.WriteStringUTF8(g_string_comment_End);
......
...@@ -27,9 +27,11 @@ namespace Writers ...@@ -27,9 +27,11 @@ namespace Writers
m_oWriter.Write(m_oAdditional); m_oWriter.Write(m_oAdditional);
m_oWriter.WriteString(g_string_ct_End); m_oWriter.WriteString(g_string_ct_End);
OOX::CPath filePath = m_sDir + _T("/[Content_Types].xml");
CFile oFile; CFile oFile;
oFile.CreateFile(filePath.GetPath());
oFile.CreateFile (m_sDir + _T("/[Content_Types].xml"));
oFile.WriteStringUTF8(m_oWriter.GetData()); oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile(); oFile.CloseFile();
} }
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "../../XlsxSerializerCom/Common/Common.h" #include "../../XlsxSerializerCom/Common/Common.h"
#include "../BinWriter/BinReaderWriterDefines.h"; #include "../BinWriter/BinReaderWriterDefines.h";
namespace Writers namespace Writers
{ {
class DocumentWriter : public ContentWriter class DocumentWriter : public ContentWriter
...@@ -17,8 +18,10 @@ namespace Writers ...@@ -17,8 +18,10 @@ namespace Writers
} }
void Write() void Write()
{ {
OOX::CPath filePath = m_sDir + _T("\\word\\document.xml");
CFile oFile; CFile oFile;
oFile.CreateFile(m_sDir + _T("\\word\\document.xml")); oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\"><w:body>"))); oFile.WriteStringUTF8(CString(_T("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><w:document xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" xmlns:o=\"urn:schemas-microsoft-com:office:office\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" xmlns:w10=\"urn:schemas-microsoft-com:office:word\" xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" mc:Ignorable=\"w14 wp14\"><w:body>")));
oFile.WriteStringUTF8(m_oContent.GetData()); oFile.WriteStringUTF8(m_oContent.GetData());
oFile.WriteStringUTF8(CString(_T("<w:sectPr >"))); oFile.WriteStringUTF8(CString(_T("<w:sectPr >")));
......
...@@ -22,6 +22,7 @@ namespace Writers ...@@ -22,6 +22,7 @@ namespace Writers
NSBinPptxRW::CDrawingConverter* m_pDrawingConverter; NSBinPptxRW::CDrawingConverter* m_pDrawingConverter;
CString m_sThemePath; CString m_sThemePath;
bool m_bSaveChartAsImg; bool m_bSaveChartAsImg;
ContentTypesWriter m_oContentTypesWriter; ContentTypesWriter m_oContentTypesWriter;
FontTableWriter m_oFontTableWriter; FontTableWriter m_oFontTableWriter;
DocumentWriter m_oDocumentWriter; DocumentWriter m_oDocumentWriter;
...@@ -32,6 +33,7 @@ namespace Writers ...@@ -32,6 +33,7 @@ namespace Writers
SettingWriter m_oSettingWriter; SettingWriter m_oSettingWriter;
CommentsWriter m_oCommentsWriter; CommentsWriter m_oCommentsWriter;
ChartWriter m_oChartWriter; ChartWriter m_oChartWriter;
int m_nDocPrIndex; int m_nDocPrIndex;
BinDocxRW::CComments* m_pComments; BinDocxRW::CComments* m_pComments;
public: public:
......
...@@ -68,8 +68,11 @@ namespace Writers ...@@ -68,8 +68,11 @@ namespace Writers
} }
void WriteItem(CString sHeader, CString& sFilename, ContentWriter& m_oWriter, bool bHeader) void WriteItem(CString sHeader, CString& sFilename, ContentWriter& m_oWriter, bool bHeader)
{ {
OOX::CPath filePath = m_sDir + _T("\\word\\") + sFilename;
CFile oFile; CFile oFile;
oFile.CreateFile(m_sDir + _T("\\word\\" + sFilename)); oFile.CreateFile(filePath.GetPath());
if(bHeader) if(bHeader)
oFile.WriteStringUTF8(g_string_hdr_Start); oFile.WriteStringUTF8(g_string_hdr_Start);
else else
......
...@@ -18,10 +18,12 @@ namespace Writers ...@@ -18,10 +18,12 @@ namespace Writers
{ {
nImageCount = 0; nImageCount = 0;
m_sMediaDir = m_sDir + _T("\\word\\media"); m_sMediaDir = m_sDir + _T("\\word\\media");
OOX::CPath filePath = m_sMediaDir;
m_sMediaDir = filePath.GetDirectory();
} }
CString AddImageGetNewPath() CString AddImageGetNewPath()
{ {
if( !NSDirectory::Exists(string2std_string(m_sMediaDir)) )
OOX::CSystemUtility::CreateDirectories(m_sMediaDir); OOX::CSystemUtility::CreateDirectories(m_sMediaDir);
CString sNewImgName;sNewImgName.Format(_T("image%d.jpg"), (nImageCount + 1)); CString sNewImgName;sNewImgName.Format(_T("image%d.jpg"), (nImageCount + 1));
......
...@@ -34,8 +34,11 @@ namespace Writers ...@@ -34,8 +34,11 @@ namespace Writers
m_oWriter.Write(m_oNumList); m_oWriter.Write(m_oNumList);
m_oWriter.WriteString(g_string_n_End); m_oWriter.WriteString(g_string_n_End);
OOX::CPath filePath = m_sDir + _T("\\word\\numbering.xml");
CFile oFile; CFile oFile;
oFile.CreateFile(m_sDir + _T("\\word\\numbering.xml")); oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(m_oWriter.GetData()); oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile(); oFile.CloseFile();
......
...@@ -21,8 +21,10 @@ namespace Writers ...@@ -21,8 +21,10 @@ namespace Writers
void Write() void Write()
{ {
Prepare(); Prepare();
OOX::CPath filePath = m_sDir + _T("\\word\\settings.xml");
CFile oFile; CFile oFile;
oFile.CreateFile(m_sDir + _T("\\word\\settings.xml")); oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(g_string_set_Start); oFile.WriteStringUTF8(g_string_set_Start);
oFile.WriteStringUTF8(m_oSettingWriter.GetData()); oFile.WriteStringUTF8(m_oSettingWriter.GetData());
oFile.WriteStringUTF8(g_string_set_Default); oFile.WriteStringUTF8(g_string_set_Default);
......
...@@ -48,8 +48,11 @@ namespace Writers ...@@ -48,8 +48,11 @@ namespace Writers
m_oWriter.Write(m_Styles); m_oWriter.Write(m_Styles);
m_oWriter.WriteString(g_string_st_End); m_oWriter.WriteString(g_string_st_End);
OOX::CPath filePath = m_sDir + _T("\\word\\styles.xml");
CFile oFile; CFile oFile;
oFile.CreateFile(m_sDir + _T("\\word\\styles.xml")); oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(m_oWriter.GetData()); oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile(); oFile.CloseFile();
} }
......
...@@ -65,8 +65,11 @@ namespace Writers ...@@ -65,8 +65,11 @@ namespace Writers
m_oWriter.WriteString(g_string_ft_End); m_oWriter.WriteString(g_string_ft_End);
OOX::CPath filePath = m_sDir + _T("\\word\\fontTable.xml");
CFile oFile; CFile oFile;
oFile.CreateFile(m_sDir + _T("\\word\\fontTable.xml")); oFile.CreateFile(filePath.GetPath());
oFile.WriteStringUTF8(m_oWriter.GetData()); oFile.WriteStringUTF8(m_oWriter.GetData());
oFile.CloseFile(); oFile.CloseFile();
} }
......
...@@ -28,6 +28,10 @@ ...@@ -28,6 +28,10 @@
#define DOUBLE_MAIN 10000 #define DOUBLE_MAIN 10000
#ifdef _WIN32
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
#endif
namespace NSBinPptxRW namespace NSBinPptxRW
{ {
inline LONG __strlen(const char* str) inline LONG __strlen(const char* str)
......
...@@ -118,8 +118,27 @@ namespace NSDirectory ...@@ -118,8 +118,27 @@ namespace NSDirectory
return oArray; return oArray;
} }
static bool Exists(const std::wstring& strDirectory)
{
#ifdef WIN32
DWORD dwAttrib = ::GetFileAttributesW(strDirectory.c_str());
return (dwAttrib != INVALID_FILE_ATTRIBUTES && 0 != (dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
#elif LINUX
BYTE* pUtf8 = NULL;
LONG lLen = 0;
NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strDirectory.c_str(), strDirectory.length(), pUtf8, lLen, false);
struct stat st;
bool bRes = (0 == stat((char*)pUtf8, &st)) && S_ISDIR(st.st_mode);
delete [] pUtf8;
return bRes;
#elif MAC
return true;
#endif
}
static bool CreateDirectory(const std::wstring& strDirectory) static bool CreateDirectory(const std::wstring& strDirectory)
{ {
if (Exists(strDirectory) == true) return true;
#ifdef WIN32 #ifdef WIN32
return FALSE != ::CreateDirectoryW(strDirectory.c_str(), NULL); return FALSE != ::CreateDirectoryW(strDirectory.c_str(), NULL);
#elif LINUX #elif LINUX
...@@ -158,23 +177,6 @@ namespace NSDirectory ...@@ -158,23 +177,6 @@ namespace NSDirectory
rmdir((char*)pUtf8); rmdir((char*)pUtf8);
delete [] pUtf8; delete [] pUtf8;
#elif MAC #elif MAC
#endif
}
static bool Exists(const std::wstring& strDirectory)
{
#ifdef WIN32
DWORD dwAttrib = ::GetFileAttributesW(strDirectory.c_str());
return (dwAttrib != INVALID_FILE_ATTRIBUTES && 0 != (dwAttrib & FILE_ATTRIBUTE_DIRECTORY));
#elif LINUX
BYTE* pUtf8 = NULL;
LONG lLen = 0;
NSFile::CUtf8Converter::GetUtf8StringFromUnicode(strDirectory.c_str(), strDirectory.length(), pUtf8, lLen, false);
struct stat st;
bool bRes = (0 == stat((char*)pUtf8, &st)) && S_ISDIR(st.st_mode);
delete [] pUtf8;
return bRes;
#elif MAC
return true;
#endif #endif
} }
} }
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
#include <wchar.h> #include <wchar.h>
#endif #endif
#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
namespace NSFile namespace NSFile
{ {
#define WriteUtf16_WCHAR(code, p) \ #define WriteUtf16_WCHAR(code, p) \
......
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