Compare commits

...

20 Commits

Author SHA1 Message Date
5039cec847 diagramm save error 2017-12-19 15:09:10 +03:00
b8b8a14268 fix bug 36524 (fix MathType equation) 2017-12-15 14:47:57 +03:00
e5ef749718 . 2017-12-15 12:24:35 +03:00
1a8af4d8ed x2t - fix users file 2017-12-13 15:11:16 +03:00
cdf8dc7a4c Changed cef update condition 2017-12-13 12:55:54 +03:00
548c5ab608 x2t - fix users files 2017-12-13 11:59:49 +03:00
d70f36e36d DocFormat - fix users files 2017-12-12 19:41:50 +03:00
60cf51ad0d Move ASCDOCUMENTSCORE to separated target 2017-12-12 16:30:44 +03:00
8e7231b322 removed unused code 2017-12-12 12:43:33 +03:00
2b339b6842 Cherrypick from develop 2017-12-12 12:43:03 +03:00
fb0dbfc231 Cherrypick from develop 2017-12-12 12:40:28 +03:00
ede03fafea for b599a6bc43 to fix build error 2017-12-11 19:52:44 +03:00
260c2edd21 . 2017-12-11 18:42:11 +03:00
3eeec8fc67 RtfFormat - fix users file 2017-12-11 18:39:37 +03:00
41a213491e fix image content type 2017-12-11 13:45:28 +03:00
b599a6bc43 Add open/save JsaProject.bin for OnlyOffice Macros 2017-12-11 13:31:48 +03:00
20b781cb7e pdf checker bug 2017-12-06 18:50:09 +03:00
e7bbbec0de v5.0.5 2017-11-27 17:06:49 +03:00
875717acd4 Add m_sSavePassword (m_sPassword - only for open) 2017-11-23 18:40:31 +03:00
d1227f7759 x2t - add native commands for crypt file 2017-11-23 17:28:28 +03:00
35 changed files with 516 additions and 141 deletions

View File

@ -809,7 +809,13 @@ namespace DocFileFormat
{
if (_fldCharCounter > 0)
{
XMLTools::XMLElement elem( L"w:fldChar" );
if (_writeInstrText == true && !text.empty())
{
writeTextElement(text, textType);
text.clear();
}
_writeInstrText = false;
XMLTools::XMLElement elem( L"w:fldChar" );
elem.AppendAttribute( L"w:fldCharType", L"end" );
m_pXmlWriter->WriteString( elem.GetXMLString());

View File

@ -53,62 +53,31 @@ namespace DocFileFormat
PathParser (const unsigned char* pSegmentInfo, unsigned int pSegmentInfoSize, const unsigned char* pVertices, unsigned int pVerticesSize, std::vector<_guides> & guides)
{
int offset = 6;
if ((pSegmentInfo != NULL) && (pSegmentInfoSize > 0))
{
int offset = 6;
unsigned short nElems = FormatUtils::BytesToUInt16(pSegmentInfo, 0, pSegmentInfoSize);
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pSegmentInfo, 2, pSegmentInfoSize);
unsigned short cb = FormatUtils::BytesToUInt16(pSegmentInfo, 4, pSegmentInfoSize);
// видимо без шапки сразу пишутся все элементы
bool headerIs = ((0xfff0 != cb) && (cb > 8) || nElems > nElemsAlloc);
if (headerIs)
{
cb = 2;
offset = 0;
nElems = pSegmentInfoSize / 2;
unsigned short cbElement = 4;
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
}
}
else
if (cb == 0xfff0)
cbElement = 2;
if (nElems == 0)
{
if ((0xfff0 != cb) && (8 != cb) && (4 != cb) && (2 != cb))
{
cb = 0xfff0;
offset = 0;
nElems = pSegmentInfoSize / 2;
}
if (0xfff0 == cb)
{
cb = 4;
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToUInt16(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
}
}
else
{
if ((2 != cb) && (1 != cb))
cb = 8;
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToInt32(pSegmentInfo + offset, (i * cb), pSegmentInfoSize));
m_arSegments.push_back (oSegment);
}
if ((long)pSegmentInfoSize < (long)(cb*nElems)) // Есть несколько файлов с мусором вместо данных
m_arSegments.clear();
}
nElems = (pSegmentInfoSize - offset) / cbElement;
}
for (unsigned short i = 0; i < nElems; ++i)
{
PathSegment oSegment = PathSegment(FormatUtils::BytesToInt32(pSegmentInfo + offset, (i * cbElement), pSegmentInfoSize - offset));
m_arSegments.push_back (oSegment);
}
if ((long)pSegmentInfoSize < (long)(cb * nElems)) // Есть несколько файлов с мусором вместо данных
m_arSegments.clear();
}
if ((NULL != pVertices) && (pVerticesSize > 0))
@ -117,19 +86,23 @@ namespace DocFileFormat
unsigned short nElemsAlloc = FormatUtils::BytesToUInt16(pVertices, 2, pVerticesSize);
unsigned short cb = FormatUtils::BytesToUInt16(pVertices, 4, pVerticesSize);
unsigned short cbElement = cb;
if (cb == 0xfff0)
cbElement = 4;
for (unsigned short i = 0; i < nElems; ++i)
{
POINT point;
if (0xfff0 == cb)
if (cbElement == 4)
{
cb = 4;
point.x = FormatUtils::BytesToInt16(pVertices + 6, (i * cb), pVerticesSize);
point.y = FormatUtils::BytesToInt16(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
point.x = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement), pVerticesSize - offset);
point.y = FormatUtils::BytesToInt16(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset);
}
else
{
point.x = FormatUtils::BytesToInt32(pVertices + 6, (i * cb), pVerticesSize);
point.y = FormatUtils::BytesToInt32(pVertices + 6, (i * cb) + (cb / 2), pVerticesSize);
point.x = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement), pVerticesSize - offset);
point.y = FormatUtils::BytesToInt32(pVertices + offset, (i * cbElement) + (cbElement / 2), pVerticesSize - offset);
}
LONG lMinF = (LONG)0x80000000;

