Compare commits

..

7 Commits

5 changed files with 36 additions and 9 deletions

View File

@ -165,9 +165,14 @@ JSSmart<CJSValue> CGraphicsEmbed::create(JSSmart<CJSValue> Native, JSSmart<CJSVa
JSSmart<CJSObject> pNativeObject = Native->toObject();
CJSEmbedObject* pNativeEmbedObject = pNativeObject->getNative();
if (m_pInternal->m_pAppImage)
if (m_pInternal->m_pAppImage && pNativeEmbedObject)
{
delete m_pInternal->m_pAppImage;
m_pInternal->m_pAppImage = new CGraphicsAppImage();
m_pInternal->m_pAppImage = NULL;
}
if (NULL == m_pInternal->m_pAppImage)
m_pInternal->m_pAppImage = new CGraphicsAppImage();
if (pNativeEmbedObject)
{

View File

@ -238,7 +238,8 @@ namespace BinXlsxRW
ExternalLinksAutoRefresh = 26,
TimelineCaches = 27,
TimelineCache = 28,
Metadata = 29
Metadata = 29,
PivotCachesTmp = 107
};}
namespace c_oSerWorkbookProtection {enum c_oSerWorkbookProtection{
AlgorithmName = 0,
@ -456,6 +457,8 @@ namespace BinXlsxRW
TimelinesList = 48,
Timelines = 49,
Timeline = 50,
PivotTableTmp = 126,
};}
namespace c_oSerWorksheetProtection {enum c_oSerWorksheetPropTypes

View File

@ -2152,7 +2152,7 @@ void BinaryWorkbookTableWriter::WriteWorkbook(OOX::Spreadsheet::CWorkbook& workb
}
if (workbook.m_oPivotCaches.IsInit())
{
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::PivotCaches);
nCurPos = m_oBcw.WriteItemStart(c_oSerWorkbookTypes::PivotCachesTmp);
WritePivotCaches(workbook, workbook.m_oPivotCaches.get());
if (workbook.m_oExtLst.IsInit())
{
@ -4772,7 +4772,7 @@ void BinaryWorksheetTableWriter::WriteWorksheet(OOX::Spreadsheet::CSheet* pSheet
if ((pPivotTableFile) && (pPivotTableFile->m_oPivotTableDefinition.IsInit()))
{
BinaryTableWriter oBinaryTableWriter(m_oBcw.m_oStream);
nCurPos = m_oBcw.WriteItemStart(c_oSerWorksheetsTypes::PivotTable);
nCurPos = m_oBcw.WriteItemStart(c_oSerWorksheetsTypes::PivotTableTmp);
if(pPivotTableFile->m_oPivotTableDefinition->m_oCacheId.IsInit())
{
auto cachePos = m_oBcw.WriteItemStart(c_oSer_PivotTypes::cacheId);

View File

@ -2189,7 +2189,8 @@ int BinaryWorkbookTableReader::ReadWorkbookTableContent(BYTE type, long length,
m_oWorkbook.m_oExternalReferences.Init();
READ1_DEF(length, res, this->ReadExternalReferences, poResult);
}
else if (c_oSerWorkbookTypes::PivotCaches == type)
else if (c_oSerWorkbookTypes::PivotCaches == type ||
c_oSerWorkbookTypes::PivotCachesTmp == type)
{
m_oWorkbook.m_oPivotCachesXml.Init();
m_oWorkbook.m_oPivotCachesXml->append(L"<pivotCaches>");
@ -4621,7 +4622,25 @@ int BinaryWorksheetsTableReader::ReadWorksheet(boost::unordered_map<BYTE, std::v
RELEASEOBJECT(oPivotCachesTemp.pTable);
}
SEEK_TO_POS_END2();
//-------------------------------------------------------------------------------------------------------------
//tmp-------------------------------------------------------------------------------------------------------------
SEEK_TO_POS_START(c_oSerWorksheetsTypes::PivotTableTmp);
PivotCachesTemp oPivotCachesTemp;
READ1_DEF(length, res, this->ReadPivotTable, &oPivotCachesTemp);
boost::unordered_map<long, NSCommon::smart_ptr<OOX::File>>::const_iterator pair = m_mapPivotCacheDefinitions.find(oPivotCachesTemp.nCacheId);
if (m_mapPivotCacheDefinitions.end() != pair && NULL != oPivotCachesTemp.pTable)
{
NSCommon::smart_ptr<OOX::File> pFileTable(oPivotCachesTemp.pTable);
oPivotCachesTemp.pTable->AddNoWrite(pair->second, L"../pivotCache");
m_pCurWorksheet->Add(pFileTable);
}
else
{
RELEASEOBJECT(oPivotCachesTemp.pTable);
}
SEEK_TO_POS_END2();
//tmp-------------------------------------------------------------------------------------------------------------
SEEK_TO_POS_START(c_oSerWorksheetsTypes::NamedSheetView);
smart_ptr<OOX::Spreadsheet::CNamedSheetViewFile> pNamedSheetViewFile(new OOX::Spreadsheet::CNamedSheetViewFile(NULL));
pNamedSheetViewFile->m_oNamedSheetViews.Init();

View File

@ -40,7 +40,7 @@
#include "../../XlsbFormat/Biff12_records/BeginHeaderFooter.h"
#include "../../XlsbFormat/Biff12_records/SheetProtectionIso.h"
#include "../../XlsbFormat/Biff12_records/SheetProtection.h"
#include "../../XlsbFormat/Biff12_records/LegacyDrawingHF.h"
#include "../../XlsbFormat/Biff12_records/LegacyDrawingHF.h"
#include "../../XlsbFormat/Biff12_records/Margins.h"
#include "../../XlsbFormat/Biff12_records/PrintOptions.h"
#include "../../XlsbFormat/Biff12_records/WsProp.h"
@ -3632,7 +3632,7 @@ namespace OOX
void CSheetProtection::toBin(XLS::StreamCacheWriterPtr& writer)
{
XLS::CFRecordPtr record;
unsigned char *flagBuf;
unsigned char *flagBuf = NULL;
if(m_oSpinCount.IsInit() || m_oHashValue.IsInit() || m_oSaltValue.IsInit())
{
record = writer->getNextRecord(XLSB::rt_SheetProtectionIso);