DocxFormat - pivot cache

This commit is contained in:
ElenaSubbotina
2019-09-30 16:40:19 +03:00
parent 0f25a738d5
commit 62c9490282
8 changed files with 2059 additions and 102 deletions

View File

@ -1249,6 +1249,27 @@ namespace OOX
et_x_PivotTableStyleInfo,
et_x_PivotTableFilters,
et_x_PivotTableFilter,
et_x_PivotCacheFields,
et_x_PivotCacheField,
et_x_SharedItems,
et_x_FieldGroupProperties,
et_x_DiscreteGroupingProperties,
et_x_RangeGroupingProperties,
et_x_OLAPGroupItems,
et_x_PivotCacheSource,
et_x_WorksheetSource,
et_x_ConsolidationSource,
et_x_PageItemValues,
et_x_PageItems,
et_x_PageItem,
et_x_RangeSets,
et_x_RangeSet,
et_x_PivotCharacterValue,
et_x_PivotBooleanValue,
et_x_PivotErrorValue,
et_x_PivotDateTimeValue,
et_x_PivotNoValue,
et_x_PivotNumericValue,
et_x_SparklineGroups,
et_x_SparklineGroup,

View File

@ -95,7 +95,6 @@ namespace ComplexTypes
SimpleTypes::COnOff<eDefValue> m_oVal;
};
class CSharedItemsIndex : public ComplexType
{
public:
@ -142,6 +141,51 @@ namespace ComplexTypes
nullable<SimpleTypes::CUnsignedDecimalNumber<> > m_oV;
};
class CMemberPropertyIndex : public ComplexType
{
public:
ComplexTypes_AdditionConstructors(CMemberPropertyIndex)
CMemberPropertyIndex()
{
}
virtual ~CMemberPropertyIndex()
{
}
virtual void FromXML(XmlUtils::CXmlNode& oNode)
{
XmlMacroReadAttributeBase( oNode, L"v", m_oV );
}
virtual void FromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes(oReader);
if ( !oReader.IsEmptyNode() )
oReader.ReadTillEnd();
}
virtual std::wstring ToString() const
{
std::wstring sResult;
if ( m_oV.IsInit() )
{
sResult += L"v=\"" + std::to_wstring(*m_oV) + L"\" ";
}
return sResult;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_ReadSingle( oReader, L"v", m_oV )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable_int m_oV;
};
class String : public ComplexType
{
public:

View File

@ -102,6 +102,8 @@ namespace OOX
return smart_ptr<OOX::File>(new CQueryTableFile( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::PivotTable )
return smart_ptr<OOX::File>(new CPivotTableFile( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::PivotCacheDefinition )
return smart_ptr<OOX::File>(new CPivotCacheDefinitionFile( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::Comments )
return smart_ptr<OOX::File>(new CComments( pMain, oRootPath, oFileName ));
else if ( oRelation.Type() == FileTypes::ThreadedComments )
@ -211,6 +213,8 @@ namespace OOX
return smart_ptr<OOX::File>(new CQueryTableFile( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::PivotTable )
return smart_ptr<OOX::File>(new CPivotTableFile( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == FileTypes::PivotCacheDefinition )
return smart_ptr<OOX::File>(new CPivotCacheDefinitionFile( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == OOX::FileTypes::VmlDrawing )
return smart_ptr<OOX::File>(new CVmlDrawing( pMain, oRootPath, oFileName ));
else if ( pRelation->Type() == OOX::FileTypes::ChartDrawing)

View File

@ -30,9 +30,6 @@
*
*/
#pragma once
#ifndef OOX_PIVOTCACHEDEFINITION_FILE_INCLUDE_H_
#define OOX_PIVOTCACHEDEFINITION_FILE_INCLUDE_H_
#include "../CommonInclude.h"
@ -40,103 +37,809 @@ namespace OOX
{
namespace Spreadsheet
{
class CPivotCacheDefinition : public OOX::File, public OOX::IFileContainer
class CSharedItems : public WritingElementWithChilds<WritingElement>
{
public:
CPivotCacheDefinition(OOX::Document* pMain) : OOX::File(pMain), OOX::IFileContainer(pMain)
WritingElement_AdditionConstructors(CSharedItems)
CSharedItems(){}
virtual ~CSharedItems() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_SharedItems;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_bool m_oContainsBlank;
nullable_bool m_oContainsDate;
nullable_bool m_oContainsInteger;
nullable_bool m_oContainsMixedTypes;
nullable_bool m_oContainsNonDate;
nullable_bool m_oContainsNumber;
nullable_bool m_oContainsSemiMixedTypes;
nullable_bool m_oContainsString;
nullable_bool m_oLongText;
nullable_double m_oMinValue;
nullable_double m_oMaxValue;
nullable<SimpleTypes::CDateTime> m_oMinDate;
nullable<SimpleTypes::CDateTime> m_oMaxDate;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class COLAPGroupItems : public WritingElementWithChilds<WritingElement>
{
public:
WritingElement_AdditionConstructors(COLAPGroupItems)
COLAPGroupItems(){}
virtual ~COLAPGroupItems() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_OLAPGroupItems;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class CDiscreteGroupingProperties : public WritingElementWithChilds<ComplexTypes::Spreadsheet::CSharedItemsIndex>
{
public:
WritingElement_AdditionConstructors(CDiscreteGroupingProperties)
CDiscreteGroupingProperties(){}
virtual ~CDiscreteGroupingProperties() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_DiscreteGroupingProperties;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class CRangeGroupingProperties : public WritingElement
{
public:
WritingElement_AdditionConstructors(CRangeGroupingProperties)
CRangeGroupingProperties(){}
virtual ~CRangeGroupingProperties() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_RangeGroupingProperties;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable<SimpleTypes::Spreadsheet::CValuesGroupBy<>> m_oGroupBy;
nullable_bool m_oAutoStart;
nullable_bool m_oAutoEnd;
nullable<SimpleTypes::CDateTime> m_oStartDate;
nullable<SimpleTypes::CDateTime> m_oEndDate;
nullable_double m_oStartNum;
nullable_double m_oEndNum;
nullable_double m_oGroupInterval;
};
class CFieldGroupProperties : public WritingElement
{
public:
WritingElement_AdditionConstructors(CFieldGroupProperties)
CFieldGroupProperties(){}
virtual ~CFieldGroupProperties() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_FieldGroupProperties;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oBase;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oPar;
nullable<CDiscreteGroupingProperties> m_oDiscretePr;
nullable<CRangeGroupingProperties> m_oRangePr;
nullable<COLAPGroupItems> m_oGroupItems;
};
class CPivotCacheField : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPivotCacheField)
CPivotCacheField(){}
virtual ~CPivotCacheField() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotCacheField;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_string m_oName;
nullable_string m_oCaption;
nullable_bool m_oDatabaseField;
nullable_bool m_oServerField;
nullable_string m_oFormula;
nullable_int m_oHierarchy;
nullable_bool m_oMemberPropertyField;
nullable_string m_oPropertyName;
nullable_int m_oSqlType;
nullable_bool m_oUniqueList;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oLevel;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMappingCount;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oNumFmtId;
nullable<CSharedItems> m_oSharedItems;
//nullable<CMemberPropertiesMap> m_oMpMap;
nullable<CFieldGroupProperties> m_oFieldGroup;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
};
class CPivotCacheFields : public WritingElementWithChilds<CPivotCacheField>
{
public:
WritingElement_AdditionConstructors(CPivotCacheFields)
CPivotCacheFields(){}
virtual ~CPivotCacheFields() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotCacheFields;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class CRangeSet : public WritingElement
{
public:
WritingElement_AdditionConstructors(CRangeSet)
CRangeSet(){}
virtual ~CRangeSet() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_RangeSet;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_string m_oSheet;
nullable_string m_oRef;
nullable_string m_oName;
nullable<SimpleTypes::CRelationshipId> m_oRid;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oI1;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oI2;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oI3;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oI4;
};
class CRangeSets : public WritingElementWithChilds<CRangeSet>
{
public:
WritingElement_AdditionConstructors(CRangeSets)
CRangeSets(){}
virtual ~CRangeSets() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_RangeSets;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class CPageItem : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPageItem)
CPageItem(){}
virtual ~CPageItem() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PageItem;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_string m_oName;
};
class CPageItems : public WritingElementWithChilds<CPageItem>
{
public:
WritingElement_AdditionConstructors(CPageItems)
CPageItems(){}
virtual ~CPageItems() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PageItems;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class CPageItemValues : public WritingElementWithChilds<CPageItems>
{
public:
WritingElement_AdditionConstructors(CPageItemValues)
CPageItemValues(){}
virtual ~CPageItemValues() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return _T("");
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PageItemValues;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class CConsolidationSource : public WritingElement
{
public:
WritingElement_AdditionConstructors(CConsolidationSource)
CConsolidationSource()
{
}
virtual ~CConsolidationSource()
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_ConsolidationSource;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
//----------
nullable_bool m_oAutoPage;
nullable<CPageItemValues> m_oPages;
nullable<CRangeSets> m_oRangeSets;
};
class CWorksheetSource : public WritingElement
{
public:
WritingElement_AdditionConstructors(CWorksheetSource)
CWorksheetSource(){}
virtual ~CWorksheetSource() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_WorksheetSource;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_string m_oSheet;
nullable_string m_oRef;
nullable_string m_oName;
nullable<SimpleTypes::CRelationshipId> m_oRid;
};
class CPivotCacheSource : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPivotCacheSource)
CPivotCacheSource()
{
}
virtual ~CPivotCacheSource()
{
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotCacheSource;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
//----------
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oConnectionId;
nullable<SimpleTypes::Spreadsheet::CSourceCacheType<>> m_oType;
nullable<CConsolidationSource> m_oConsolidation;
nullable<CWorksheetSource> m_oWorksheetSource;
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
};
class CPivotCacheDefinition : public WritingElement
{
public:
WritingElement_AdditionConstructors(CPivotCacheDefinition)
CPivotCacheDefinition()
{
m_bSpreadsheets = true;
bIsWritten = false;
m_pData = NULL;
m_nDataLength = 0;
}
CPivotCacheDefinition(OOX::Document* pMain, const CPath& oRootPath, const CPath& oPath) : OOX::File(pMain), OOX::IFileContainer(pMain)
{
m_bSpreadsheets = true;
bIsWritten = false;
m_pData = NULL;
m_nDataLength = 0;
read( oRootPath, oPath );
}
virtual ~CPivotCacheDefinition()
{
ClearItems();
}
public:
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotCacheDefinition;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
//----------
nullable_bool m_oBackgroundQuery;
nullable_bool m_oEnableRefresh;
nullable<SimpleTypes::CRelationshipId> m_oRid;
nullable_bool m_oInvalid;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCreatedVersion;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMinRefreshableVersion;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oMissingItemsLimit;
nullable_bool m_oOptimizeMemory;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oRecordCount;
nullable_string m_oRefreshedBy;
nullable<SimpleTypes::CDateTime> m_oRefreshedDateIso;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oRefreshedVersion;
nullable_bool m_oRefreshOnLoad;
nullable_bool m_oSaveData;
nullable_bool m_oSupportAdvancedDrill;
nullable_bool m_oSupportSubquery;
nullable_bool m_oTupleCache;
nullable_bool m_oUpgradeOnRefresh;
nullable<CPivotCacheFields> m_oCacheFields;
nullable<CPivotCacheSource> m_oCacheSource;
//calculatedItems (Calculated Items) §18.10.1.9
//calculatedMembers (Calculated Members) §18.10.1.11
//cacheHierarchies (PivotCache Hierarchies) §18.10.1.5
//dimensions (OLAP Dimensions) §18.10.1.25
//kpis (OLAP KPIs) §18.10.1.48
//maps (OLAP Measure Group) §18.10.1.52
//measureGroups (OLAP Measure Groups) §18.10.1.54
//tupleCache (Tuple Cache)
nullable<OOX::Drawing::COfficeArtExtensionList> m_oExtLst;
};
class CPivotCacheDefinitionFile : public OOX::FileGlobalEnumerated, public OOX::IFileContainer
{
public:
CPivotCacheDefinitionFile(OOX::Document* pMain) : OOX::FileGlobalEnumerated(pMain), OOX::IFileContainer(pMain)
{
m_bSpreadsheets = true;
m_pData = NULL;
m_nDataLength = 0;
bIsWritten = false;
}
CPivotCacheDefinitionFile(OOX::Document* pMain, const CPath& oRootPath, const CPath& oPath) : OOX::FileGlobalEnumerated(pMain), OOX::IFileContainer(pMain)
{
m_bSpreadsheets = true;
m_pData = NULL;
m_nDataLength = 0;
bIsWritten = false;
read( oRootPath, oPath );
}
virtual ~CPivotCacheDefinitionFile()
{
m_nDataLength = 0;
RELEASEARRAYOBJECTS(m_pData)
}
virtual void read(const CPath& oPath)
{
//don't use this. use read(const CPath& oRootPath, const CPath& oFilePath)
CPath oRootPath;
read(oRootPath, oPath);
}
virtual void read(const CPath& oRootPath, const CPath& oPath)
{
}
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const
void setData(BYTE* pData, long length, const std::wstring& srIdRecords)
{
if(srIdRecords.length() > 0)
{
const std::string srIdRecordsA( srIdRecords.begin(), srIdRecords.end() );
std::string rIdAttr = " r:id=\""+ srIdRecordsA +"\"";
m_nDataLength = length + (long)rIdAttr.length();
m_pData = new BYTE[m_nDataLength];
long nTreshold = 220;
memcpy(m_pData, pData, nTreshold);
memcpy(m_pData + nTreshold, rIdAttr.c_str(), rIdAttr.length());
memcpy(m_pData + nTreshold + rIdAttr.length(), pData + nTreshold, length - nTreshold);
}
else
{
m_nDataLength = length;
m_pData = new BYTE[m_nDataLength];
memcpy(m_pData, pData, length);
}
}
virtual void read(const CPath& oRootPath, const CPath& oPath);
virtual void write(const CPath& oPath, const CPath& oDirectory, CContentTypes& oContent) const;
virtual const OOX::FileType type() const
{
if(m_nDataLength > 0 && !bIsWritten)
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(oPath.GetPath());
oFile.WriteFile(m_pData, m_nDataLength);
oFile.CloseFile();
oContent.Registration( type().OverrideType(), oDirectory, oPath.GetFilename() );
IFileContainer::Write( oPath, oDirectory, oContent );
//prevent repeated write
bIsWritten = true;
}
return OOX::Spreadsheet::FileTypes::PivotCacheDefinition;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
virtual const OOX::FileType type() const
{
return OOX::Spreadsheet::FileTypes::PivotCacheDefinition;
}
virtual const CPath DefaultDirectory() const
{
return type().DefaultDirectory();
}
virtual const CPath DefaultFileName() const
{
return type().DefaultFileName();
}
const CPath& GetReadPath()
{
return m_oReadPath;
return m_oReadPath;
}
void setData(BYTE* pData, long length, const std::wstring& srIdRecords)
{
if(srIdRecords.length() > 0)
{
const std::string srIdRecordsA( srIdRecords.begin(), srIdRecords.end() );
std::string rIdAttr = " r:id=\""+ srIdRecordsA +"\"";
m_nDataLength = length + (long)rIdAttr.length();
m_pData = new BYTE[m_nDataLength];
long nTreshold = 220;
memcpy(m_pData, pData, nTreshold);
memcpy(m_pData + nTreshold, rIdAttr.c_str(), rIdAttr.length());
memcpy(m_pData + nTreshold + rIdAttr.length(), pData + nTreshold, length - nTreshold);
}
else
{
m_nDataLength = length;
m_pData = new BYTE[m_nDataLength];
memcpy(m_pData, pData, length);
}
}
nullable<CPivotCacheDefinition> m_oPivotCashDefinition;
private:
CPath m_oReadPath;
void ClearItems()
{
m_nDataLength = 0;
RELEASEARRAYOBJECTS(m_pData)
}
public:
mutable bool bIsWritten;
BYTE* m_pData;
BYTE *m_pData;
long m_nDataLength;
};
} //Spreadsheet
} // namespace OOX
#endif // OOX_PIVOTCACHEDEFINITION_FILE_INCLUDE_H_
mutable bool bIsWritten;
};
class CPivotCharacterValue : public WritingElementWithChilds<ComplexTypes::Spreadsheet::CMemberPropertyIndex>
{
public:
WritingElement_AdditionConstructors(CPivotCharacterValue)
CPivotCharacterValue(){}
virtual ~CPivotCharacterValue() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotCharacterValue;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_string m_oValue;
nullable_string m_oCaption;
nullable_bool m_oCalculated;
nullable_bool m_oUnused;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable_bool m_oBold;
nullable_bool m_oItalic;
nullable_bool m_oStrike;
nullable_bool m_oUnderline;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oBackColor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oForeColor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oFormatIndex;
//tpls
};
class CPivotBooleanValue : public WritingElementWithChilds<ComplexTypes::Spreadsheet::CMemberPropertyIndex>
{
public:
WritingElement_AdditionConstructors(CPivotBooleanValue)
CPivotBooleanValue(){}
virtual ~CPivotBooleanValue() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotBooleanValue;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_bool m_oValue;
nullable_string m_oCaption;
nullable_bool m_oCalculated;
nullable_bool m_oUnused;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class CPivotNumericValue : public WritingElementWithChilds<ComplexTypes::Spreadsheet::CMemberPropertyIndex>
{
public:
WritingElement_AdditionConstructors(CPivotNumericValue)
CPivotNumericValue(){}
virtual ~CPivotNumericValue() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotNumericValue;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_double m_oValue;
nullable_string m_oCaption;
nullable_bool m_oCalculated;
nullable_bool m_oUnused;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable_bool m_oBold;
nullable_bool m_oItalic;
nullable_bool m_oStrike;
nullable_bool m_oUnderline;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oBackColor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oForeColor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oFormatIndex;
//tpls
};
class CPivotDateTimeValue : public WritingElementWithChilds<ComplexTypes::Spreadsheet::CMemberPropertyIndex>
{
public:
WritingElement_AdditionConstructors(CPivotDateTimeValue)
CPivotDateTimeValue(){}
virtual ~CPivotDateTimeValue() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotBooleanValue;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable<SimpleTypes::CDateTime> m_oValue;
nullable_string m_oCaption;
nullable_bool m_oCalculated;
nullable_bool m_oUnused;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
class CPivotErrorValue : public WritingElementWithChilds<ComplexTypes::Spreadsheet::CMemberPropertyIndex>
{
public:
WritingElement_AdditionConstructors(CPivotErrorValue)
CPivotErrorValue(){}
virtual ~CPivotErrorValue() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotErrorValue;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_string m_oValue;
nullable_string m_oCaption;
nullable_bool m_oCalculated;
nullable_bool m_oUnused;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable_bool m_oBold;
nullable_bool m_oItalic;
nullable_bool m_oStrike;
nullable_bool m_oUnderline;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oBackColor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oForeColor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oFormatIndex;
//tpls
};
class CPivotNoValue : public WritingElementWithChilds<ComplexTypes::Spreadsheet::CMemberPropertyIndex>
{
public:
WritingElement_AdditionConstructors(CPivotNoValue)
CPivotNoValue(){}
virtual ~CPivotNoValue() {}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
{
return L"";
}
virtual void toXML(NSStringUtils::CStringBuilder& writer) const;
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader);
virtual EElementType getType () const
{
return et_x_PivotNoValue;
}
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader);
nullable_string m_oCaption;
nullable_bool m_oCalculated;
nullable_bool m_oUnused;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
nullable_bool m_oBold;
nullable_bool m_oItalic;
nullable_bool m_oStrike;
nullable_bool m_oUnderline;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oBackColor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oForeColor;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oFormatIndex;
//tpls
};
} //Spreadsheet
} // namespace OOX

File diff suppressed because it is too large Load Diff

View File

@ -3901,6 +3901,92 @@ namespace SimpleTypes
SimpleType_FromString (ETickMarksType)
SimpleType_Operator_Equal (CTickMarksType)
};
enum ESourceCacheType
{
typeSourceConsolidation = 0,
typeSourceExternal = 1,
typeSourceScenario = 2,
typeSourceWorksheet = 3,
};
template<ESourceCacheType eDefValue = typeSourceWorksheet>
class CSourceCacheType : public CSimpleType<ESourceCacheType, eDefValue>
{
public:
CSourceCacheType() {}
CSourceCacheType(const ESourceCacheType & val) { this->m_eValue = val; }
virtual ESourceCacheType FromString(std::wstring &sValue)
{
if ( _T("consolidation") == sValue ) this->m_eValue = typeSourceConsolidation;
else if ( _T("external") == sValue ) this->m_eValue = typeSourceExternal;
else if ( _T("scenario") == sValue ) this->m_eValue = typeSourceScenario;
else if ( _T("worksheet") == sValue ) this->m_eValue = typeSourceWorksheet;
return this->m_eValue;
}
virtual std::wstring ToString () const
{
switch(this->m_eValue)
{
case typeSourceConsolidation: return _T("consolidation");
case typeSourceExternal: return _T("external");
case typeSourceScenario: return _T("scenario");
case typeSourceWorksheet: return _T("worksheet");
default : return _T("worksheet");
}
}
SimpleType_FromString (ESourceCacheType)
SimpleType_Operator_Equal (CSourceCacheType)
};
enum EValuesGroupBy
{
groupByDays = 0,
groupByHours = 1,
groupByMinutes = 2,
groupByMonths = 3,
groupByQuarters = 4,
groupByNumericRanges = 5,
groupBySeconds = 6,
groupByYears = 7
};
template<EValuesGroupBy eDefValue = groupByMonths>
class CValuesGroupBy : public CSimpleType<EValuesGroupBy, eDefValue>
{
public:
CValuesGroupBy() {}
CValuesGroupBy(const EValuesGroupBy & val) { this->m_eValue = val; }
virtual EValuesGroupBy FromString(std::wstring &sValue)
{
if ( _T("days") == sValue ) this->m_eValue = groupByDays;
else if ( _T("hours") == sValue ) this->m_eValue = groupByHours;
else if ( _T("minutes") == sValue ) this->m_eValue = groupByMinutes;
else if ( _T("months") == sValue ) this->m_eValue = groupByMonths;
else if ( _T("quarters")== sValue ) this->m_eValue = groupByQuarters;
else if ( _T("range") == sValue ) this->m_eValue = groupByNumericRanges;
else if ( _T("seconds") == sValue ) this->m_eValue = groupBySeconds;
else if ( _T("years") == sValue ) this->m_eValue = groupByYears;
return this->m_eValue;
}
virtual std::wstring ToString () const
{
switch(this->m_eValue)
{
case groupByDays: return _T("days");
case groupByHours: return _T("hours");
case groupByMinutes: return _T("minutes");
case groupByMonths: return _T("months");
case groupByQuarters: return _T("quarters");
case groupByNumericRanges: return _T("range");
case groupBySeconds: return _T("seconds");
case groupByYears: return _T("years");
default : return _T("");
}
}
SimpleType_FromString (EValuesGroupBy)
SimpleType_Operator_Equal (CValuesGroupBy)
};
enum EPivotItemType
{
typeAverage = 0,

View File

@ -117,6 +117,9 @@ namespace Spreadsheet
#define WritingStringNullableAttrInt2(name, elem) \
WritingStringNullableAttrInt(name, elem, *elem)
#define WritingStringNullableAttrDouble2(name, elem) \
WritingStringNullableAttrDouble(name, elem, *elem)
#define WritingStringNullableAttrEncodeXmlString2(name, elem) \
WritingStringNullableAttrEncodeXmlString(name, elem, *elem)

View File

@ -2955,23 +2955,25 @@ int BinaryWorkbookTableReader::ReadPivotCaches(BYTE type, long length, void* poR
READ1_DEF(length, res, this->ReadPivotCache, &oPivotCachesTemp);
if(-1 != oPivotCachesTemp.nId && NULL != oPivotCachesTemp.pDefinitionData)
{
OOX::Spreadsheet::CPivotCacheDefinition* pDefinition = new OOX::Spreadsheet::CPivotCacheDefinition(NULL);
OOX::Spreadsheet::CPivotCacheDefinitionFile* pDefinitionFile = new OOX::Spreadsheet::CPivotCacheDefinitionFile(NULL);
std::wstring srIdRecords;
if(NULL != oPivotCachesTemp.pRecords)
{
NSCommon::smart_ptr<OOX::File> pFileRecords(oPivotCachesTemp.pRecords);
srIdRecords = pDefinition->Add(pFileRecords).ToString();
srIdRecords = pDefinitionFile->Add(pFileRecords).ToString();
}
pDefinition->setData(oPivotCachesTemp.pDefinitionData, oPivotCachesTemp.nDefinitionLength, srIdRecords);
NSCommon::smart_ptr<OOX::File> pFileDefinition(pDefinition);
OOX::RId rIdDefinition = m_oWorkbook.Add(pFileDefinition);
pDefinitionFile->setData(oPivotCachesTemp.pDefinitionData, oPivotCachesTemp.nDefinitionLength, srIdRecords);
NSCommon::smart_ptr<OOX::File> pFile(pDefinitionFile);
OOX::RId rIdDefinition = m_oWorkbook.Add(pFile);
m_oWorkbook.m_oPivotCachesXml->append(L"<pivotCache cacheId=\"");
m_oWorkbook.m_oPivotCachesXml->append(std::to_wstring(oPivotCachesTemp.nId));
m_oWorkbook.m_oPivotCachesXml->append(L"\" r:id=\"");
m_oWorkbook.m_oPivotCachesXml->append(rIdDefinition.ToString());
m_oWorkbook.m_oPivotCachesXml->append(L"\"/>");
m_mapPivotCacheDefinitions[oPivotCachesTemp.nId] = pFileDefinition;
m_mapPivotCacheDefinitions[oPivotCachesTemp.nId] = pFile;
}
else
{