View File

@ -288,6 +288,7 @@ namespace DocFileFormat
int ndyTextBottom = -1;
bool bHavePath = false;
int nShapePath = -1;
int nAdjValues = 0;
int nLTxID = -1;
@ -361,6 +362,7 @@ namespace DocFileFormat
case shapePath :
{
bHavePath = true;
nShapePath = iter->op;
}break;
case pVertices:
{
@ -1653,7 +1655,7 @@ namespace DocFileFormat
}
if (!bRelV && m_pSpa)
{
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->bx));
appendStyleProperty(oStyle, L"mso-position-vertical-relative", mapVerticalPositionRelative(m_pSpa->by));
}
if (!m_isInlineShape && !bZIndex)
{

View File

@ -29,19 +29,16 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
// DocFormatTest.cpp : Defines the entry point for the console application.
//
#include "../DocFormatLib/DocFormatLib.h"
#include "../../OfficeUtils/src/ASCOfficeCriticalSection.h"
#include <iostream>
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../DocFormatLib/DocFormatLib.h"
#include <string>
#include <windows.h>
#include <tchar.h>
#pragma comment(lib,"Shell32.lib")
#pragma comment(lib,"Advapi32.lib")
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
@ -49,36 +46,34 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
int _tmain(int argc, _TCHAR* argv[])
HRESULT convert_single(std::wstring srcFileName)
{
if (argc < 2) return 1;
HRESULT hr = S_OK;
std::wstring sSrcDoc = argv[1];
std::wstring sDstDocx;
std::wstring outputDir = NSDirectory::GetFolderPath(sSrcDoc);
std::wstring outputDir = NSDirectory::GetFolderPath(srcFileName);
std::wstring dstTempPath = NSDirectory::CreateDirectoryWithUniqueName(outputDir);
std::wstring dstPath;
COfficeDocFile docFile;
docFile.m_sTempFolder = outputDir;
bool bMacros = true;
HRESULT hRes = docFile.LoadFromFile( sSrcDoc, dstTempPath, L"password", bMacros, NULL);
HRESULT hRes = docFile.LoadFromFile( srcFileName, dstTempPath, L"password", bMacros, NULL);
if (bMacros)
{
sDstDocx = sSrcDoc + L"-my.docm";
dstPath = srcFileName + L"-my.docm";
}
else
{
sDstDocx = sSrcDoc + L"-my.docx";
dstPath = srcFileName + L"-my.docx";
}
if (hRes == S_OK)
{
COfficeUtils oCOfficeUtils(NULL);
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), sDstDocx, -1);
hRes = oCOfficeUtils.CompressFileOrDirectory(dstTempPath.c_str(), dstPath, -1);
}
NSDirectory::DeleteDirectory(dstTempPath);
@ -86,3 +81,33 @@ int _tmain(int argc, _TCHAR* argv[])
return hRes;
}
HRESULT convert_directory(std::wstring pathName)
{
HRESULT hr = S_OK;
std::vector<std::wstring> arFiles = NSDirectory::GetFiles(pathName, false);
for (size_t i = 0; i < arFiles.size(); i++)
{
convert_single(arFiles[i]);
}
return S_OK;
}
int _tmain(int argc, _TCHAR* argv[])
{
if (argc < 2) return 1;
HRESULT hr = -1;
if (NSFile::CFileBinary::Exists(argv[1]))
{
hr = convert_single(argv[1]);
}
else if (NSDirectory::Exists(argv[1]))
{
hr = convert_directory(argv[1]);
}
return hr;
}

View File

@ -3708,6 +3708,21 @@ public:
res = Read2(length, &Binary_DocumentTableReader::Read_Background, this, &oBackground);
m_oDocumentWriter.m_oBackground.WriteString(oBackground.Write());
}
else if(c_oSerParType::JsaProject == type)
{
BYTE* pData = m_oBufferedStream.GetPointer(length);
OOX::CPath sJsaProject = OOX::FileTypes::JsaProject.DefaultFileName();
std::wstring filePath = m_oFileWriter.m_oDocumentWriter.m_sDir + FILE_SEPARATOR_STR + L"word"+ FILE_SEPARATOR_STR + sJsaProject.GetPath();
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath);
oFile.WriteFile(pData, length);
oFile.CloseFile();
long lId;
m_oFileWriter.m_pDrawingConverter->WriteRels(OOX::FileTypes::JsaProject.RelationType(), sJsaProject.GetPath(), L"", &lId);
m_oFileWriter.m_pDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(sJsaProject.GetExtention(false));
}
else
res = c_oSerConstants::ReadUnknown;
return res;

View File

