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

linux

docx->doct->docx 
xlsx->xlst->xlsx

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59556 954022d7-b5bf-4e40-9824-e11837661b57
parent b91807ee
......@@ -34,7 +34,7 @@ namespace Writers
{
if(false == m_sComment.IsEmpty())
{
OOX::CPath filePath = m_sDir + _T("\\word\\comments.xml");
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("comments.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
......@@ -52,7 +52,7 @@ namespace Writers
if(false == m_sCommentExt.IsEmpty())
{
CFile oFile;
oFile.CreateFile(m_sDir + _T("\\word\\commentsExtended.xml"));
oFile.CreateFile(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("commentsExtended.xml"));
oFile.WriteStringUTF8(g_string_commentExt_Start);
oFile.WriteStringUTF8(m_sCommentExt);
oFile.WriteStringUTF8(g_string_commentExt_End);
......@@ -64,7 +64,7 @@ namespace Writers
if(false == m_sPeople.IsEmpty())
{
CFile oFile;
oFile.CreateFile(m_sDir + _T("\\word\\people.xml"));
oFile.CreateFile(m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("people.xml"));
oFile.WriteStringUTF8(g_string_people_Start);
oFile.WriteStringUTF8(m_sPeople);
oFile.WriteStringUTF8(g_string_people_End);
......@@ -76,4 +76,4 @@ namespace Writers
}
};
}
#endif // #ifndef COMMENTS_WRITER
\ No newline at end of file
#endif // #ifndef COMMENTS_WRITER
......@@ -8,12 +8,11 @@ namespace Writers
class DefaultThemeWriter
{
XmlUtils::CStringWriter m_oWriter;
CString m_sDir;
public:
DefaultThemeWriter(CString sDir):m_sDir(sDir)
DefaultThemeWriter()
{
}
void Write()
void Write(CString sThemeFilePath)
{
CString s_Common;
......@@ -303,7 +302,7 @@ s_Common +=
m_oWriter.WriteString(s_Common);
OOX::CPath fileName = m_sDir + _T("\\word\\theme\\theme1.xml");
OOX::CPath fileName = sThemeFilePath;
CFile oFile;
oFile.CreateFile(fileName.GetPath());
......
......@@ -26,7 +26,7 @@ namespace Writers
m_oWriter.WriteString(s_Common);
OOX::CPath fileName = m_sDir + _T("\\_rels\\.rels");
OOX::CPath fileName = m_sDir + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR + _T(".rels");
CFile oFile;
oFile.CreateFile(fileName.GetPath());
......
......@@ -18,7 +18,7 @@ namespace Writers
}
void Write()
{
OOX::CPath filePath = m_sDir + _T("\\word\\document.xml");
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + _T("word") +FILE_SEPARATOR_STR + _T("document.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
......@@ -84,4 +84,4 @@ namespace Writers
}
};
}
#endif // #ifndef DOCUMENT_WRITER
\ No newline at end of file
#endif // #ifndef DOCUMENT_WRITER
......@@ -68,7 +68,7 @@ namespace Writers
}
void WriteItem(CString sHeader, CString& sFilename, ContentWriter& m_oWriter, bool bHeader)
{
OOX::CPath filePath = m_sDir + _T("\\word\\") + sFilename;
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + sFilename;
CFile oFile;
oFile.CreateFile(filePath.GetPath());
......@@ -92,4 +92,4 @@ namespace Writers
}
};
}
#endif // #ifndef HEADER_FOOTER_WRITER
\ No newline at end of file
#endif // #ifndef HEADER_FOOTER_WRITER
......@@ -17,17 +17,17 @@ namespace Writers
MediaWriter(CString sDir):m_sDir(sDir)
{
nImageCount = 0;
m_sMediaDir = m_sDir + _T("\\word\\media");
OOX::CPath filePath = m_sMediaDir;
m_sMediaDir = filePath.GetDirectory();
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR + _T("word") + FILE_SEPARATOR_STR + _T("media");
m_sMediaDir = filePath.GetPath();
}
CString AddImageGetNewPath()
{
OOX::CSystemUtility::CreateDirectories(m_sMediaDir);
CString sNewImgName;sNewImgName.Format(_T("image%d.jpg"), (nImageCount + 1));
CString sNewImg = m_sMediaDir + _T("/") + sNewImgName;
CString sNewImg = m_sMediaDir + FILE_SEPARATOR_STR + sNewImgName;
nImageCount++;
return sNewImg;
}
......@@ -54,10 +54,10 @@ namespace Writers
}
void AddImage(const CString& sImg)
{
CString sNewImg = AddImageGetNewPath();
OOX::CPath pathNewImg = AddImageGetNewPath();
NSFile::CFileBinary::Copy(string2std_string(sImg), string2std_string(sNewImg));
CString sFilename = NSSystemPath::GetFileName(string2std_string(sNewImg)).c_str();
NSFile::CFileBinary::Copy(string2std_string(sImg), string2std_string(pathNewImg.GetPath()));
CString sFilename = NSSystemPath::GetFileName(string2std_string(pathNewImg.GetPath())).c_str();
m_aImageNames.push_back(sFilename);
}
};
......
......@@ -34,7 +34,7 @@ namespace Writers
m_oWriter.Write(m_oNumList);
m_oWriter.WriteString(g_string_n_End);
OOX::CPath filePath = m_sDir + _T("\\word\\numbering.xml");
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("numbering.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
......@@ -50,4 +50,4 @@ namespace Writers
}
};
}
#endif // #ifndef NUMBERING_WRITER
\ No newline at end of file
#endif // #ifndef NUMBERING_WRITER
......@@ -2325,7 +2325,7 @@ public:
else
{
//local
sFilePath = m_sFileInDir + _T("media\\") + sImage;
sFilePath = m_sFileInDir + _T("media") + FILE_SEPARATOR_STR + sImage;
}
//
......@@ -5248,8 +5248,9 @@ public:
if(odocImg.MediaId >= 0 && odocImg.MediaId < m_oMediaWriter.nImageCount)
{
CString sNewImgName = m_oMediaWriter.m_aImageNames[odocImg.MediaId];
CString sNewImgRel;sNewImgRel = _T("media/") + sNewImgName;
sNewImgRel = XmlUtils::EncodeXmlString(sNewImgRel);
CString sNewImgRel = _T("media/") + sNewImgName;
sNewImgRel = XmlUtils::EncodeXmlString(sNewImgRel);
long rId;
m_oFileWriter.m_pDrawingConverter->WriteRels(CString(_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/image")), sNewImgRel, CString(), &rId);
odocImg.srId.Format(_T("rId%d"), rId);
......
......@@ -21,7 +21,7 @@ namespace Writers
void Write()
{
Prepare();
OOX::CPath filePath = m_sDir + _T("\\word\\settings.xml");
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("settings.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
......@@ -59,4 +59,4 @@ namespace Writers
}
};
}
#endif // #ifndef SETTING_WRITER
\ No newline at end of file
#endif // #ifndef SETTING_WRITER
......@@ -48,7 +48,7 @@ namespace Writers
m_oWriter.Write(m_Styles);
m_oWriter.WriteString(g_string_st_End);
OOX::CPath filePath = m_sDir + _T("\\word\\styles.xml");
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("styles.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
......@@ -58,4 +58,4 @@ namespace Writers
}
};
}
#endif // #ifndef STYLES_WRITER
\ No newline at end of file
#endif // #ifndef STYLES_WRITER
......@@ -65,7 +65,7 @@ namespace Writers
m_oWriter.WriteString(g_string_ft_End);
OOX::CPath filePath = m_sDir + _T("\\word\\fontTable.xml");
OOX::CPath filePath = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("fontTable.xml");
CFile oFile;
oFile.CreateFile(filePath.GetPath());
......@@ -107,4 +107,4 @@ namespace Writers
}
};
}
#endif // #ifndef FONT_TABLE_WRITER
\ No newline at end of file
#endif // #ifndef FONT_TABLE_WRITER
......@@ -24,7 +24,7 @@ namespace Writers
m_oWriter.WriteString(s_Common);
OOX::CPath fileName = m_sDir + _T("\\word\\webSettings.xml");
OOX::CPath fileName = m_sDir + FILE_SEPARATOR_STR +_T("word") + FILE_SEPARATOR_STR + _T("webSettings.xml");
CFile oFile;
oFile.CreateFile(fileName.GetPath());
......
......@@ -26,7 +26,7 @@ namespace BinXlsxRW{
void CXlsxSerializer::CreateXlsxFolders(CString& sXmlOptions, CString sDstPath, CString& sMediaPath)
{
OOX::CPath pathMediaDir = sDstPath + _T("\\xl\\media");
OOX::CPath pathMediaDir = sDstPath + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + _T("media");
// File Type ( , , ReadFile , )
BYTE fileType;
......@@ -36,13 +36,13 @@ namespace BinXlsxRW{
if (c_oFileTypes::CSV != fileType)
{
OOX::CPath pathXlDir = sDstPath + _T("\\xl");
OOX::CPath pathXlDir = sDstPath + FILE_SEPARATOR_STR + _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");
OOX::CPath pathThemeThemeRelsDir = pathThemeDir + FILE_SEPARATOR_STR + _T("_rels");
NSDirectory::CreateDirectory(string2std_string(pathXlDir.GetPath()));
NSDirectory::CreateDirectory(string2std_string(pathThemeDir.GetPath()));
......@@ -210,4 +210,4 @@ namespace BinXlsxRW{
{
m_pExternalDrawingConverter = pDrawingConverter;
}
};
\ No newline at end of file
};
......@@ -3129,7 +3129,7 @@ HRESULT CDrawingConverter::SaveThemeXml(LONG lStart, LONG lLength, const CString
m_pXmlWriter->SaveToFile(strThemePath);
OOX::CPath filename = strThemePath;
CString strTemp = filename.GetDirectory() + _T("\\_rels\\");
CString strTemp = filename.GetDirectory() + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR;
CString strFileName = filename.GetPath();
......
......@@ -274,7 +274,11 @@ HRESULT CPPTXFile::OpenFileToPPTY(BSTR bsInput, BSTR bsOutput)
m_strMediaDirectory = m_strMediaDirectory.Mid(0, nIndex);
oBinaryWriter.m_strMainFolder = m_strMediaDirectory;
m_strMediaDirectory = m_strMediaDirectory + _T("\\media");
m_strMediaDirectory = m_strMediaDirectory + FILE_SEPARATOR_STR + _T("media");
OOX::CPath pathMedia = m_strMediaDirectory;
m_strMediaDirectory = pathMedia.GetPath();
oBinaryWriter.m_pCommon->m_pImageManager->m_strDstMedia = m_strMediaDirectory;
FileSystem::Directory::CreateDirectory(m_strMediaDirectory);
......@@ -335,9 +339,12 @@ HRESULT CPPTXFile::OpenDirectoryToPPTY(BSTR bsInput, BSTR bsOutput)
m_strMediaDirectory = m_strMediaDirectory.Mid(0, nIndex);
oBinaryWriter.m_strMainFolder = m_strMediaDirectory;
m_strMediaDirectory = m_strMediaDirectory + _T("\\media");
oBinaryWriter.m_pCommon->m_pImageManager->m_strDstMedia = m_strMediaDirectory;
m_strMediaDirectory = m_strMediaDirectory + FILE_SEPARATOR_STR + _T("media");
OOX::CPath pathMedia = m_strMediaDirectory;
m_strMediaDirectory = pathMedia.GetPath();
oBinaryWriter.m_pCommon->m_pImageManager->m_strDstMedia = m_strMediaDirectory;
FileSystem::Directory::CreateDirectory(m_strMediaDirectory);
PPTX2EditorAdvanced::Convert(oBinaryWriter, *m_pFolder, m_strDirectory, sDstFileOutput);
......
......@@ -159,7 +159,7 @@ namespace NSBinPptxRW
{
strImage.Format(_T("image%d"), m_lIndexNextImage++);
CString strOutput = m_strDstMedia + _T("\\") + strImage + strExts;
OOX::CPath pathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImage + strExts;
if (!m_bIsWord)
strImage = _T("../media/") + strImage + strExts;
......@@ -173,9 +173,9 @@ namespace NSBinPptxRW
//
if (_T("") != strMetafileImage)
CDirectory::CopyFile(strMetafileImage, strOutput, NULL, NULL);
else if (strOutput != strInput)
CDirectory::CopyFile(strInput, strOutput, NULL, NULL);
CDirectory::CopyFile(strMetafileImage, pathOutput.GetPath(), NULL, NULL);
else if (pathOutput.GetPath() != strInput)
CDirectory::CopyFile(strInput, pathOutput.GetPath(), NULL, NULL);
}
else
{
......@@ -183,7 +183,7 @@ namespace NSBinPptxRW
strExts = _T(".png");
strImage.Format(_T("image%d"), m_lIndexNextImage++);
CString strOutput = m_strDstMedia + _T("/") + strImage + strExts;
OOX::CPath pathOutput = m_strDstMedia + FILE_SEPARATOR_STR + strImage + strExts;
if (!m_bIsWord)
strImage = _T("../media/") + strImage + strExts;
......@@ -195,7 +195,7 @@ namespace NSBinPptxRW
else
m_mapImages [strBase64Image] = strImage;
SaveImageAsPng(strInput, strOutput);
SaveImageAsPng(strInput, pathOutput.GetPath());
}
return strImage;
}
......
......@@ -69,7 +69,9 @@ namespace NSBinPptxRW
FileSystem::Directory::CreateDirectory(string2std_string(strPPT), _T("media"));
m_oImageManager.Clear();
m_oImageManager.SetDstMedia(m_strDstFolder + _T("\\ppt\\media"));
OOX::CPath pathMedia = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("media");
m_oImageManager.SetDstMedia(pathMedia.GetPath());
m_oReader.m_pRels->m_pManager = &m_oImageManager;
}
......@@ -578,28 +580,28 @@ namespace NSBinPptxRW
oXmlWriter.ClearNoAttack();
m_oApp.toXmlWriter(&oXmlWriter);
OOX::CPath pathApp = m_strDstFolder + _T("\\docProps\\app.xml");
OOX::CPath pathApp = m_strDstFolder + FILE_SEPARATOR_STR + _T("docProps") + FILE_SEPARATOR_STR + _T("app.xml");
oXmlWriter.SaveToFile(pathApp.GetPath());
// core
oXmlWriter.ClearNoAttack();
m_oCore.toXmlWriter(&oXmlWriter);
OOX::CPath pathCore = m_strDstFolder + _T("\\docProps\\core.xml");
OOX::CPath pathCore = m_strDstFolder + FILE_SEPARATOR_STR + _T("docProps") + FILE_SEPARATOR_STR + _T("core.xml");
oXmlWriter.SaveToFile(pathCore.GetPath());
// presProps
oXmlWriter.ClearNoAttack();
m_oPresProps.toXmlWriter(&oXmlWriter);
OOX::CPath pathPresProps = m_strDstFolder + _T("\\ppt\\presProps.xml");
OOX::CPath pathPresProps = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("presProps.xml");
oXmlWriter.SaveToFile(pathPresProps.GetPath());
// viewProps
oXmlWriter.ClearNoAttack();
m_oViewProps.toXmlWriter(&oXmlWriter);
OOX::CPath pathViewProps = m_strDstFolder + _T("\\ppt\\viewProps.xml");
OOX::CPath pathViewProps = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("viewProps.xml");
oXmlWriter.SaveToFile(pathViewProps.GetPath());
m_oReader.m_pRels->Clear();
......@@ -609,7 +611,7 @@ namespace NSBinPptxRW
oXmlWriter.ClearNoAttack();
m_oTableStyles.toXmlWriter(&oXmlWriter);
OOX::CPath pathTableStyles = m_strDstFolder + _T("\\ppt\\tableStyles.xml");
OOX::CPath pathTableStyles = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt") + FILE_SEPARATOR_STR + _T("tableStyles.xml");
oXmlWriter.SaveToFile(pathTableStyles.GetPath());
// presentation
......@@ -617,8 +619,8 @@ namespace NSBinPptxRW
pPair = m_mainTables.find(NSMainTables::Presentation);
if (m_mainTables.end() != pPair)
{
OOX::CPath pathFolder = m_strDstFolder + _T("\\ppt");
OOX::CPath pathFolderRels = pathFolder + _T("\\_rels");
OOX::CPath pathFolder = m_strDstFolder + FILE_SEPARATOR_STR + _T("ppt");
OOX::CPath pathFolderRels = pathFolder + FILE_SEPARATOR_STR + _T("_rels");
FileSystem::Directory::CreateDirectory (pathFolderRels.GetPath());
......@@ -673,7 +675,7 @@ namespace NSBinPptxRW
pathFolder = pathFolder + FILE_SEPARATOR_STR + _T("presentation.xml");
oXmlWriter.SaveToFile(pathFolder.GetPath());
pathFolderRels = pathFolderRels + FILE_SEPARATOR_STR + _T("\\presentation.xml.rels");
pathFolderRels = pathFolderRels + FILE_SEPARATOR_STR + _T("presentation.xml.rels");
m_oReader.m_pRels->SaveRels(pathFolderRels.GetPath());
if (m_oPresentation.commentAuthors.is_init())
......@@ -681,7 +683,7 @@ namespace NSBinPptxRW
oXmlWriter.ClearNoAttack();
m_oPresentation.commentAuthors->toXmlWriter(&oXmlWriter);
OOX::CPath pathCommentAuthors = pathFolder + _T("\\commentAuthors.xml");
OOX::CPath pathCommentAuthors = pathFolder + FILE_SEPARATOR_STR + _T("commentAuthors.xml");
oXmlWriter.SaveToFile(pathCommentAuthors.GetPath());
bIsAuthors = true;
......@@ -790,10 +792,10 @@ namespace NSBinPptxRW
<Relationship Id=\"rId2\" Type=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties\" Target=\"docProps/app.xml\"/>\
</Relationships>");
OOX::CPath filePathRels = m_strDstFolder + _T("\\_rels");
OOX::CPath filePathRels = m_strDstFolder + FILE_SEPARATOR_STR + _T("_rels");
FileSystem::Directory::CreateDirectory (filePathRels.GetPath());
filePathRels = filePathRels + _T("\\.rels");
filePathRels = filePathRels + FILE_SEPARATOR_STR + _T(".rels");
oFile.CreateFile(filePathRels.GetPath());
oFile.WriteStringUTF8(strRELS);
......
......@@ -79,8 +79,8 @@ namespace NSShapeImageGen
AVSINLINE CString GetPath(const CString& strMedia)
{
CString strExt = _T("");
strExt.Format(_T("\\image%d.%ls"), m_lID, (itJPG == m_eType) ? _T("jpg") : _T("png"));
return strMedia + strExt;
strExt.Format(_T("image%d.%ls"), m_lID, (itJPG == m_eType) ? _T("jpg") : _T("png"));
return strMedia + FILE_SEPARATOR_STR + strExt;
}
AVSINLINE CString GetPath2()
......@@ -329,9 +329,12 @@ namespace NSShapeImageGen
if ( (0xFF == pBuffer[0]) && (0xD8 == pBuffer[1]) && (0xFF == pBuffer[2]) )
{
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d.jpg"), oInfo.m_lID);
CDirectory::CopyFile(strFileSrc, m_strDstMedia + strSaveItem , NULL, NULL);
oInfo.m_eType = itJPG;
strSaveItem.Format(_T("image%d.jpg"), oInfo.m_lID);
OOX::CPath pathSaveItem = m_strDstMedia + FILE_SEPARATOR_STR + strSaveItem ;
CDirectory::CopyFile(strFileSrc, pathSaveItem.GetPath(), NULL, NULL);
oInfo.m_eType = itJPG;
return true;
}
......@@ -342,13 +345,17 @@ namespace NSShapeImageGen
&& (0x49 == pBuffer[12]) && (0x48 == pBuffer[13]) && (0x44 == pBuffer[14]) && (0x52 == pBuffer[15]))
{
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d.png"), oInfo.m_lID);
CDirectory::CopyFile(strFileSrc, m_strDstMedia + strSaveItem , NULL, NULL);
oInfo.m_eType = itPNG;
strSaveItem.Format(_T("image%d.png"), oInfo.m_lID);
OOX::CPath pathSaveItem = m_strDstMedia + FILE_SEPARATOR_STR + strSaveItem ;
CDirectory::CopyFile(strFileSrc, pathSaveItem.GetPath(), NULL, NULL);
oInfo.m_eType = itPNG;
return true;
}
return false;
}
}
void SaveImage(const CString& strFileSrc, CImageInfo& oInfo, LONG __width, LONG __height)
{
if (CheckImageSimpleCopy(strFileSrc, oInfo))
......@@ -370,14 +377,17 @@ namespace NSShapeImageGen
unsigned int nOutputFormat;
if (itJPG == oInfo.m_eType)
{
strSaveItem.Format(_T("%ls\\image%d.jpg"), m_strDstMedia, oInfo.m_lID);
strSaveItem.Format(_T("image%d.jpg"), oInfo.m_lID);
strSaveItem = m_strDstMedia + FILE_SEPARATOR_STR + strSaveItem ;
nOutputFormat = _CXIMAGE_FORMAT_JPG;
}
else
{
strSaveItem.Format(_T("%ls\\image%d.png"), m_strDstMedia, oInfo.m_lID);
nOutputFormat = _CXIMAGE_FORMAT_PNG;
strSaveItem.Format(_T("image%d.png"), oInfo.m_lID);
strSaveItem = m_strDstMedia + FILE_SEPARATOR_STR + strSaveItem ;
nOutputFormat = _CXIMAGE_FORMAT_PNG;
}
OOX::CPath pathSaveItem = strSaveItem;
LONG lMaxSize = (std::min)((std::max)(lWidth, lHeight), m_lMaxSizeImage);
......@@ -400,7 +410,7 @@ namespace NSShapeImageGen
oBgraFrame.Resize(lW, lH);
}
oBgraFrame.SaveFile(std::wstring(strSaveItem.GetString()), nOutputFormat);
oBgraFrame.SaveFile(std::wstring(pathSaveItem.GetPath()), nOutputFormat);
}
CImageInfo GenerateImageID(CBgraFrame& punkData, double dWidth, double dHeight)
......@@ -458,21 +468,19 @@ namespace NSShapeImageGen
oInfo.m_eType = (1 == lImageType) ? itWMF : itEMF;
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
strSaveItem = m_strDstMedia + strSaveItem;
strSaveItem.Format(_T("image%d."), oInfo.m_lID);
strSaveItem = m_strDstMedia + FILE_SEPARATOR_STR + strSaveItem;
double dKoef = 100 * 96 / 25.4;
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 == oInfo.m_eType)
{
CDirectory::CopyFile(strFileName, strSaveItem + _T("wmf"), NULL, NULL);
}
else
{
CDirectory::CopyFile(strFileName, strSaveItem + _T("emf"), NULL, NULL);
}
if (itWMF == oInfo.m_eType) strSaveItem += _T("wmf");
else strSaveItem += _T("emf");
OOX::CPath pathSaveItem = strSaveItem;
CDirectory::CopyFile(strFileName, pathSaveItem.GetPath(), NULL, NULL);
m_mapImagesFile.insert(std::pair<CString,CImageInfo>(strFileName, oInfo));
m_listImages.push_back(oInfo);
......@@ -542,22 +550,21 @@ namespace NSShapeImageGen
oInfo.m_eType = (1 == lImageType) ? itWMF : itEMF;
CString strSaveItem = _T("");
strSaveItem.Format(_T("\\image%d."), oInfo.m_lID);
strSaveItem = m_strDstMedia + strSaveItem;
strSaveItem.Format(_T("image%d."), oInfo.m_lID);
strSaveItem = m_strDstMedia + FILE_SEPARATOR_STR + 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 == oInfo.m_eType)
{
CDirectory::CopyFile(strFileName, strSaveItem + _T("wmf"), NULL, NULL);
}
else
{
CDirectory::CopyFile(strFileName, strSaveItem + _T("emf"), NULL, NULL);
}
m_mapImagesFile.insert(std::pair<CString,CImageInfo>(strFileName, oInfo));
if (itWMF == oInfo.m_eType) strSaveItem += _T("wmf");
else strSaveItem += _T("emf");
OOX::CPath pathSaveItem = strSaveItem;
CDirectory::CopyFile(strFileName, pathSaveItem.GetPath(), NULL, NULL);
m_mapImagesFile.insert(std::pair<CString,CImageInfo>(strFileName, oInfo));
m_listImages.push_back(oInfo);
return oInfo;
}
......
......@@ -111,7 +111,7 @@ namespace PPTX
private:
const OOX::CPath createFileName(const OOX::CPath& filename) const
{
CString strTemp = filename.GetDirectory() + _T("\\_rels\\");
CString strTemp = filename.GetDirectory() + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR;
if (filename.GetFilename() == _T("")) strTemp += _T(".rels");
else strTemp += (filename.GetFilename() + _T(".rels"));
......
......@@ -263,13 +263,15 @@ namespace PPTX
}
case 3:
{
//todoo
pReader->Skip(6); // len + start attributes + type
// -------------------
CString strUrl = pReader->GetString2();
CString strTempFile = _T("");
CString strOrigBase64 = _T("");
CString strTempFile = _T("");
if (0 == strUrl.Find(_T("data:")))
{
strOrigBase64 = strUrl;
......@@ -284,14 +286,16 @@ namespace PPTX
int dstLen = dstLenTemp;
Base64::Base64Decode(__s.GetBuffer(), len, pDstBuffer, &dstLen);
strTempFile = pReader->m_strFolder + _T("\\media\\temp.jpg");
CFile oTempFile;
oTempFile.CreateFile(strTempFile);
OOX::CPath pathTempFile = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + _T("temp.jpg");
strUrl = strTempFile = pathTempFile.GetPath();
CFile oTempFile;
oTempFile.CreateFile(strUrl);
oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen);
oTempFile.CloseFile();
strUrl = strTempFile;
RELEASEARRAYOBJECTS(pDstBuffer);
RELEASEARRAYOBJECTS(pDstBuffer);
}
else
{
......@@ -302,17 +306,19 @@ namespace PPTX
{
if (0 == strUrl.Find(_T("theme")))
{
strUrl = pReader->m_strFolderThemes + _T("\\") + strUrl;
strUrl = pReader->m_strFolderThemes + FILE_SEPARATOR_STR + strUrl;
}
else
{
strUrl = pReader->m_strFolder + _T("\\media\\") + strUrl;
strUrl = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + strUrl;
}
}
}
// -------------------
LONG lId = pReader->m_pRels->WriteImage(strUrl, strOrigBase64);
OOX::CPath pathUrl = strUrl;
strUrl = pathUrl.GetPath();
LONG lId = pReader->m_pRels->WriteImage(strUrl, strOrigBase64);
// -------------------
if (strTempFile != _T(""))
......
......@@ -271,9 +271,10 @@ namespace PPTX
int dstLen = dstLenTemp;
Base64::Base64Decode(__s.GetBuffer(), len, pDstBuffer, &dstLen);
strTempFile = pReader->m_strFolder + _T("\\media\\temp.jpg");
CFile oTempFile;
oTempFile.CreateFile(strTempFile);
OOX::CPath pathTemp = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + _T("temp.jpg");
CFile oTempFile;
oTempFile.CreateFile(pathTemp.GetPath());
oTempFile.WriteFile((void*)pDstBuffer, (DWORD)dstLen);
oTempFile.CloseFile();
......@@ -289,11 +290,11 @@ namespace PPTX
{
if (0 == strUrl.Find(_T("theme")))
{
strUrl = pReader->m_strFolderThemes + _T("\\") + strUrl;
strUrl = pReader->m_strFolderThemes + FILE_SEPARATOR_STR + strUrl;
}
else
{
strUrl = pReader->m_strFolder + _T("\\media\\") + strUrl;
strUrl = pReader->m_strFolder + FILE_SEPARATOR_STR + _T("media") + FILE_SEPARATOR_STR + strUrl;
}
}
}
......
......@@ -286,7 +286,7 @@ namespace OOX
const CPath CreateFileName(const CPath& oFilePath) const
{
CString strTemp = oFilePath.GetDirectory() + _T("\\_rels\\");
CString strTemp = oFilePath.GetDirectory() + FILE_SEPARATOR_STR + _T("_rels") + FILE_SEPARATOR_STR;
if ( _T("") == oFilePath.GetFilename() ) strTemp += _T(".rels");
else strTemp += ( oFilePath.GetFilename() + _T(".rels") );
......
......@@ -1838,10 +1838,10 @@ namespace BinXlsxRW {
}
else if(c_oSerWorksheetsTypes::Drawings == type)
{
OOX::CPath pathDrawingsDir = m_sDestinationDir + _T("\\xl\\drawings");
OOX::CPath pathDrawingsDir = m_sDestinationDir + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + _T("drawings");
OOX::CSystemUtility::CreateDirectories(pathDrawingsDir.GetPath());
OOX::CPath pathDrawingsRelsDir = pathDrawingsDir.GetPath() + _T("\\_rels");
OOX::CPath pathDrawingsRelsDir = pathDrawingsDir.GetPath() + FILE_SEPARATOR_STR + _T("_rels");
OOX::CSystemUtility::CreateDirectories(pathDrawingsRelsDir.GetPath());
m_pOfficeDrawingConverter->SetDstContentRels();
......@@ -1853,7 +1853,7 @@ namespace BinXlsxRW {
m_pCurWorksheet->m_oDrawing->m_oId.Init();
m_pCurWorksheet->m_oDrawing->m_oId->SetValue(oRId.get());
OOX::CPath pathDrawingsRels = pathDrawingsRelsDir.GetPath() + _T("\\") + m_pCurDrawing->m_sFilename + _T(".rels");
OOX::CPath pathDrawingsRels = pathDrawingsRelsDir.GetPath() + FILE_SEPARATOR_STR + m_pCurDrawing->m_sFilename + _T(".rels");
m_pOfficeDrawingConverter->SaveDstContentRels(pathDrawingsRels.GetPath());
}
else if(c_oSerWorksheetsTypes::SheetData == type)
......@@ -3094,8 +3094,10 @@ namespace BinXlsxRW {
aOffBits.push_back(mtiOffBits);
}
}
CString sMediaDir = sOutDir + _T("/xl/media");
std::map<long, ImageObject*> mapMedia;
OOX::CPath pathMedia = sOutDir + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + _T("media");
CString sMediaDir = pathMedia.GetPath();
std::map<long, ImageObject*> mapMedia;
if(-1 != nOtherOffBits)
{
oBufferedStream.Seek(nOtherOffBits);
......
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