откатились изменения с crossplatform до Revision: 59486 Date: 18:53:47, 6 ноября 2014 г.

revert revisions 59572, 59565, 59564, 59563, 59556, 59550, 59548, 59547, 59546, 59545, 59544, 59543, 59542, 59541, 59533, 59531, 59523, 59519, 59503, 59499, 59490.

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@59588 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
Sergey.Konovalov
2014-11-10 17:07:16 +00:00
committed by Alexander Trofimov
parent 833003ba10
commit 945d20bc48
109 changed files with 1044 additions and 1690 deletions

View File

@ -35,13 +35,11 @@ bool BinDocxRW::CDocxSerializer::ConvertDocxToDoct(const CString& sSrcFileName,
}
bool BinDocxRW::CDocxSerializer::ConvertDoctToDocx(const CString& sSrcFileName, const CString& sDstFileName, const CString& sTmpDir, const CString& sXMLOptions, const CString& sThemePath, const CString& sMediaPath)
{
std::wstring strDirSrc = NSSystemPath::Combine(string2std_string(sTmpDir), _T("from"));
std::wstring strEditorBin = NSSystemPath::Combine(strDirSrc, _T("Editor.bin"));
std::wstring strDirDst = NSSystemPath::Combine(string2std_string(sTmpDir), _T("to"));
std::wstring strDirSrc = NSSystemPath::Combine(string2std_string(sTmpDir), _T("from"));
std::wstring strEditorBin = NSSystemPath::Combine(strDirSrc, _T("Editor.bin"));
std::wstring strDirDst = NSSystemPath::Combine(string2std_string(sTmpDir), _T("to"));
NSDirectory::CreateDirectory(strDirSrc);
NSDirectory::CreateDirectory(strDirDst);
CString sEditorBin = std_string2string(strEditorBin);
CString sDirDst = std_string2string(strDirDst);
COfficeUtils oCOfficeUtils(NULL);
@ -53,10 +51,10 @@ bool BinDocxRW::CDocxSerializer::ConvertDoctToDocx(const CString& sSrcFileName,
}
bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const CString& sDstPath, const CString& sXMLOptions)
{
OOX::CPath pathMain(sSrcFileName);
OOX::CPath pathMedia = pathMain.GetDirectory() + FILE_SEPARATOR_STR + _T("media");
NSDirectory::CreateDirectory(string2std_string(pathMedia.GetPath()));
//create mediadir
OOX::CPath path(sSrcFileName);
CString mediaDir = path.GetDirectory() + _T("media/");
NSDirectory::CreateDirectory(string2std_string(mediaDir));
COfficeFontPicker* pFontPicker = new COfficeFontPicker();
pFontPicker->Init(m_sFontDir);
@ -88,10 +86,8 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C
oDrawingConverter.SetFontDir(m_sFontDir);
oDrawingConverter.SetFontPicker(pFontPicker);
oDrawingConverter.SetMainDocument(this);
oDrawingConverter.SetMediaDstPath(pathMedia.GetPath());
oDrawingConverter.SetMediaDstPath(mediaDir);
ParamsWriter oParamsWriter(&oBufferedStream, &fp, &oDrawingConverter, pEmbeddedFontsManager);
m_oBinaryFileWriter = new BinaryFileWriter(oParamsWriter);
m_oBinaryFileWriter->intoBindoc(sDstPath);
BYTE* pbBinBuffer = oBufferedStream.GetBuffer();
@ -122,38 +118,9 @@ bool BinDocxRW::CDocxSerializer::saveToFile(const CString& sSrcFileName, const C
RELEASEOBJECT(pFontPicker);
return true;
}
void BinDocxRW::CDocxSerializer::CreateDocxFolders(CString strDirectory, CString& sThemePath, CString& sMediaPath)
{
// rels
OOX::CPath pathRels = strDirectory + FILE_SEPARATOR_STR + _T("_rels");
FileSystem::Directory::CreateDirectory(pathRels.GetPath());
// word
OOX::CPath pathWord = strDirectory + FILE_SEPARATOR_STR + _T("word");
FileSystem::Directory::CreateDirectory(pathWord.GetPath());
// documentRels
OOX::CPath pathWordRels = pathWord + FILE_SEPARATOR_STR + _T("_rels");
FileSystem::Directory::CreateDirectory(pathWordRels.GetPath());
//media
OOX::CPath pathMedia = pathWord + FILE_SEPARATOR_STR + _T("media");
sMediaPath = pathMedia.GetPath();
// theme
OOX::CPath pathTheme = pathWord + FILE_SEPARATOR_STR + _T("theme");
FileSystem::Directory::CreateDirectory(pathTheme.GetPath());
OOX::CPath pathThemeRels = pathTheme + FILE_SEPARATOR_STR + _T("_rels");
FileSystem::Directory::CreateDirectory(pathThemeRels.GetPath());
pathTheme = pathTheme + FILE_SEPARATOR_STR + _T("theme1.xml");
sThemePath = pathTheme.GetPath();
}
bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const CString& sDstPath, const CString& sXMLOptions, const CString& sThemePath, const CString& sMediaPath)
{
bool bResultOk = false;
NSFile::CFileBinary oFile;
if(oFile.OpenFile(string2std_string(sSrcFileName)))
{
@ -187,6 +154,7 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
BYTE _c = pBase64Data[nIndex];
if (_c == ';')
{
if(0 == nType)
{
nType = 1;
@ -203,10 +171,8 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
else
dst_len.AppendChar(_c);
}
int nDataSize = atoi(dst_len);
BYTE* pData = new BYTE[nDataSize];
if(FALSE != Base64::Base64Decode((LPCSTR)(pBase64Data + nIndex), nBase64DataSize - nIndex, pData, &nDataSize))
{
NSBinPptxRW::CDrawingConverter oDrawingConverter;
@ -241,42 +207,10 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
var.bstrVal = sFileInDir.GetString();
oDrawingConverter.SetAdditionalParam(CString(L"SourceFileDir"), var);
#endif
//default theme
m_pCurFileWriter->m_oDefaultTheme.Write(sThemePath);
BinaryFileReader oBinaryFileReader(sFileInDir, oBufferedStream, *m_pCurFileWriter);
oBinaryFileReader.ReadFile();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
OOX::CContentTypes oContentTypes;
//docProps
OOX::CPath pathDocProps = sDstPath + FILE_SEPARATOR_STR + _T("docProps");
FileSystem::Directory::CreateDirectory(pathDocProps.GetPath());
OOX::CPath DocProps = CString(_T("docProps"));
OOX::CApp* pApp = new OOX::CApp();
if (pApp)
{
pApp->SetApplication(_T("OnlyOffice"));
pApp->SetAppVersion(_T("3.0000"));
pApp->SetDocSecurity(0);
pApp->SetScaleCrop(false);
pApp->SetLinksUpToDate(false);
pApp->SetSharedDoc(false);
pApp->SetHyperlinksChanged(false);
pApp->write(pathDocProps + FILE_SEPARATOR_STR + _T("app.xml"), DocProps, oContentTypes);
delete pApp;
}
OOX::CCore* pCore = new OOX::CCore();
if (pCore)
{
pCore->SetCreator(_T(""));
pCore->SetLastModifiedBy(_T(""));
pCore->write(pathDocProps + FILE_SEPARATOR_STR + _T("core.xml"), DocProps, oContentTypes);
delete pCore;
}
/////////////////////////////////////////////////////////////////////////////////////
VARIANT vt;
oDrawingConverter.GetAdditionalParam(CString(_T("ContentTypes")), &vt);
if(VT_BSTR == vt.vt)
@ -290,11 +224,10 @@ bool BinDocxRW::CDocxSerializer::loadFromFile(const CString& sSrcFileName, const
m_pCurFileWriter->m_oHeaderFooterWriter.Write();
//Setting пишем после HeaderFooter, чтобы заполнить evenAndOddHeaders
m_pCurFileWriter->m_oSettingWriter.Write();
m_pCurFileWriter->m_oWebSettingsWriter.Write();
//Document пишем после HeaderFooter, чтобы заполнить sectPr
m_pCurFileWriter->m_oDocumentWriter.Write();
//Rels и ContentTypes пишем в конце
m_pCurFileWriter->m_oDocumentRelsWriter.Write();
//m_pCurFileWriter->m_oDocumentRelsWriter.Write(_T("document.xml.rels"));
m_pCurFileWriter->m_oContentTypesWriter.Write();
//CSerializer oSerializer = CSerializer();