@ -144,9 +144,13 @@ namespace MathEquation
void AddAccent (MEMBELTYPE eType)
{
LONG lPos = GetSize() - 1;
if (lPos < 0) return;
EquationRun oRun;
oRun = arrRun[lPos];
RemoveElem(lPos);
oRun.bAccent = true;
oRun.eType = eType;
Add(oRun);
@ -557,11 +561,11 @@ namespace MathEquation
BYTE horAlign;
switch(eHorAlign)
{
case matrixhoralignLeft: horAlign = SimpleTypes::xalignLeft;
case matrixhoralignCenter: horAlign = SimpleTypes::xalignCenter;
case matrixhoralignRight: horAlign = SimpleTypes::xalignRight;
case matrixhoralignEqualSign: horAlign = SimpleTypes::xalignCenter;
case matrixhoralignCommaSign: horAlign = SimpleTypes::xalignCenter;
case matrixhoralignLeft: horAlign = SimpleTypes::xalignLeft; break;
case matrixhoralignCenter: horAlign = SimpleTypes::xalignCenter; break;
case matrixhoralignRight: horAlign = SimpleTypes::xalignRight; break;
case matrixhoralignEqualSign: horAlign = SimpleTypes::xalignCenter; break;
case matrixhoralignCommaSign: horAlign = SimpleTypes::xalignCenter; break;
}
WriteItemVal(BinDocxRW::c_oSer_OMathBottomNodesType::McJc, horAlign);
@ -614,7 +618,7 @@ namespace MathEquation
nRows = m_aRowsCounter.top();
m_aRowsCounter.pop();
}
int nPos = 0;
int nPos = m_oStream.GetPosition();
if (!m_aRowsPosCounter.empty())
{
nPos = m_aRowsPosCounter.top();
@ -1675,7 +1679,7 @@ namespace MathEquation
void WriteEndNode(BinaryEquationWriter* pWriter)
{
int nCurPos;
int nCurPos = -1;
if (!m_aBaseStack.empty())
{
nCurPos = m_aBaseStack.top();
@ -1687,14 +1691,20 @@ namespace MathEquation
}
if (bPile && bEqArrayStart)
{
pWriter->WriteItemEnd(nCurPos);
}
else if (!bPile && !bEqArrayStart)
{
pWriter->WriteItemEnd(nCurPos);
}
else if (!bPile && bEqArrayStart)
{
pWriter->m_aRowsCounter.push(nRows);
bEqArrayStart = false;
pWriter->WriteItemEnd(nCurPos);//eqArr
if (nCurPos > 0)
pWriter->WriteItemEnd(nCurPos);//eqArr
if (!m_aBaseStack.empty())
{

View File

@ -474,7 +474,8 @@ extern int g_nCurFormatVersion;
MoveFromRangeStart = 18,
MoveFromRangeEnd = 19,
MoveToRangeStart = 20,
MoveToRangeEnd = 21
MoveToRangeEnd = 21,
JsaProject = 22
};}
namespace c_oSerDocTableType{enum c_oSerDocTableType
{

View File

@ -2997,6 +2997,7 @@ namespace BinDocxRW
Binary_tblPrWriter btblPrs;
OOX::Logic::CSectionProperty* pSectPr;
OOX::Logic::CBackground * pBackground;
OOX::CDocument* poDocument;
bool m_bWriteSectPr;//Записывать ли свойства верхнего уровня в данном экземпляре BinaryOtherTableWriter
//---------------------------------
@ -3005,6 +3006,7 @@ namespace BinDocxRW
{
pBackground = NULL;
pSectPr = NULL;
poDocument = NULL;
m_bWriteSectPr = false;
m_eFldState = SimpleTypes::fldchartypeEnd;
}
@ -3109,6 +3111,23 @@ namespace BinDocxRW
m_oBcw.WriteItemEnd(nCurPos);
}
}
//Write JsaProject
if (NULL != poDocument)
{
smart_ptr<OOX::File> pFile = poDocument->Get(OOX::FileTypes::JsaProject);
if (pFile.IsInit() && OOX::FileTypes::JsaProject == pFile->type())
{
OOX::JsaProject& jsaProject = pFile.as<OOX::JsaProject>();
BYTE* pData = NULL;
DWORD nBytesCount;
if(NSFile::CFileBinary::ReadAllBytes(jsaProject.filename().GetPath(), &pData, nBytesCount))
{
nCurPos = m_oBcw.WriteItemStart(c_oSerParType::JsaProject);
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
m_oBcw.WriteItemEnd(nCurPos);
}
}
}
}
void WriteBackground (OOX::Logic::CBackground* pBackground)
{
@ -7880,6 +7899,7 @@ namespace BinDocxRW
oBinaryDocumentTableWriter.pSectPr = pFirstSectPr;
oBinaryDocumentTableWriter.pBackground = poDocument->m_oBackground.GetPointer();
oBinaryDocumentTableWriter.poDocument = poDocument;
oBinaryDocumentTableWriter.m_bWriteSectPr = true;
//Write Vba

View File

@ -1000,6 +1000,27 @@ void OoxConverter::convert(OOX::Spreadsheet::CT_DLbls* ser_lbls)
{
bool boolVal = false;
bool bIsFound = false;
switch(*ser_lbls->m_ItemsElementName0[i])
{
case OOX::Spreadsheet::itemschoicetype3DELETE :
case OOX::Spreadsheet::itemschoicetype3SHOWBUBBLESIZE:
case OOX::Spreadsheet::itemschoicetype3SHOWCATNAME:
case OOX::Spreadsheet::itemschoicetype3SHOWLEADERLINES:
case OOX::Spreadsheet::itemschoicetype3SHOWLEGENDKEY:
case OOX::Spreadsheet::itemschoicetype3SHOWPERCENT:
case OOX::Spreadsheet::itemschoicetype3SHOWSERNAME:
case OOX::Spreadsheet::itemschoicetype3SHOWVAL:
bIsFound = true;
break;
default:
break;
}
if (!bIsFound)
continue;
OOX::Spreadsheet::CT_Boolean * ct_boolean = (OOX::Spreadsheet::CT_Boolean*)ser_lbls->m_Items[i];
if (ct_boolean && ct_boolean->m_val) boolVal = * ct_boolean->m_val;

View File

@ -3426,8 +3426,16 @@ std::wstring CDrawingConverter::GetDrawingMainProps(XmlUtils::CXmlNode& oNode, P
{
oWriter.WriteString(L"<wp:wrapNone/>");
}
bool bHidden = false;
pPair = oCssStyles.m_mapSettings.find(L"visibility");
if (oCssStyles.m_mapSettings.end() != pPair)
{
if (L"hidden" == pPair->second)
bHidden = true;
}
std::wstring strId = L"<wp:docPr id=\"" + std::to_wstring(m_lNextId) + L"\" name=\"\"/>";
std::wstring strId = L"<wp:docPr id=\"" + std::to_wstring(m_lNextId) + L"\" name=\"\"" + (bHidden ? L" hidden=\"true\"" : L"") + L"/>";
m_lNextId++;
oWriter.WriteString(strId);

View File

@ -40,6 +40,7 @@
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Video.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/Audio.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
#include "../../Common/Base64.h"
@ -292,7 +293,7 @@ namespace NSBinPptxRW
}
}
}
else if (!strExts.empty())
if (!strExts.empty())
{
m_pContentTypes->AddDefault(strExts.substr(1));
}
@ -1235,7 +1236,7 @@ namespace NSBinPptxRW
m_pWriter->WriteString(strRels);
}
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsNotesMaster, bool bIsVbaProject)
void CRelsGenerator::EndPresentationRels(bool bIsCommentsAuthors, bool bIsNotesMaster, bool bIsVbaProject, bool bIsJsaProject)
{
if (bIsNotesMaster)
{
@ -1266,6 +1267,12 @@ namespace NSBinPptxRW
L"\" Type=\"http://schemas.microsoft.com/office/2006/relationships/vbaProject\" Target=\"vbaProject.bin\"/>";
m_pWriter->WriteString(strRels4);
}
if (bIsJsaProject)
{
std::wstring strRels5 = L"<Relationship Id=\"rId" + std::to_wstring(m_lNextRelsID++) +
L"\" Type=\"" + OOX::FileTypes::JsaProject.RelationType() + L"\" Target=\"" + OOX::FileTypes::JsaProject.DefaultFileName().GetPath() + L"\"/>";
m_pWriter->WriteString(strRels5);
}
}
int CRelsGenerator::GetNextId()
{

View File

@ -425,7 +425,7 @@ namespace NSBinPptxRW
int WriteRels (const std::wstring& bsType, const std::wstring& bsTarget, const std::wstring& bsTargetMode);
int WriteHyperlink (const std::wstring& strLink, const bool& bIsActionInit);
void EndPresentationRels (bool bIsCommentsAuthors = false, bool bIsNotesMaster = false, bool bIsVbaProject = false );
void EndPresentationRels (bool bIsCommentsAuthors = false, bool bIsNotesMaster = false, bool bIsVbaProject = false, bool bIsJsaProject = false );
int GetNextId ();
void CloseRels ();

View File

@ -812,7 +812,7 @@ namespace NSBinPptxRW
++nCurrentRels;
}
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent, m_oPresentation.m_pVbaProject.is_init());
m_oReader.m_pRels->EndPresentationRels(m_oPresentation.commentAuthors.is_init(), bNotesMasterPresent, m_oPresentation.m_pVbaProject.is_init(), m_oPresentation.m_pJsaProject.is_init());
m_oReader.m_pRels->CloseRels();
oXmlWriter.ClearNoAttack();

