mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-20 03:55:47 +08:00
for xlsb pivots
This commit is contained in:
@ -76,15 +76,30 @@ namespace OOX
|
||||
{
|
||||
if (!oRels.m_arRelations[i]) continue;
|
||||
|
||||
std::wstring pathFile = (oPath / oRels.m_arRelations[i]->Target()).GetPath();
|
||||
if (m_pMainDocument)
|
||||
{
|
||||
std::map<std::wstring, smart_ptr<OOX::File>>::iterator pFind = m_pMainDocument->m_mapContent.find(pathFile);
|
||||
|
||||
if (pFind != m_pMainDocument->m_mapContent.end())
|
||||
{
|
||||
Add(oRels.m_arRelations[i]->rId(), pFind->second);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
smart_ptr<OOX::File> pFile;
|
||||
|
||||
|
||||
if (m_bSpreadsheets)
|
||||
pFile = OOX::Spreadsheet::CreateFile( oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument );
|
||||
|
||||
pFile = OOX::Spreadsheet::CreateFile(oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument);
|
||||
|
||||
if (pFile.IsInit() == false || pFile->type() == FileTypes::Unknow)
|
||||
pFile = OOX::CreateFile( oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument );
|
||||
pFile = OOX::CreateFile(oRootPath, oPath, oRels.m_arRelations[i], m_pMainDocument);
|
||||
|
||||
Add(oRels.m_arRelations[i]->rId(), pFile);
|
||||
|
||||
Add( oRels.m_arRelations[i]->rId(), pFile );
|
||||
if (m_pMainDocument)
|
||||
m_pMainDocument->m_mapContent.insert(std::make_pair(pathFile, pFile));
|
||||
}
|
||||
}
|
||||
|
||||
@ -99,6 +114,8 @@ namespace OOX
|
||||
}
|
||||
void IFileContainer::Write(OOX::CRels& oRels, const OOX::CPath& oCurrent, const OOX::CPath& oDir, OOX::CContentTypes& oContent) const
|
||||
{
|
||||
const OOX::File* pFileOwner = dynamic_cast<const OOX::File*>(this);
|
||||
|
||||
for (boost::unordered_map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = m_mapContainer.begin(); pPair != m_mapContainer.end(); ++pPair)
|
||||
{
|
||||
smart_ptr<OOX::File> pFile = pPair->second;
|
||||
@ -112,7 +129,13 @@ namespace OOX
|
||||
OOX::CPath oDefDir = pFile->DefaultDirectory();
|
||||
OOX::CPath oName = pFile->DefaultFileName();
|
||||
|
||||
if(false == pFile->m_sOutputFilename.empty())
|
||||
if (pFile->type() == OOX::Spreadsheet::FileTypes::PivotCacheDefinition &&
|
||||
pFileOwner->type() == OOX::Spreadsheet::FileTypes::PivotTable)
|
||||
{
|
||||
oDefDir = L"../" + oDefDir;
|
||||
}
|
||||
|
||||
if (false == pFile->m_sOutputFilename.empty())
|
||||
oName.SetName(pFile->m_sOutputFilename, false);
|
||||
|
||||
boost::unordered_map<std::wstring, std::wstring>::const_iterator itFind = m_mNoWriteContainer.find(pPair->first);
|
||||
|
||||
@ -33,6 +33,7 @@
|
||||
|
||||
#include "../../../../DesktopEditor/xml/include/xmlutils.h"
|
||||
#include "../../../../ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObject.h"
|
||||
#include "../Base/SmartPtr.h"
|
||||
|
||||
namespace NSBinPptxRW
|
||||
{
|
||||
@ -1393,6 +1394,9 @@ namespace OOX
|
||||
et_x_ListItems,
|
||||
et_x_ListItem,
|
||||
|
||||
et_x_WorkbookPivotCache,
|
||||
et_x_WorkbookPivotCaches,
|
||||
|
||||
et_x_PivotTableDefinition,
|
||||
et_x_PivotCacheDefinition,
|
||||
et_x_PivotCacheRecords,
|
||||
@ -1484,6 +1488,8 @@ namespace OOX
|
||||
et_x_Style2003
|
||||
};
|
||||
|
||||
class File;
|
||||
|
||||
class Document
|
||||
{
|
||||
public:
|
||||
@ -1491,6 +1497,8 @@ namespace OOX
|
||||
virtual ~Document() {}
|
||||
|
||||
std::wstring m_sDocumentPath;
|
||||
|
||||
std::map<std::wstring, NSCommon::smart_ptr<OOX::File>> m_mapContent;
|
||||
};
|
||||
|
||||
class WritingElement
|
||||
|
||||
@ -123,7 +123,7 @@ namespace OOX
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition",
|
||||
L"pivotCache/pivotCacheDefinition", true);
|
||||
|
||||
const FileType PivotCacheRecords(L"pivotCache", L"pivotCacheRecords.xml",
|
||||
const FileType PivotCacheRecords(L"", L"pivotCacheRecords.xml",
|
||||
L"application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml",
|
||||
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords",
|
||||
L"pivotCache/pivotCacheRecords", true, true);
|
||||
|
||||
@ -204,6 +204,19 @@ mc:Ignorable=\"xr16\" \
|
||||
xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"");
|
||||
|
||||
WritingStringNullableAttrEncodeXmlString2(L"name", m_oName);
|
||||
WritingStringNullableAttrInt(L"cacheId", m_oCacheId, m_oCacheId->GetValue());
|
||||
WritingStringNullableAttrBool2(L"dataOnRows", m_oDataOnRows);
|
||||
WritingStringNullableAttrInt(L"dataPosition", m_oDataPosition, m_oDataPosition->GetValue());
|
||||
WritingStringNullableAttrEncodeXmlString2(L"dataCaption", m_oDataCaption);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"grandTotalCaption",m_oGrandTotalCaption);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"errorCaption", m_oErrorCaption);
|
||||
WritingStringNullableAttrBool2(L"showError", m_oShowError);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"missingCaption",m_oMissingCaption);
|
||||
WritingStringNullableAttrBool2(L"showMissing", m_oShowMissing);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"pageStyle", m_oPageStyle);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"pivotTableStyle", m_oPivotTableStyle);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"vacatedStyle", m_oVacatedStyle);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"tag", m_oTag);
|
||||
WritingStringNullableAttrBool2(L"applyAlignmentFormats", m_oApplyAlignmentFormats);
|
||||
WritingStringNullableAttrBool2(L"applyBorderFormats", m_oApplyBorderFormats);
|
||||
WritingStringNullableAttrBool2(L"applyFontFormats", m_oApplyFontFormats);
|
||||
@ -212,7 +225,6 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
WritingStringNullableAttrBool2(L"applyWidthHeightFormats", m_oApplyWidthHeightFormats);
|
||||
WritingStringNullableAttrBool2(L"asteriskTotals", m_oAsteriskTotals);
|
||||
WritingStringNullableAttrInt(L"autoFormatId", m_oAutoFormatId, m_oAutoFormatId->GetValue());
|
||||
WritingStringNullableAttrInt(L"cacheId", m_oCacheId, m_oCacheId->GetValue());
|
||||
WritingStringNullableAttrInt(L"chartFormat", m_oChartFormat, m_oChartFormat->GetValue());
|
||||
WritingStringNullableAttrBool2(L"colGrandTotals", m_oColGrandTotals);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"colHeaderCaption",m_oColHeaderCaption);
|
||||
@ -220,18 +232,13 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
WritingStringNullableAttrBool2(L"compactData", m_oCompactData);
|
||||
WritingStringNullableAttrInt(L"createdVersion", m_oCreatedVersion, m_oCreatedVersion->GetValue());
|
||||
WritingStringNullableAttrBool2(L"customListSort", m_oCustomListSort);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"dataCaption", m_oDataCaption);
|
||||
WritingStringNullableAttrBool2(L"dataOnRows", m_oDataOnRows);
|
||||
WritingStringNullableAttrInt(L"dataPosition", m_oDataPosition, m_oDataPosition->GetValue());
|
||||
WritingStringNullableAttrBool2(L"disableFieldList", m_oDisableFieldList);
|
||||
WritingStringNullableAttrBool2(L"editData", m_oEditData);
|
||||
WritingStringNullableAttrBool2(L"enableDrill", m_oEnableDrill);
|
||||
WritingStringNullableAttrBool2(L"enableFieldProperties", m_oEnableFieldProperties);
|
||||
WritingStringNullableAttrBool2(L"enableWizard", m_oEnableWizard);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"errorCaption", m_oErrorCaption);
|
||||
WritingStringNullableAttrBool2(L"disableEdit", m_oFieldListSortAscending);
|
||||
WritingStringNullableAttrBool2(L"fieldPrintTitles", m_oFieldPrintTitles);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"grandTotalCaption",m_oGrandTotalCaption);
|
||||
WritingStringNullableAttrBool2(L"gridDropZones", m_oGridDropZones);
|
||||
WritingStringNullableAttrBool2(L"immersive", m_oImmersive);
|
||||
WritingStringNullableAttrInt(L"indent", m_oIndent, m_oIndent->GetValue());
|
||||
@ -239,14 +246,11 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
WritingStringNullableAttrBool2(L"mdxSubqueries", m_oMdxSubqueries);
|
||||
WritingStringNullableAttrBool2(L"mergeItem", m_oMergeItem);
|
||||
WritingStringNullableAttrInt(L"minRefreshableVersion", m_oMinRefreshableVersion, m_oMinRefreshableVersion->GetValue());
|
||||
WritingStringNullableAttrEncodeXmlString2(L"missingCaption",m_oMissingCaption);
|
||||
WritingStringNullableAttrBool2(L"multipleFieldFilters", m_oMultipleFieldFilters);
|
||||
WritingStringNullableAttrBool2(L"outline", m_oOutline);
|
||||
WritingStringNullableAttrBool2(L"outlineDatae", m_oOutlineData);
|
||||
WritingStringNullableAttrBool2(L"pageOverThenDown", m_oPageOverThenDown);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"pageStyle", m_oPageStyle);
|
||||
WritingStringNullableAttrInt(L"pageWrap", m_oPageWrap, m_oPageWrap->GetValue());
|
||||
WritingStringNullableAttrEncodeXmlString2(L"pivotTableStyle",m_oPivotTableStyle);
|
||||
WritingStringNullableAttrBool2(L"preserveFormatting", m_oPreserveFormatting);
|
||||
WritingStringNullableAttrBool2(L"printDrill", m_oPrintDrill);
|
||||
WritingStringNullableAttrBool2(L"published", m_oPublished);
|
||||
@ -259,17 +263,13 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
WritingStringNullableAttrBool2(L"showDropZones", m_oShowDropZones);
|
||||
WritingStringNullableAttrBool2(L"showEmptyCol", m_oShowEmptyCol);
|
||||
WritingStringNullableAttrBool2(L"showEmptyRow", m_oShowEmptyRow);
|
||||
WritingStringNullableAttrBool2(L"showError", m_oShowError);
|
||||
WritingStringNullableAttrBool2(L"showHeaders", m_oShowHeaders);
|
||||
WritingStringNullableAttrBool2(L"showItems", m_oShowItems);
|
||||
WritingStringNullableAttrBool2(L"showMemberPropertyTips", m_oShowMemberPropertyTips);
|
||||
WritingStringNullableAttrBool2(L"showMissing", m_oShowMissing);
|
||||
WritingStringNullableAttrBool2(L"showMultipleLabel", m_oShowMultipleLabel);
|
||||
WritingStringNullableAttrBool2(L"subtotalHiddenItems", m_oSubtotalHiddenItems);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"tag", m_oTag);
|
||||
WritingStringNullableAttrInt(L"updatedVersion", m_oUpdatedVersion, m_oUpdatedVersion->GetValue());
|
||||
WritingStringNullableAttrBool2(L"useAutoFormatting", m_oUseAutoFormatting);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"vacatedStyle", m_oVacatedStyle);
|
||||
WritingStringNullableAttrBool2(L"visualTotals", m_oVisualTotals);
|
||||
|
||||
writer.WriteString(L">");
|
||||
@ -294,22 +294,21 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
|
||||
if(m_oFormats.IsInit())
|
||||
m_oFormats->toXML(writer);
|
||||
if(m_oPivotTableStyleInfo.IsInit())
|
||||
m_oPivotTableStyleInfo->toXML(writer);
|
||||
|
||||
//if(m_oConditionalFormats.IsInit())
|
||||
// m_oConditionalFormats->toXML(writer);
|
||||
//if(m_oChartFormats.IsInit())
|
||||
// m_oChartFormats->toXML(writer);
|
||||
//if(m_oFilters.IsInit())
|
||||
// m_oFilters->toXML(writer);
|
||||
|
||||
//if(m_oColHierarchiesUsage.IsInit())
|
||||
// m_oColHierarchiesUsage->toXML(writer);
|
||||
//if(m_oPivotHierarchies.IsInit())
|
||||
// m_oPivotHierarchies->toXML(writer);
|
||||
if(m_oPivotTableStyleInfo.IsInit())
|
||||
m_oPivotTableStyleInfo->toXML(writer);
|
||||
|
||||
//if(m_oFilters.IsInit())
|
||||
// m_oFilters->toXML(writer);
|
||||
//if(m_oRowHierarchiesUsage.IsInit())
|
||||
// m_oRowHierarchiesUsage->toXML(writer);
|
||||
//if(m_oColHierarchiesUsage.IsInit())
|
||||
// m_oColHierarchiesUsage->toXML(writer);
|
||||
|
||||
if(m_oExtLst.IsInit())
|
||||
{
|
||||
@ -1222,7 +1221,7 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
WritingStringNullableAttrBool2(L"f", m_oCalculated);
|
||||
WritingStringNullableAttrBool2(L"h", m_oHidden);
|
||||
WritingStringNullableAttrBool2(L"m", m_oMissing);
|
||||
WritingStringNullableAttrBool2(L"c", m_oCharacter);
|
||||
WritingStringNullableAttrBool2(L"s", m_oCharacter);
|
||||
WritingStringNullableAttrBool2(L"sd", m_oHideDetails);
|
||||
WritingStringNullableAttrEncodeXmlString2(L"n", m_oUserCaption);
|
||||
WritingStringNullableAttrString(L"x", m_oItemIndex, m_oItemIndex->ToString());
|
||||
@ -1324,7 +1323,7 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"h", m_oHidden )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"m", m_oMissing )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"n", m_oUserCaption )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"c", m_oCharacter )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"s", m_oCharacter )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"sd", m_oHideDetails )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"t", m_oItemType )
|
||||
WritingElement_ReadAttributes_Read_else_if ( oReader, L"x", m_oItemIndex )
|
||||
@ -2066,7 +2065,7 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
//------------------------------------
|
||||
void CPivotTableLocation::toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<pivotArea");
|
||||
writer.WriteString(L"<location");
|
||||
WritingStringNullableAttrString(L"colPageCount", m_oColPageCount, m_oColPageCount->ToString());
|
||||
WritingStringNullableAttrString(L"firstDataCol", m_oFirstDataCol, m_oFirstDataCol->ToString());
|
||||
WritingStringNullableAttrString(L"firstDataRow", m_oFirstDataRow, m_oFirstDataRow->ToString());
|
||||
@ -2111,19 +2110,20 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
m_oRowPageCount = ptr->crwPage;
|
||||
|
||||
if(!ptr->rfxGeom.toString().empty())
|
||||
m_oRef = ptr->rfxGeom.toString();
|
||||
m_oRef = ptr->rfxGeom.toString();
|
||||
}
|
||||
}
|
||||
//------------------------------------
|
||||
void CPivotTableStyleInfo::toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<pivotArea");
|
||||
writer.WriteString(L"<pivotTableStyleInfo");
|
||||
WritingStringNullableAttrEncodeXmlString2(L"name", m_oName);
|
||||
WritingStringNullableAttrBool2(L"showColHeaders", m_oShowColHeaders);
|
||||
WritingStringNullableAttrBool2(L"showColStripes", m_oShowColStripes);
|
||||
WritingStringNullableAttrBool2(L"showLastColumn", m_oShowLastColumn);
|
||||
WritingStringNullableAttrBool2(L"showRowHeaders", m_oShowRowHeaders);
|
||||
WritingStringNullableAttrBool2(L"showRowStripes", m_oShowRowStripes);
|
||||
writer.WriteString(L"/>");
|
||||
}
|
||||
void CPivotTableStyleInfo::ReadAttributes(XLS::BaseObjectPtr& obj)
|
||||
{
|
||||
@ -2179,21 +2179,25 @@ xmlns:xr16=\"http://schemas.microsoft.com/office/spreadsheetml/2017/revision16\"
|
||||
if( m_oReadPath.GetExtention() == _T(".bin"))
|
||||
{
|
||||
readBin(m_oReadPath);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
if (!oReader.FromFile(oPath.GetPath()))
|
||||
return;
|
||||
|
||||
if ( !oReader.FromFile( oPath.GetPath() ) )
|
||||
return;
|
||||
if (!oReader.ReadNextNode())
|
||||
return;
|
||||
|
||||
if ( !oReader.ReadNextNode() )
|
||||
return;
|
||||
|
||||
m_oPivotCashDefinition = oReader;
|
||||
m_oPivotCashDefinition = oReader;
|
||||
}
|
||||
}
|
||||
void CPivotCacheDefinitionFile::write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
|
||||
{
|
||||
if (bIsWritten) return;
|
||||
|
||||
bIsWritten = true;
|
||||
if(m_oPivotCashDefinition.IsInit())
|
||||
{
|
||||
NSStringUtils::CStringBuilder sXml;
|
||||
|
||||
@ -64,11 +64,124 @@ namespace OOX
|
||||
//<fileVersion>
|
||||
//<functionGroups>
|
||||
//<oleSize>
|
||||
//<pivotCaches>
|
||||
//<smartTagPr>
|
||||
//<smartTagTypes>
|
||||
//<webPublishing>
|
||||
//<webPublishObjects>
|
||||
class CWorkbookPivotCache : public WritingElement
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CWorkbookPivotCache)
|
||||
WritingElement_XlsbConstructors(CWorkbookPivotCache)
|
||||
CWorkbookPivotCache()
|
||||
{
|
||||
}
|
||||
virtual ~CWorkbookPivotCache()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
writer.WriteString(L"<pivotCache");
|
||||
WritingStringNullableAttrInt(L"cacheId", m_oCacheId, m_oCacheId->GetValue());
|
||||
WritingStringNullableAttrString(L"r:id", m_oRid, m_oRid->ToString());
|
||||
writer.WriteString(L"/>");
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
ReadAttributes(oReader);
|
||||
}
|
||||
void fromBin(XLS::BaseObjectPtr& obj) {}
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_x_WorkbookPivotCache;
|
||||
}
|
||||
void ReadAttributes(XLS::BaseObjectPtr& obj) {}
|
||||
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
WritingElement_ReadAttributes_Start(oReader)
|
||||
WritingElement_ReadAttributes_Read_if(oReader, _T("cacheId"), m_oCacheId)
|
||||
WritingElement_ReadAttributes_Read_else_if(oReader, _T("r:id"), m_oRid)
|
||||
WritingElement_ReadAttributes_End(oReader)
|
||||
|
||||
}
|
||||
//----------
|
||||
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCacheId;
|
||||
nullable<SimpleTypes::CRelationshipId> m_oRid;
|
||||
};
|
||||
|
||||
class CWorkbookPivotCaches : public WritingElementWithChilds<CWorkbookPivotCache>
|
||||
{
|
||||
public:
|
||||
WritingElement_AdditionConstructors(CWorkbookPivotCaches)
|
||||
WritingElement_XlsbVectorConstructors(CWorkbookPivotCaches)
|
||||
CWorkbookPivotCaches(OOX::Document *pMain = NULL) : WritingElementWithChilds<CWorkbookPivotCache>(pMain)
|
||||
{
|
||||
}
|
||||
virtual ~CWorkbookPivotCaches()
|
||||
{
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
}
|
||||
virtual std::wstring toXML() const
|
||||
{
|
||||
return L"";
|
||||
}
|
||||
virtual void toXML(NSStringUtils::CStringBuilder& writer) const
|
||||
{
|
||||
if (m_arrItems.empty()) return;
|
||||
|
||||
writer.WriteString(L"<pivotCaches>");
|
||||
|
||||
for (size_t i = 0; i < m_arrItems.size(); ++i)
|
||||
{
|
||||
if (m_arrItems[i])
|
||||
{
|
||||
m_arrItems[i]->toXML(writer);
|
||||
}
|
||||
}
|
||||
|
||||
writer.WriteString(L"</pivotCaches>");
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
|
||||
{
|
||||
if (oReader.IsEmptyNode())
|
||||
return;
|
||||
|
||||
int nCurDepth = oReader.GetDepth();
|
||||
while (oReader.ReadNextSiblingNode(nCurDepth))
|
||||
{
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
|
||||
if (L"pivotCaches" == sName)
|
||||
{
|
||||
CWorkbookPivotCache *pPivotCache = new CWorkbookPivotCache();
|
||||
m_arrItems.push_back(pPivotCache);
|
||||
|
||||
pPivotCache->fromXML(oReader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void fromBin(std::vector<XLS::BaseObjectPtr>& obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual EElementType getType() const
|
||||
{
|
||||
return et_x_WorkbookPivotCaches;
|
||||
}
|
||||
};
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
class CWorkbook : public OOX::File, public OOX::IFileContainer, public WritingElement
|
||||
{
|
||||
public:
|
||||
@ -150,35 +263,34 @@ namespace OOX
|
||||
virtual void read(const CPath& oRootPath, const CPath& oPath)
|
||||
{
|
||||
m_oReadPath = oPath;
|
||||
IFileContainer::Read( oRootPath, oPath );
|
||||
|
||||
if( m_oReadPath.GetExtention() == _T(".bin"))
|
||||
{
|
||||
readBin(m_oReadPath);
|
||||
IFileContainer::Read( oRootPath, oPath );
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
|
||||
IFileContainer::Read( oRootPath, oPath );
|
||||
if (!oReader.FromFile(oPath.GetPath()))
|
||||
return;
|
||||
|
||||
if (!oReader.ReadNextNode())
|
||||
return;
|
||||
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
if (L"workbook" == sName)
|
||||
{
|
||||
fromXML(oReader);
|
||||
}
|
||||
}
|
||||
|
||||
CXlsx* xlsx = dynamic_cast<CXlsx*>(File::m_pMainDocument);
|
||||
if ( (xlsx ) && (xlsx->m_pVbaProject) )
|
||||
{
|
||||
m_bMacroEnabled = true;
|
||||
}
|
||||
|
||||
XmlUtils::CXmlLiteReader oReader;
|
||||
|
||||
if ( !oReader.FromFile( oPath.GetPath() ) )
|
||||
return;
|
||||
|
||||
if ( !oReader.ReadNextNode() )
|
||||
return;
|
||||
|
||||
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
|
||||
if ( L"workbook" == sName )
|
||||
{
|
||||
fromXML(oReader);
|
||||
}
|
||||
}
|
||||
virtual void fromXML(XmlUtils::CXmlNode& node)
|
||||
{
|
||||
@ -206,8 +318,12 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">
|
||||
m_oDefinedNames->toXML(writer);
|
||||
if(m_oCalcPr.IsInit())
|
||||
m_oCalcPr->toXML(writer);
|
||||
|
||||
if(m_oPivotCachesXml.IsInit())
|
||||
writer.WriteString(m_oPivotCachesXml.get());
|
||||
else if (m_oPivotCaches.IsInit())
|
||||
m_oPivotCaches->toXML(writer);
|
||||
|
||||
if(m_oExtLst.IsInit())
|
||||
writer.WriteString(m_oExtLst->toXMLWithNS(L""));
|
||||
writer.WriteString(L"</workbook>");
|
||||
@ -235,6 +351,8 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">
|
||||
m_oWorkbookProtection = oReader;
|
||||
else if ( L"externalReferences" == sName )
|
||||
m_oExternalReferences = oReader;
|
||||
else if (L"pivotCaches" == sName)
|
||||
m_oPivotCaches = oReader;
|
||||
else if ( L"extLst" == sName )
|
||||
m_oExtLst = oReader;
|
||||
else if ( L"fileVersion" == sName )
|
||||
@ -346,10 +464,12 @@ xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\">
|
||||
nullable<OOX::Spreadsheet::CSheets> m_oSheets;
|
||||
nullable<OOX::Spreadsheet::CWorkbookPr> m_oWorkbookPr;
|
||||
nullable<OOX::Spreadsheet::CExternalReferences> m_oExternalReferences;
|
||||
nullable<std::wstring> m_oPivotCachesXml;
|
||||
nullable<OOX::Spreadsheet::CCalcPr> m_oCalcPr;
|
||||
nullable_string m_oAppName;
|
||||
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
|
||||
|
||||
nullable<OOX::Spreadsheet::CWorkbookPivotCaches>m_oPivotCaches;
|
||||
nullable<std::wstring> m_oPivotCachesXml;
|
||||
|
||||
CPersonList* m_pPersonList;
|
||||
bool m_bMacroEnabled;
|
||||
|
||||
@ -31,7 +31,6 @@
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "../Base/SmartPtr.h"
|
||||
#include "../DocxFormat/IFileContainer.h"
|
||||
|
||||
#include "../../../../DesktopEditor/common/Directory.h"
|
||||
|
||||
@ -232,6 +232,7 @@
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\XlsxSerializerCom\Writer\BinaryReader.cpp">
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/bigobj %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\XlsxSerializerCom\Writer\CSVWriter.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
|
||||
Reference in New Issue
Block a user