340 lines
9.6 KiB
C++
340 lines
9.6 KiB
C++
/*
|
|
* (c) Copyright Ascensio System SIA 2010-2023
|
|
*
|
|
* 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 20A-6 Ernesta Birznieka-Upish
|
|
* street, Riga, Latvia, EU, LV-1050.
|
|
*
|
|
* 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
|
|
*
|
|
*/
|
|
|
|
#include "PivotTableStream.h"
|
|
|
|
#include "Biff12_records/CommonRecords.h"
|
|
#include "Biff12_unions/ACUID.h"
|
|
#include "Biff12_records/BeginSXView.h"
|
|
#include "Biff12_unions/SXLOCATION.h"
|
|
#include "Biff12_unions/SXVDS.h"
|
|
#include "Biff12_unions/ISXVDRWS.h"
|
|
#include "Biff12_unions/SXLIRWS.h"
|
|
#include "Biff12_unions/ISXVDCOLS.h"
|
|
#include "Biff12_unions/SXLICOLS.h"
|
|
#include "Biff12_unions/SXPIS.h"
|
|
#include "Biff12_unions/SXDIS.h"
|
|
#include "Biff12_unions/SXFORMATS.h"
|
|
#include "Biff12_unions/SXCONDFMTS.h"
|
|
#include "Biff12_unions/SXCRTFORMATS.h"
|
|
#include "Biff12_unions/SXTHS.h"
|
|
#include "Biff12_records/TableStyleClient.h"
|
|
#include "Biff12_unions/SXFILTERS.h"
|
|
#include "Biff12_unions/ISXTHRWS.h"
|
|
#include "Biff12_unions/ISXTHCOLS.h"
|
|
#include "Biff12_unions/FRTSXVIEW.h"
|
|
#include "Biff12_records/EndSXView.h"
|
|
|
|
using namespace XLS;
|
|
|
|
namespace XLSB
|
|
{;
|
|
|
|
PivotTableStream::PivotTableStream()
|
|
{
|
|
}
|
|
|
|
PivotTableStream::~PivotTableStream()
|
|
{
|
|
}
|
|
|
|
|
|
BaseObjectPtr PivotTableStream::clone()
|
|
{
|
|
return BaseObjectPtr(new PivotTableStream(*this));
|
|
}
|
|
|
|
const bool PivotTableStream::loadContent(BinProcessor& proc)
|
|
{
|
|
while (true)
|
|
{
|
|
CFRecordType::TypeId type = proc.getNextRecordType();
|
|
|
|
if (type == rt_NONE) break;
|
|
|
|
switch(type)
|
|
{
|
|
case rt_ACBegin:
|
|
{
|
|
if (proc.optional<ACUID>())
|
|
{
|
|
//m_ACUID = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXView:
|
|
{
|
|
if (proc.optional<BeginSXView>())
|
|
{
|
|
m_BrtBeginSXView = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
|
|
case rt_BeginSXLocation:
|
|
{
|
|
if (proc.optional<SXLOCATION>())
|
|
{
|
|
m_SXLOCATION = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXVDs:
|
|
{
|
|
if (proc.optional<SXVDS>())
|
|
{
|
|
m_SXVDS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginISXVDRws:
|
|
{
|
|
if (proc.optional<ISXVDRWS>())
|
|
{
|
|
m_ISXVDRWS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXLIRws:
|
|
{
|
|
if (proc.optional<SXLIRWS>())
|
|
{
|
|
m_SXLIRWS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginISXVDCols:
|
|
{
|
|
if (proc.optional<ISXVDCOLS>())
|
|
{
|
|
m_ISXVDCOLS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXLICols:
|
|
{
|
|
if (proc.optional<SXLICOLS>())
|
|
{
|
|
m_SXLICOLS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXPIs:
|
|
{
|
|
if (proc.optional<SXPIS>())
|
|
{
|
|
m_SXPIS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXDIs:
|
|
{
|
|
if (proc.optional<SXDIS>())
|
|
{
|
|
m_SXDIS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXFormats:
|
|
{
|
|
if (proc.optional<SXFORMATS>())
|
|
{
|
|
m_SXFORMATS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXCondFmts:
|
|
{
|
|
if (proc.optional<SXCONDFMTS>())
|
|
{
|
|
m_SXCONDFMTS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXCrtFormats:
|
|
{
|
|
if (proc.optional<SXCRTFORMATS>())
|
|
{
|
|
m_SXCRTFORMATS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXTHs:
|
|
{
|
|
if (proc.optional<SXTHS>())
|
|
{
|
|
m_SXTHS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_TableStyleClient:
|
|
{
|
|
if (proc.optional<TableStyleClient>())
|
|
{
|
|
m_BrtTableStyleClient = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginSXFilters:
|
|
{
|
|
if (proc.optional<SXFILTERS>())
|
|
{
|
|
m_SXFILTERS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginISXTHRws:
|
|
{
|
|
if (proc.optional<ISXTHRWS>())
|
|
{
|
|
m_ISXTHRWS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_BeginISXTHCols:
|
|
{
|
|
if (proc.optional<ISXTHCOLS>())
|
|
{
|
|
m_ISXTHCOLS = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_FRTBegin:
|
|
{
|
|
if (proc.optional<FRTSXVIEW>())
|
|
{
|
|
m_FRTSXVIEW = elements_.back();
|
|
elements_.pop_back();
|
|
}
|
|
}break;
|
|
|
|
case rt_EndSXView:
|
|
{
|
|
if (proc.optional<EndSXView>())
|
|
{
|
|
m_bBrtEndSXView = true;
|
|
elements_.pop_back();
|
|
}
|
|
else
|
|
m_bBrtEndSXView = false;
|
|
}break;
|
|
|
|
default://skip
|
|
{
|
|
proc.SkipRecord();
|
|
}break;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
const bool PivotTableStream::saveContent(XLS::BinProcessor & proc)
|
|
{
|
|
if (m_BrtBeginSXView != nullptr)
|
|
proc.mandatory(*m_BrtBeginSXView);
|
|
|
|
if(m_SXLOCATION != nullptr)
|
|
proc.mandatory(*m_SXLOCATION);
|
|
|
|
if(m_SXVDS != nullptr)
|
|
proc.mandatory(*m_SXVDS);
|
|
|
|
if(m_ISXVDRWS != nullptr)
|
|
proc.mandatory(*m_ISXVDRWS);
|
|
|
|
if(m_SXLIRWS != nullptr)
|
|
proc.mandatory(*m_SXLIRWS);
|
|
|
|
if(m_ISXVDCOLS != nullptr)
|
|
proc.mandatory(*m_ISXVDCOLS);
|
|
|
|
if(m_SXLICOLS != nullptr)
|
|
proc.mandatory(*m_SXLICOLS);
|
|
|
|
if(m_SXPIS != nullptr)
|
|
proc.mandatory(*m_SXPIS);
|
|
|
|
if(m_SXDIS != nullptr)
|
|
proc.mandatory(*m_SXDIS);
|
|
|
|
if(m_SXFORMATS != nullptr)
|
|
proc.mandatory(*m_SXFORMATS);
|
|
|
|
if(m_SXCONDFMTS != nullptr)
|
|
proc.mandatory(*m_SXCONDFMTS);
|
|
|
|
if(m_SXCRTFORMATS != nullptr)
|
|
proc.mandatory(*m_SXCRTFORMATS);
|
|
|
|
if(m_SXTHS != nullptr)
|
|
proc.mandatory(*m_SXTHS);
|
|
|
|
if (m_BrtTableStyleClient != nullptr)
|
|
proc.mandatory(*m_BrtTableStyleClient);
|
|
|
|
if(m_SXFILTERS != nullptr)
|
|
proc.mandatory(*m_SXFILTERS);
|
|
|
|
if(m_ISXTHRWS != nullptr)
|
|
proc.mandatory(*m_ISXTHRWS);
|
|
|
|
if(m_ISXTHCOLS != nullptr)
|
|
proc.mandatory(*m_ISXTHCOLS);
|
|
|
|
if (m_FRTSXVIEW != nullptr)
|
|
proc.mandatory(*m_FRTSXVIEW);
|
|
proc.mandatory<EndSXView>();
|
|
|
|
return true;
|
|
}
|
|
|
|
} // namespace XLSB
|