View File

@ -63,6 +63,7 @@
#include "../../Common/DocxFormat/Source/DocxFormat/Media/OleObject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/ActiveX.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/HyperLink.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalImage.h"
#include "../../Common/DocxFormat/Source/DocxFormat/External/ExternalAudio.h"
@ -144,6 +145,8 @@ namespace PPTX
return smart_ptr<OOX::File>(new OOX::OleObject( filename, true ));
else if (relation.Type() == OOX::FileTypes::VbaProject)
return smart_ptr<OOX::File>(new OOX::VbaProject( filename, filename ));
else if (relation.Type() == OOX::FileTypes::JsaProject)
return smart_ptr<OOX::File>(new OOX::JsaProject( filename ));
return smart_ptr<OOX::File>(new OOX::UnknowTypeFile());
}

View File

@ -81,6 +81,10 @@ namespace PPTX
_presentation->m_bMacroEnabled = true;
_presentation->m_pVbaProject = _presentation->Get(OOX::FileTypes::VbaProject).smart_dynamic_cast<OOX::VbaProject>();
}
if (_presentation->IsExist(OOX::FileTypes::JsaProject))
{
_presentation->m_pJsaProject = _presentation->Get(OOX::FileTypes::JsaProject).smart_dynamic_cast<OOX::JsaProject>();
}
}
for (std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.m_map.begin(); pPair != map.m_map.end(); ++pPair)

View File

@ -51,6 +51,7 @@
#include "Theme/ClrScheme.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
namespace PPTX
{
@ -233,6 +234,7 @@ namespace PPTX
}
pWriter->EndRecord();
}
pWriter->WriteRecord2(9, m_pJsaProject);
pWriter->EndRecord();
}
@ -352,9 +354,17 @@ namespace PPTX
m_bMacroEnabled = true;
}break;
case 9:
{
m_pJsaProject = new OOX::JsaProject();
m_pJsaProject->fromPPTY(pReader);
smart_ptr<OOX::File> file = m_pJsaProject.smart_dynamic_cast<OOX::File>();
FileContainer::Add(file);
}break;
default:
{
pReader->Seek(_end_pos);
pReader->SkipRecord();
return;
}
}
@ -468,6 +478,7 @@ namespace PPTX
public:
bool m_bMacroEnabled;
smart_ptr<OOX::VbaProject> m_pVbaProject;
smart_ptr<OOX::JsaProject> m_pJsaProject;
void SetClrMap(Logic::ClrMap map) {m_clrMap = map;}
void SetClrScheme(nsTheme::ClrScheme scheme) {m_clrScheme = scheme;}

View File

@ -1027,7 +1027,16 @@ bool RtfParagraphPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
}
}
COMMAND_RTF_BOOL( "intbl", paragraphProps->m_bInTable, sCommand, hasParameter, parameter )
COMMAND_RTF_INT ( "itap", paragraphProps->m_nItap, sCommand, hasParameter, parameter )
else if ( "itap" == sCommand && hasParameter)
{
//if (parameter == 0 && paragraphProps->m_bInTable && paragraphProps->m_nItap > 0)
//{
//
//// paragraphProps->m_bInTable = 0;
//}
//else
paragraphProps->m_nItap = parameter;
}
COMMAND_RTF_BOOL( "keep", paragraphProps->m_bKeep, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( "keepn", paragraphProps->m_bKeepNext, sCommand, hasParameter, parameter )
COMMAND_RTF_BOOL( "pagebb", paragraphProps->m_bPageBB, sCommand, hasParameter, parameter )
@ -2283,7 +2292,8 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
{
// 1 != oItem->m_oProperty.m_bInTable - параграф не в таблице
// PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap - выставлено свойство,что вложенность - nTargetItap - это не таблица( Нужно для чтения параграфов в таблицах )
if ( 1 != oItem->m_oProperty.m_bInTable || ( PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap ) )
if ( ( 1 != oItem->m_oProperty.m_bInTable || 0 == oItem->m_oProperty.m_nItap ) //Платежное_поручение.rtf
|| ( PROP_DEF != nTargetItap && oItem->m_oProperty.m_nItap <= nTargetItap ) )
{
if ( nCurItap > 0 ) //Если до этого были только параграфы в таблицах - завершаем таблицу
{
@ -2292,15 +2302,13 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
for( int k = (int)aRows.size() - 1; k >= 0 ; k-- )
{
if ( aRowItaps[k] == nCurItap )
{
oNewTable->InsertItem( aRows[k], 0 );
aRows.erase(aRows.begin() + k);
aRowItaps.erase(aRowItaps.begin() + k);
}
else
if ( aRowItaps[k] != nCurItap )
break;
oNewTable->InsertItem( aRows[k], 0 );
aRows.erase(aRows.begin() + k);
aRowItaps.erase(aRowItaps.begin() + k);
}
//вычисляем свойства для OOX
oNewTable->CalculateGridProp();
@ -2339,15 +2347,13 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
for( int k = (int)aRows.size() - 1; k >= 0 ; k-- )
{
if ( aRowItaps[k] == nCurItap )
{
oNewTable->InsertItem( aRows[k], 0 );
aRows.erase(aRows.begin() + k);
aRowItaps.erase(aRowItaps.begin() + k);
}
else
if ( aRowItaps[k] != nCurItap )
break;
oNewTable->InsertItem( aRows[k], 0 );
aRows.erase(aRows.begin() + k);
aRowItaps.erase(aRowItaps.begin() + k);
}
//вычисляем свойства для OOX
oNewTable->CalculateGridProp();
@ -2386,7 +2392,7 @@ void RtfParagraphPropDestination::AddItem( RtfParagraphPtr oItem, RtfReader& oRe
//добавляем параграф во временные cell
aCellRenderables.push_back( oItem ); //содержит все параграфы, не разложенные по cell
aItaps.push_back( nCurItap ); //содержит все номера вложенности параграфов
if ( bEndCell )
{
RtfTableCellPtr oNewTableCell ( new RtfTableCell() );
@ -2456,6 +2462,9 @@ bool RtfParagraphPropDestination::ExecuteCommand(RtfDocument& oDocument, RtfRead
}
else if ( "cell" == sCommand || "nestcell" == sCommand )
{
if (oReader.m_oState->m_oParagraphProp.m_bInTable == 1 && 0 == oReader.m_oState->m_oParagraphProp.m_nItap )//Платежное_поручение.rtf (ели по другому сбойная строка заменяется параграфами
oReader.m_oState->m_oParagraphProp.m_nItap = 1;
m_oCurParagraph->m_oProperty = oReader.m_oState->m_oParagraphProp;
m_oCurParagraph->m_oOldList = RtfOldListPtr( new RtfOldList() );
*m_oCurParagraph->m_oOldList = oReader.m_oState->m_oCurOldList;

View File

@ -65,7 +65,7 @@
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="Urlmon.lib"
AdditionalDependencies="Urlmon.lib Rpcrt4.lib"
LinkIncremental="1"
IgnoreDefaultLibraryNames="LIBCMT.lib"
IgnoreEmbeddedIDL="true"
@ -407,6 +407,10 @@
RelativePath="..\..\ASCOfficeOdfFile\src\odf\svg_parser.cpp"
>
</File>
<File
RelativePath="..\..\Common\DocxFormat\Source\Base\unicode_util.cpp"
>
</File>
<File
RelativePath="..\..\UnicodeConverter\UnicodeConverter.cpp"
>

View File

@ -0,0 +1,62 @@
Add-Type -AssemblyName System.IO.Compression.FileSystem
# ----------------------------------------------------------------------------------------------
# download a file
# ----------------------------------------------------------------------------------------------
function Download-File
{
param ([string]$url,[string]$file)
$downloadRequired = $true
if (Test-Path $file)
{
$localModified = (Get-Item $file).CreationTime
$webRequest = [System.Net.HttpWebRequest]::Create($url)
$webRequest.Method = "HEAD"
$webResponse = $webRequest.GetResponse()
$remoteLastModified = ($webResponse.LastModified) -as [DateTime]
$webResponse.Close()
if ($remoteLastModified -gt $localModified)
{
Write-Host "$file is out of date"
}
else
{
$downloadRequired = $false
}
}
if ($downloadRequired)
{
$clnt = new-object System.Net.WebClient
Write-Host "Downloading from $url to $file"
$clnt.DownloadFile($url, $file)
}
else
{
Write-Host "$file is up to date."
}
return $downloadRequired
}
# ----------------------------------------------------------------------------------------------
# unzip a file
# ----------------------------------------------------------------------------------------------
function RemoveCef
{
param([string]$outpath)
if (Test-Path $outpath)
{
Write-Host "Remove folder $outpath"
Remove-Item $outpath -Force -Recurse
}
}
$output = Download-File -url $args[0] -file $args[1]
if ($output)
{
RemoveCef -outpath $args[2]
}

View File

@ -12,11 +12,7 @@ if defined TARGET (
mkdir "%SCRIPTPATH%%PLATFORM%"
cd "%SCRIPTPATH%%PLATFORM%"
if exist "cef_binary.7z" (
echo "cef_binary.7z already downloaded"
) else (
Powershell.exe Invoke-WebRequest -OutFile cef_binary.7z http://d2ettrnqo7v976.cloudfront.net/cef/2454/%PLATFORM%/cef_binary.7z
)
Powershell.exe -executionpolicy remotesigned -file %SCRIPTPATH%download.ps1 http://d2ettrnqo7v976.cloudfront.net/cef/3163/%PLATFORM%/cef_binary.7z cef_binary.7z cef_binary
SET UNSIP_PROGRAMM="%ProgramFiles%\7-Zip\7z.exe"
SET UNSIP_PROGRAMM2="%ProgramFiles(x86)%\7-Zip\7z.exe"

View File

@ -8,7 +8,7 @@ platform=""
case "$os" in
Linux*) platform="linux" ;;
Darwin*) platform="mac" ;;
Darwin*) platform="mac" ;;
*) exit ;;
esac
@ -35,22 +35,36 @@ echo ""
else
mkdir "build"
fi
cef_binary=cef_binary
cef_arch=$cef_binary.7z
cef_url=http://d2ettrnqo7v976.cloudfront.net/cef/3163/$platform$arch/$cef_arch
if [[ "$platform" == *"linux"* ]]
then
if [[ -f "cef_binary.7z" ]]
then
echo "cef_binary already downloaded"
else
wget http://d2ettrnqo7v976.cloudfront.net/cef/2454/$platform$arch/cef_binary.7z
fi
if [ -d cef_binary ]
then
echo "cef_binary already extracted"
else
7z x -y cef_binary.7z
fi
cp -r -t build/ ./cef_binary/Release/* ./cef_binary/Resources/*
chmod a+xr build/locales
if [[ -f $cef_arch ]]
then
cef_mod_time=$(date -d"$(curl -sI $cef_url | awk '/Last-Modified/ {print ($3, $4, $5, $6, $7, $8)}')" +"%s")
local_mod_time=$(stat -c %Y $cef_arch)
if [[ $cef_mod_time -eq $local_mod_time ]]
then
echo "cef_binary already downloaded"
else
wget $cef_url -O $cef_arch
rm -fr $cef_binary/
fi
else
wget $cef_url
rm -fr $cef_binary/
fi
if [ -d $cef_binary ]
then
echo "cef_binary already extracted"
else
7z x -y $cef_arch
fi
cp -r -t build/ ./$cef_binary/Release/* ./$cef_binary/Resources/*
chmod a+xr build/locales
fi

View File

@ -147,6 +147,7 @@ HEADERS += docxformatlib.h \
../Source/DocxFormat/Media/Media.h \
../Source/DocxFormat/Media/OleObject.h \
../Source/DocxFormat/Media/Video.h \
../Source/DocxFormat/Media/JsaProject.h \
../Source/DocxFormat/Settings/Settings.h \
../Source/DocxFormat/Settings/WebSettings.h \
../Source/DocxFormat/App.h \

View File

@ -54,6 +54,7 @@
#include "Media/OleObject.h"
#include "Media/ActiveX.h"
#include "Media/VbaProject.h"
#include "Media/JsaProject.h"
#include "HeaderFooter.h"
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"

View File

@ -49,6 +49,7 @@
#include "Media/Audio.h"
#include "Media/Video.h"
#include "Media/VbaProject.h"
#include "Media/JsaProject.h"
#include "External/HyperLink.h"
#include "External/ExternalVideo.h"
#include "External/ExternalAudio.h"
@ -146,6 +147,8 @@ namespace OOX
return smart_ptr<OOX::File>(new OOX::VbaProject( oRootPath, oFileName ));
//else if ( oRelation.Type() == OOX::FileTypes::VbaData)
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
else if ( oRelation.Type() == FileTypes::JsaProject)
return smart_ptr<OOX::File>(new JsaProject( oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
}
@ -238,6 +241,8 @@ namespace OOX
return smart_ptr<OOX::File>(new OOX::VbaProject( oRootPath, oFileName ));
//else if ( pRelation->Type() == FileTypes::VbaData)
// return smart_ptr<OOX::File>(new OOX::VbaData( oFileName ));
else if ( pRelation->Type() == FileTypes::JsaProject)
return smart_ptr<OOX::File>(new JsaProject( oFileName ));
return smart_ptr<OOX::File>( new UnknowTypeFile() );
}

View File

@ -192,6 +192,10 @@ namespace OOX
_T("application/vnd.ms-word.vbaData+xml"),
_T("http://schemas.microsoft.com/office/2006/relationships/wordVbaData"));
const FileType JsaProject(L"", L"jsaProject.bin",
_T(""),
_T("http://schemas.onlyoffice.com/jsaProject"));
const FileType MicrosoftOfficeUnknown(L"embeddings", L"",
_T(""),
_T("http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"));

View File

@ -142,7 +142,13 @@ namespace OOX
virtual void fromXML(XmlUtils::CXmlNode &oNode)
{
// TO DO: Реализовать CPicture::fromXML(XmlUtils::CXmlNode &oNode)
if ( oNode.IsValid() == false)
return;
m_sXml.Init();
*m_sXml = oNode.GetXml(); //для pptx dll
fromStringXML(m_sXml.get());
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
@ -152,11 +158,15 @@ namespace OOX
m_sXml.Init();
*m_sXml = oReader.GetOuterXml(); //для pptx dll
fromStringXML(m_sXml.get());
}
void fromStringXML(const std::wstring & xml_string)
{
std::wstring sBegin(L"<root 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\">");
std::wstring sEnd(L"</root>");
std::wstring sXml = sBegin + m_sXml.get() + sEnd;
std::wstring sXml = sBegin + xml_string + sEnd;
XmlUtils::CXmlLiteReader oSubReader;

View File

@ -0,0 +1,99 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#pragma once
#ifndef OOX_ONLY_JSA_PROJECT_INCLUDE_H_
#define OOX_ONLY_JSA_PROJECT_INCLUDE_H_
#include "Media.h"
#include "../../XlsxFormat/FileTypes_Spreadsheet.h"
namespace OOX
{
class JsaProject : public Media
{
public:
JsaProject()
{
}
JsaProject(const CPath& filename)
{
read(filename);
}
virtual ~JsaProject()
{
}
virtual const FileType type() const
{
return FileTypes::JsaProject;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
BYTE* pData = NULL;
DWORD nBytesCount;
if(NSFile::CFileBinary::ReadAllBytes(m_filename.GetPath(), &pData, nBytesCount))
{
pWriter->WriteBYTEArray(pData, nBytesCount);
}
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _length = pReader->GetLong();
LONG _end_rec = pReader->GetPos() + _length;
if (_length > 0)
{
BYTE* pData = pReader->GetPointer(_length);
std::wstring filePath = pReader->m_pRels->m_pManager->GetDstFolder() + FILE_SEPARATOR_STR + OOX::FileTypes::JsaProject.DefaultFileName().GetPath();
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath);
oFile.WriteFile(pData, _length);
oFile.CloseFile();
pReader->m_pRels->m_pManager->m_pContentTypes->AddDefault(OOX::FileTypes::JsaProject.DefaultFileName().GetExtention(false));
set_filename(filePath);
}
pReader->Seek(_end_rec);
}
};
} // namespace OOX
#endif // OOX_ONLY_JSA_PROJECT_INCLUDE_H_

View File

@ -118,6 +118,9 @@ bool COfficeFileFormatChecker::isPdfFormatFile (unsigned char* pBuffer,int dwByt
if (pBuffer == NULL) return false;
int nTempBufferSize = dwBytes < 20 ? dwBytes : 20;
if (nTempBufferSize < 1)
return false;
char* pTempBuffer = new char[nTempBufferSize];
memcpy ( pTempBuffer, pBuffer, nTempBufferSize );

View File

@ -278,7 +278,9 @@ bin: $(X2T) $(ALLFONTSGEN)
lib: $(PDFWRITER) $(DOCTRENDERER) $(HTMLRENDERER) $(PDFREADER) $(DJVUFILE) $(XPSFILE) $(HTMLFILE) $(UNICODECONVERTER)
ext: $(ASCDOCUMENTSCORE) $(HTMLFILEINTERNAL) $(DOCBUILDER)
ext: $(HTMLFILEINTERNAL) $(DOCBUILDER)
desktop: $(ASCDOCUMENTSCORE)
$(foreach proj, $(QT_PROJ), $(eval $(call build_proj_tmpl, $(proj))))

View File

@ -2553,7 +2553,7 @@ namespace NExtractTools
}
int oox2mscrypt (const std::wstring &sFrom, const std::wstring &sTo, const std::wstring & sTemp, InputParams& params)
{
std::wstring password = params.getPassword();
std::wstring password = params.getSavePassword();
ECMACryptFile cryptReader;
@ -2987,7 +2987,7 @@ namespace NExtractTools
{
if(AVS_OFFICESTUDIO_FILE_DOCUMENT_DOCX == nFormatTo)
{
if(params.hasPassword())
if(params.hasSavePassword())
{
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.docx");
nRes = dir2zip(sFrom, sToMscrypt);
@ -3199,7 +3199,7 @@ namespace NExtractTools
{
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo)
{
if(params.hasPassword())
if(params.hasSavePassword())
{
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.xlsx");
nRes = dir2zip(sFrom, sToMscrypt);
@ -3386,7 +3386,7 @@ namespace NExtractTools
{
if(AVS_OFFICESTUDIO_FILE_PRESENTATION_PPTX == nFormatTo)
{
if(params.hasPassword())
if(params.hasSavePassword())
{
std::wstring sToMscrypt = sTemp + FILE_SEPARATOR_STR + _T("tomscrypt.pptx");
nRes = dir2zip(sFrom, sToMscrypt);
@ -4177,6 +4177,14 @@ namespace NExtractTools
{
result = fromMscrypt (sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_MSCRYPT2_RAW:
{
result = mscrypt2oox(sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_2MSCRYPT_RAW:
{
result = oox2mscrypt(sFileFrom, sFileTo, sTempDir, oInputParams);
}break;
case TCD_MSCRYPT2DOCT:
case TCD_MSCRYPT2XLST:
case TCD_MSCRYPT2PPTT:

View File

@ -165,6 +165,10 @@ namespace NExtractTools
TCD_MSCRYPT2XLST,
TCD_MSCRYPT2PPTT,
TCD_MSCRYPT2BIN,
TCD_MSCRYPT2_RAW,
TCD_2MSCRYPT_RAW,
//
TCD_HTML2DOCX,
TCD_HTML2DOCT,
@ -378,6 +382,7 @@ namespace NExtractTools
int* m_nDoctParams;
std::wstring* m_sHtmlFileInternalPath;
std::wstring* m_sPassword;
std::wstring* m_sSavePassword;
std::wstring* m_sTempDir;
bool* m_bIsNoBase64;
//output params
@ -404,6 +409,7 @@ namespace NExtractTools
m_nDoctParams = NULL;
m_sHtmlFileInternalPath = NULL;
m_sPassword = NULL;
m_sSavePassword = NULL;
m_sTempDir = NULL;
m_bIsNoBase64 = NULL;
@ -430,6 +436,7 @@ namespace NExtractTools
RELEASEOBJECT(m_nDoctParams);
RELEASEOBJECT(m_sHtmlFileInternalPath);
RELEASEOBJECT(m_sPassword);
RELEASEOBJECT(m_sSavePassword);
RELEASEOBJECT(m_sTempDir);
RELEASEOBJECT(m_bIsNoBase64);
}
@ -518,6 +525,8 @@ namespace NExtractTools
m_sHtmlFileInternalPath = new std::wstring(sValue);
else if(_T("m_sPassword") == sName)
m_sPassword = new std::wstring(sValue);
else if(_T("m_sSavePassword") == sName)
m_sSavePassword = new std::wstring(sValue);
else if(_T("m_sTempDir") == sName)
m_sTempDir = new std::wstring(sValue);
else if(_T("m_bIsNoBase64") == sName)
@ -545,6 +554,14 @@ namespace NExtractTools
{
return (NULL != m_sPassword) ? (*m_sPassword) : L"";
}
bool hasSavePassword() const
{
return NULL != m_sSavePassword;
}
std::wstring getSavePassword() const
{
return (NULL != m_sSavePassword) ? (*m_sSavePassword) : L"";
}
std::wstring getFontPath() const
{
return (NULL != m_sFontDir) ? (*m_sFontDir) : L"";

View File

@ -146,6 +146,7 @@ static std::wstring utf8_to_unicode(const char *src)
if (argc > 4)
{
oInputParams.m_sPassword = new std::wstring(sArg4);
oInputParams.m_sSavePassword = new std::wstring(sArg4);
}
result = NExtractTools::fromInputParams(oInputParams);
}

View File

@ -192,7 +192,8 @@ namespace BinXlsxRW
ExternalBook = 9,
OleLink = 10,
DdeLink = 11,
VbaProject = 12
VbaProject = 12,
JsaProject = 13
};}
namespace c_oSerWorkbookVbaProjectTypes{enum c_oSerWorkbookVbaProjectTypes
{

View File

@ -1536,6 +1536,20 @@ namespace BinXlsxRW
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
//Write JsaProject
smart_ptr<OOX::File> fileJsaProject = workbook.Get(OOX::FileTypes::JsaProject);
if (fileJsaProject.IsInit() && OOX::FileTypes::JsaProject == fileJsaProject->type())
{
smart_ptr<OOX::JsaProject> jsaProject = fileJsaProject.smart_dynamic_cast<OOX::JsaProject>();
BYTE* pData = NULL;
DWORD nBytesCount;
if(NSFile::CFileBinary::ReadAllBytes(jsaProject->filename().GetPath(), &pData, nBytesCount))
{
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::JsaProject);
m_oBcw.m_oStream.WriteBYTEArray(pData, nBytesCount);
m_oBcw.WriteItemWithLengthEnd(nCurPos);
}
}
}
void WriteWorkbookPr(const OOX::Spreadsheet::CWorkbookPr& workbookPr)
{

View File

@ -37,6 +37,7 @@
#include "../../Common/DocxFormat/Source/XlsxFormat/Worksheets/Sparkline.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/VbaProject.h"
#include "../../Common/DocxFormat/Source/DocxFormat/Media/JsaProject.h"
#include "../../DesktopEditor/common/Path.h"
#include "../../DesktopEditor/common/Directory.h"
@ -1507,9 +1508,10 @@ namespace BinXlsxRW {
OOX::Spreadsheet::CWorkbook& m_oWorkbook;
std::map<long, NSCommon::smart_ptr<OOX::File>>& m_mapPivotCacheDefinitions;
const std::wstring& m_sDestinationDir;
NSBinPptxRW::CDrawingConverter* m_pOfficeDrawingConverter;
public:
BinaryWorkbookTableReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorkbook& oWorkbook, std::map<long, NSCommon::smart_ptr<OOX::File>>& mapPivotCacheDefinitions, const std::wstring& sDestinationDir)
: Binary_CommonReader(oBufferedStream), m_oWorkbook(oWorkbook), m_mapPivotCacheDefinitions(mapPivotCacheDefinitions), m_sDestinationDir(sDestinationDir)
BinaryWorkbookTableReader(NSBinPptxRW::CBinaryFileReader& oBufferedStream, OOX::Spreadsheet::CWorkbook& oWorkbook, std::map<long, NSCommon::smart_ptr<OOX::File>>& mapPivotCacheDefinitions, const std::wstring& sDestinationDir, NSBinPptxRW::CDrawingConverter* pOfficeDrawingConverter)
: Binary_CommonReader(oBufferedStream), m_oWorkbook(oWorkbook), m_mapPivotCacheDefinitions(mapPivotCacheDefinitions), m_sDestinationDir(sDestinationDir), m_pOfficeDrawingConverter(pOfficeDrawingConverter)
{
}
int Read()
@ -1557,6 +1559,22 @@ namespace BinXlsxRW {
m_oWorkbook.m_bMacroEnabled = true;
}
else if(c_oSerWorkbookTypes::JsaProject == type)
{
BYTE* pData = m_oBufferedStream.GetPointer(length);
OOX::CPath oJsaProject = OOX::FileTypes::JsaProject.DefaultFileName();
std::wstring filePath = m_sDestinationDir + FILE_SEPARATOR_STR + _T("xl") + FILE_SEPARATOR_STR + oJsaProject.GetPath();
NSFile::CFileBinary oFile;
oFile.CreateFileW(filePath);
oFile.WriteFile(pData, length);
oFile.CloseFile();
smart_ptr<OOX::JsaProject> oFileJsaProject(new OOX::JsaProject());
smart_ptr<OOX::File> oFileJsaProjectFile = oFileJsaProject.smart_dynamic_cast<OOX::File>();
m_oWorkbook.Add(oFileJsaProjectFile);
m_pOfficeDrawingConverter->m_pImageManager->m_pContentTypes->AddDefault(oJsaProject.GetExtention(false));
}
else
res = c_oSerConstants::ReadUnknown;
return res;
@ -4430,7 +4448,7 @@ namespace BinXlsxRW {
if(-1 != nWorkbookOffBits)
{
oBufferedStream.Seek(nWorkbookOffBits);
res = BinaryWorkbookTableReader(oBufferedStream, *pWorkbook, m_mapPivotCacheDefinitions, sOutDir).Read();
res = BinaryWorkbookTableReader(oBufferedStream, *pWorkbook, m_mapPivotCacheDefinitions, sOutDir, pOfficeDrawingConverter).Read();
if(c_oSerConstants::ReadOk != res)
return res;
}