[xlsb] add cellStyleXFs, cellXFs (records, fill objects)

This commit is contained in:
Vladimir Gorshenkov
2021-10-08 16:21:12 +03:00
parent 4547a18aab
commit f66053508b
21 changed files with 996 additions and 6 deletions

View File

@ -153,7 +153,7 @@ void XF::readFields(CFRecord& record)
border.icvBottom = (0 != border.dgBottom)? static_cast<unsigned char>(GETBITS(flags2, 25, 31)) : 0;
border.icvDiag = 0;
}
else
else if(global_info->Version < 0x0800)
{
_UINT32 flags1;
_UINT32 flags2;
@ -209,6 +209,35 @@ void XF::readFields(CFRecord& record)
fsxButton = GETBIT(flags4, 14);
}
}
else
{
record >> ixfParent >> ifmt >> font_index >> iFill >> ixBorder >> trot >> cIndent;
_UINT32 flags;
record >> flags;
alc = GETBITS(flags, 0, 2);
alcV = GETBITS(flags, 3, 5);
fWrap = GETBIT(flags, 6);
fJustLast = GETBIT(flags, 7);
fShrinkToFit = GETBIT(flags, 8);
fMergeCell = GETBIT(flags, 9);
iReadOrder = GETBITS(flags, 10, 11);
fLocked = GETBIT(flags, 12);
fHidden = GETBIT(flags, 13);
fsxButton = GETBIT(flags, 14);
f123Prefix = GETBIT(flags, 15);
xfGrbitAtr = GETBITS(flags, 16, 21);
fAtrNum = !GETBIT(xfGrbitAtr, 0);
fAtrFnt = !GETBIT(xfGrbitAtr, 1);
fAtrAlc = !GETBIT(xfGrbitAtr, 2);
fAtrBdr = !GETBIT(xfGrbitAtr, 3);
fAtrPat = !GETBIT(xfGrbitAtr, 4);
fAtrProt = !GETBIT(xfGrbitAtr, 5);
}
}
void XF::Update(ExtProp* ext_prop)
{

View File

@ -95,6 +95,12 @@ namespace XLS
bool fHasXFExt;
bool fsxButton;
//xlsb
_UINT16 iFill;
_UINT16 ixBorder;
bool fMergeCell;
unsigned char xfGrbitAtr;
//------------------------------------------------------------------
BiffStructurePtrVector ext_props;
BiffStructurePtrVector xf_props;

View File

@ -198,6 +198,10 @@ SOURCES += \
../Source/XlsbFormat/Biff12_records/BeginBorders.cpp \
../Source/XlsbFormat/Biff12_records/Border.cpp \
../Source/XlsbFormat/Biff12_records/EndBorders.cpp \
../Source/XlsbFormat/Biff12_records/BeginCellStyleXFs.cpp \
../Source/XlsbFormat/Biff12_records/EndCellStyleXFs.cpp \
../Source/XlsbFormat/Biff12_records/BeginCellXFs.cpp \
../Source/XlsbFormat/Biff12_records/EndCellXFs.cpp \
### Biff12_structures
../Source/XlsbFormat/Biff12_structures/LPByteBuf.cpp \
../Source/XlsbFormat/Biff12_structures/IsoPasswordData.cpp \
@ -267,6 +271,8 @@ SOURCES += \
../Source/XlsbFormat/Biff12_unions/FONTS.cpp \
../Source/XlsbFormat/Biff12_unions/FILLS.cpp \
../Source/XlsbFormat/Biff12_unions/BORDERS.cpp \
../Source/XlsbFormat/Biff12_unions/CELLSTYLEXFS.cpp \
../Source/XlsbFormat/Biff12_unions/CELLXFS.cpp \
}
@ -555,6 +561,10 @@ HEADERS += docxformatlib.h \
../Source/XlsbFormat/Biff12_records/BeginBorders.h \
../Source/XlsbFormat/Biff12_records/Border.h \
../Source/XlsbFormat/Biff12_records/EndBorders.h \
../Source/XlsbFormat/Biff12_records/BeginCellStyleXFs.h \
../Source/XlsbFormat/Biff12_records/EndCellStyleXFs.h \
../Source/XlsbFormat/Biff12_records/BeginCellXFs.h \
../Source/XlsbFormat/Biff12_records/EndCellXFs.h \
### Biff12_structures
../Source/XlsbFormat/Biff12_structures/XLWideString.h \
../Source/XlsbFormat/Biff12_structures/LPByteBuf.h \
@ -627,3 +637,5 @@ HEADERS += docxformatlib.h \
../Source/XlsbFormat/Biff12_unions/FONTS.h \
../Source/XlsbFormat/Biff12_unions/FILLS.h \
../Source/XlsbFormat/Biff12_unions/BORDERS.h \
../Source/XlsbFormat/Biff12_unions/CELLSTYLEXFS.h \
../Source/XlsbFormat/Biff12_unions/CELLXFS.h \

View File

@ -0,0 +1,57 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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 "BeginCellStyleXFs.h"
namespace XLSB
{
BeginCellStyleXFs::BeginCellStyleXFs()
{
}
BeginCellStyleXFs::~BeginCellStyleXFs()
{
}
BaseObjectPtr BeginCellStyleXFs::clone()
{
return BaseObjectPtr(new BeginCellStyleXFs(*this));
}
void BeginCellStyleXFs::readFields(CFRecord& record)
{
record >> cxfs;
}
} // namespace XLSB

View File

@ -0,0 +1,58 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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
*
*/
#pragma once
#include <Logic/Biff_records/BiffRecord.h>
#include "../../XlsxFormat/WritingElement.h"
using namespace XLS;
namespace XLSB
{
// Logical representation of BrtBeginCellStyleXFs record in BIFF12
class BeginCellStyleXFs: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(BeginCellStyleXFs)
BASE_OBJECT_DEFINE_CLASS_NAME(BeginCellStyleXFs)
public:
BeginCellStyleXFs();
virtual ~BeginCellStyleXFs();
BaseObjectPtr clone();
void readFields(CFRecord& record);
_UINT32 cxfs;
};
} // namespace XLSB

View File

@ -0,0 +1,57 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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 "BeginCellXFs.h"
namespace XLSB
{
BeginCellXFs::BeginCellXFs()
{
}
BeginCellXFs::~BeginCellXFs()
{
}
BaseObjectPtr BeginCellXFs::clone()
{
return BaseObjectPtr(new BeginCellXFs(*this));
}
void BeginCellXFs::readFields(CFRecord& record)
{
record >> cxfs;
}
} // namespace XLSB

View File

@ -0,0 +1,58 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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
*
*/
#pragma once
#include <Logic/Biff_records/BiffRecord.h>
#include "../../XlsxFormat/WritingElement.h"
using namespace XLS;
namespace XLSB
{
// Logical representation of BrtBeginCellXFs record in BIFF12
class BeginCellXFs: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(BeginCellXFs)
BASE_OBJECT_DEFINE_CLASS_NAME(BeginCellXFs)
public:
BeginCellXFs();
virtual ~BeginCellXFs();
BaseObjectPtr clone();
void readFields(CFRecord& record);
_UINT32 cxfs;
};
} // namespace XLSB

View File

@ -48,6 +48,7 @@
#include <Logic/Biff_records/Selection.h>
#include <Logic/Biff_records/SortData.h>
#include <Logic/Biff_records/Font.h>
#include <Logic/Biff_records/XF.h>
#include "../../XlsxFormat/WritingElement.h"
@ -229,5 +230,18 @@ namespace XLSB
}
};
class XF: public XLS::XF
{
BIFF_RECORD_DEFINE_TYPE_INFO(XF)
XF(size_t& cell_xf_current_id, size_t& style_xf_current_id) :
XLS::XF(cell_xf_current_id, style_xf_current_id) {}
BaseObjectPtr clone() override
{
return BaseObjectPtr(new XF(*this));
}
};
} // namespace XLSB

View File

@ -0,0 +1,57 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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 "EndCellStyleXFs.h"
namespace XLSB
{
EndCellStyleXFs::EndCellStyleXFs()
{
}
EndCellStyleXFs::~EndCellStyleXFs()
{
}
BaseObjectPtr EndCellStyleXFs::clone()
{
return BaseObjectPtr(new EndCellStyleXFs(*this));
}
void EndCellStyleXFs::readFields(CFRecord& record)
{
// No data in this record
}
} // namespace XLSB

View File

@ -0,0 +1,58 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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
*
*/
#pragma once
#include <Logic/Biff_records/BiffRecord.h>
#include "../../XlsxFormat/WritingElement.h"
using namespace XLS;
namespace XLSB
{
// Logical representation of BrtEndCellStyleXFs record in BIFF12
class EndCellStyleXFs: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(EndCellStyleXFs)
BASE_OBJECT_DEFINE_CLASS_NAME(EndCellStyleXFs)
public:
EndCellStyleXFs();
virtual ~EndCellStyleXFs();
BaseObjectPtr clone();
void readFields(CFRecord& record);
//static const ElementType type = typeEndCellStyleXFs;
};
} // namespace XLSB

View File

@ -0,0 +1,57 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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 "EndCellXFs.h"
namespace XLSB
{
EndCellXFs::EndCellXFs()
{
}
EndCellXFs::~EndCellXFs()
{
}
BaseObjectPtr EndCellXFs::clone()
{
return BaseObjectPtr(new EndCellXFs(*this));
}
void EndCellXFs::readFields(CFRecord& record)
{
// No data in this record
}
} // namespace XLSB

View File

@ -0,0 +1,58 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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
*
*/
#pragma once
#include <Logic/Biff_records/BiffRecord.h>
#include "../../XlsxFormat/WritingElement.h"
using namespace XLS;
namespace XLSB
{
// Logical representation of BrtEndCellXFs record in BIFF12
class EndCellXFs: public BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO(EndCellXFs)
BASE_OBJECT_DEFINE_CLASS_NAME(EndCellXFs)
public:
EndCellXFs();
virtual ~EndCellXFs();
BaseObjectPtr clone();
void readFields(CFRecord& record);
//static const ElementType type = typeEndCellXFs;
};
} // namespace XLSB

View File

@ -0,0 +1,88 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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 "CELLSTYLEXFS.h"
#include "../Biff12_records/CommonRecords.h"
#include "../Biff12_records/BeginCellStyleXFs.h"
#include "../Biff12_unions/FRT.h"
#include "../Biff12_records/EndCellStyleXFs.h"
namespace XLSB
{
CELLSTYLEXFS::CELLSTYLEXFS()
{
}
CELLSTYLEXFS::~CELLSTYLEXFS()
{
}
BaseObjectPtr CELLSTYLEXFS::clone()
{
return BaseObjectPtr(new CELLSTYLEXFS(*this));
}
//CELLSTYLEXFS = BrtBeginCellStyleXFs 1*65430(BrtXF *FRT) BrtEndCellStyleXFs
const bool CELLSTYLEXFS::loadContent(BinProcessor& proc)
{
if (proc.optional<BeginCellStyleXFs>())
{
m_BrtBeginCellStyleXFs = elements_.back();
elements_.pop_back();
}
size_t cell_xf_current_id = 0, style_xf_current_id = 0;
XF xf(cell_xf_current_id, style_xf_current_id);
while (proc.optional(xf))
{
m_arBrtXF.push_back(elements_.back());
elements_.pop_back();
while (proc.optional<FRT>())
{
m_arFRT.push_back(elements_.back());
elements_.pop_back();
}
}
if (proc.optional<EndCellStyleXFs>())
{
m_BrtEndCellStyleXFs = elements_.back();
elements_.pop_back();
}
return m_BrtBeginCellStyleXFs && !m_arBrtXF.empty() && m_BrtEndCellStyleXFs;
}
} // namespace XLSB

View File

@ -0,0 +1,60 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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
*
*/
#pragma once
#include <Logic/CompositeObject.h>
using namespace XLS;
namespace XLSB
{
class CELLSTYLEXFS: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(BORDERS)
public:
CELLSTYLEXFS();
virtual ~CELLSTYLEXFS();
BaseObjectPtr clone();
virtual const bool loadContent(BinProcessor& proc);
BaseObjectPtr m_BrtBeginCellStyleXFs;
std::vector<BaseObjectPtr> m_arBrtXF;
std::vector<BaseObjectPtr> m_arFRT;
BaseObjectPtr m_BrtEndCellStyleXFs;
};
} // namespace XLSB

View File

@ -0,0 +1,88 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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 "CELLXFS.h"
#include "../Biff12_records/CommonRecords.h"
#include "../Biff12_records/BeginCellXFs.h"
#include "../Biff12_unions/FRT.h"
#include "../Biff12_records/EndCellXFs.h"
namespace XLSB
{
CELLXFS::CELLXFS()
{
}
CELLXFS::~CELLXFS()
{
}
BaseObjectPtr CELLXFS::clone()
{
return BaseObjectPtr(new CELLXFS(*this));
}
//CELLXFS = BrtBeginCellXFs 1*65430(BrtXF *FRT) BrtEndCellXFs
const bool CELLXFS::loadContent(BinProcessor& proc)
{
if (proc.optional<BeginCellXFs>())
{
m_BrtBeginCellXFs = elements_.back();
elements_.pop_back();
}
size_t cell_xf_current_id = 0, style_xf_current_id = 0;
XF xf(cell_xf_current_id, style_xf_current_id);
while (proc.optional(xf))
{
m_arBrtXF.push_back(elements_.back());
elements_.pop_back();
while (proc.optional<FRT>())
{
m_arFRT.push_back(elements_.back());
elements_.pop_back();
}
}
if (proc.optional<EndCellXFs>())
{
m_BrtEndCellXFs = elements_.back();
elements_.pop_back();
}
return m_BrtBeginCellXFs && !m_arBrtXF.empty() && m_BrtEndCellXFs;
}
} // namespace XLSB

View File

@ -0,0 +1,60 @@
/*
* (c) Copyright Ascensio System SIA 2010-2021
*
* 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-12 Ernesta Birznieka-Upisha
* 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
*
*/
#pragma once
#include <Logic/CompositeObject.h>
using namespace XLS;
namespace XLSB
{
class CELLXFS: public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(BORDERS)
public:
CELLXFS();
virtual ~CELLXFS();
BaseObjectPtr clone();
virtual const bool loadContent(BinProcessor& proc);
BaseObjectPtr m_BrtBeginCellXFs;
std::vector<BaseObjectPtr> m_arBrtXF;
std::vector<BaseObjectPtr> m_arFRT;
BaseObjectPtr m_BrtEndCellXFs;
};
} // namespace XLSB

View File

@ -39,6 +39,8 @@
#include "Biff12_unions/FONTS.h"
#include "Biff12_unions/FILLS.h"
#include "Biff12_unions/BORDERS.h"
#include "Biff12_unions/CELLSTYLEXFS.h"
#include "Biff12_unions/CELLXFS.h"
namespace XLSB
{
@ -150,6 +152,24 @@ const bool StylesStream::loadContent(BinProcessor& proc)
}
}break;
case rt_BeginCellStyleXFs:
{
if (proc.optional<CELLSTYLEXFS>())
{
m_CELLSTYLEXFS = elements_.back();
elements_.pop_back();
}
}break;
case rt_BeginCellXFs:
{
if (proc.optional<CELLXFS>())
{
m_CELLXFS = elements_.back();
elements_.pop_back();
}
}break;
default://skip
{
proc.SkipRecord();

View File

@ -69,6 +69,8 @@ namespace XLSB
BaseObjectPtr m_FONTS;
BaseObjectPtr m_FILLS;
BaseObjectPtr m_BORDERS;
BaseObjectPtr m_CELLSTYLEXFS;
BaseObjectPtr m_CELLXFS;
unsigned short code_page_;
GlobalWorkbookInfoPtr global_info_;

View File

@ -55,6 +55,8 @@
#include "../../XlsbFormat/Biff12_unions/FONTS.h"
#include "../../XlsbFormat/Biff12_unions/FILLS.h"
#include "../../XlsbFormat/Biff12_unions/BORDERS.h"
#include "../../XlsbFormat/Biff12_unions/CELLSTYLEXFS.h"
#include "../../XlsbFormat/Biff12_unions/CELLXFS.h"
namespace OOX
{
@ -214,6 +216,11 @@ namespace OOX
if (stylesStream->m_BORDERS != nullptr)
m_oBorders = static_cast<XLSB::BORDERS*>(stylesStream->m_BORDERS.get())->m_arBrtBorder;
if (stylesStream->m_CELLSTYLEXFS != nullptr)
m_oCellStyleXfs = static_cast<XLSB::CELLSTYLEXFS*>(stylesStream->m_CELLSTYLEXFS.get())->m_arBrtXF;
if (stylesStream->m_CELLXFS != nullptr)
m_oCellXfs = static_cast<XLSB::CELLXFS*>(stylesStream->m_CELLSTYLEXFS.get())->m_arBrtXF;
}
}

View File

@ -32,6 +32,7 @@
#pragma once
#include "../CommonInclude.h"
#include "../../XlsbFormat/Biff12_records/CommonRecords.h"
namespace OOX
{
@ -41,6 +42,7 @@ namespace OOX
{
public:
WritingElement_AdditionConstructors(CAligment)
WritingElement_XlsbConstructors(CAligment)
CAligment()
{
}
@ -82,6 +84,11 @@ namespace OOX
oReader.ReadTillEnd();
}
void fromBin(XLS::BaseObjectPtr& obj)
{
ReadAttributes(obj);
}
virtual EElementType getType () const
{
return et_x_Aligment;
@ -131,6 +138,60 @@ namespace OOX
m_oTextRotation = (unsigned int)(90 - *rotate);
}
}
void ReadAttributes(XLS::BaseObjectPtr& obj)
{
auto ptrBiff = dynamic_cast<XLS::BiffRecord*>(obj.get());
if(ptrBiff->getTypeId() == XLSB::rt_XF)
{
auto ptr = static_cast<XLS::XF*>(obj.get());
if(ptr != nullptr)
{
m_oIndent = ptr->cIndent;
m_oJustifyLastLine = ptr->fJustLast;
m_oReadingOrder = ptr->iReadOrder;
m_oRelativeIndent = ptr->iReadOrder;
m_oShrinkToFit = ptr->fShrinkToFit;
m_oTextRotation = ptr->trot;
m_oWrapText = ptr->fWrap;
switch(ptr->alc)
{
case 0:
m_oHorizontal = SimpleTypes::Spreadsheet::EHorizontalAlignment::horizontalalignmentGeneral; break;
case 1:
m_oHorizontal = SimpleTypes::Spreadsheet::EHorizontalAlignment::horizontalalignmentLeft; break;
case 2:
m_oHorizontal = SimpleTypes::Spreadsheet::EHorizontalAlignment::horizontalalignmentCenter; break;
case 3:
m_oHorizontal = SimpleTypes::Spreadsheet::EHorizontalAlignment::horizontalalignmentRight; break;
case 4:
m_oHorizontal = SimpleTypes::Spreadsheet::EHorizontalAlignment::horizontalalignmentFill; break;
case 5:
m_oHorizontal = SimpleTypes::Spreadsheet::EHorizontalAlignment::horizontalalignmentJustify; break;
case 6:
m_oHorizontal = SimpleTypes::Spreadsheet::EHorizontalAlignment::horizontalalignmentCenterContinuous; break;
case 7:
m_oHorizontal = SimpleTypes::Spreadsheet::EHorizontalAlignment::horizontalalignmentDistributed; break;
}
switch(ptr->alcV)
{
case 0:
m_oVertical = SimpleTypes::Spreadsheet::EVerticalAlignment::verticalalignmentTop; break;
case 1:
m_oVertical = SimpleTypes::Spreadsheet::EVerticalAlignment::verticalalignmentCenter; break;
case 2:
m_oVertical = SimpleTypes::Spreadsheet::EVerticalAlignment::verticalalignmentBottom; break;
case 3:
m_oVertical = SimpleTypes::Spreadsheet::EVerticalAlignment::verticalalignmentJustify; break;
case 4:
m_oVertical = SimpleTypes::Spreadsheet::EVerticalAlignment::verticalalignmentDistributed; break;
}
}
}
}
public:
nullable<SimpleTypes::Spreadsheet::CHorizontalAlignment<>> m_oHorizontal;
nullable_uint m_oIndent;
@ -146,6 +207,7 @@ namespace OOX
{
public:
WritingElement_AdditionConstructors(CProtection)
WritingElement_XlsbConstructors(CProtection)
CProtection()
{
}
@ -178,6 +240,11 @@ namespace OOX
oReader.ReadTillEnd();
}
void fromBin(XLS::BaseObjectPtr& obj)
{
ReadAttributes(obj);
}
virtual EElementType getType () const
{
return et_x_Protection;
@ -190,6 +257,17 @@ namespace OOX
WritingElement_ReadAttributes_Read_else_if ( oReader, _T("locked"), m_oLocked )
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes(XLS::BaseObjectPtr& obj)
{
auto ptr = static_cast<XLSB::XF*>(obj.get());
if(ptr != nullptr)
{
m_oHidden = ptr->fHidden;
m_oLocked = ptr->fLocked;
}
}
public:
nullable<SimpleTypes::COnOff<>> m_oHidden;
nullable<SimpleTypes::COnOff<>> m_oLocked;
@ -200,6 +278,7 @@ namespace OOX
{
public:
WritingElement_AdditionConstructors(CXfs)
WritingElement_XlsbConstructors(CXfs)
CXfs()
{
}
@ -264,6 +343,14 @@ namespace OOX
return et_x_Xfs;
}
void fromBin(XLS::BaseObjectPtr& obj)
{
ReadAttributes(obj);
m_oAligment = obj;
m_oProtection = obj;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
@ -283,6 +370,31 @@ namespace OOX
WritingElement_ReadAttributes_Read_if ( oReader, _T("xfId"), m_oXfId )
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes(XLS::BaseObjectPtr& obj)
{
auto ptr = static_cast<XLSB::XF*>(obj.get());
if(ptr != nullptr)
{
m_oBorderId = ptr->ixBorder;
m_oFillId = ptr->iFill;
m_oFontId = ptr->font_index;
m_oNumFmtId = ptr->ifmt;
m_oPivotButton = ptr->fsxButton;
m_oQuotePrefix = ptr->f123Prefix;
if(ptr->ixfParent != 0xFFFF)
m_oXfId = ptr->ixfParent;
m_oApplyAlignment = ptr->fAtrAlc;
m_oApplyBorder = ptr->fAtrBdr;
m_oApplyFill = ptr->fAtrPat;
m_oApplyFont = ptr->fAtrFnt;
m_oApplyNumberFormat = ptr->fAtrNum;
m_oApplyProtection = ptr->fAtrProt;
}
}
public:
nullable<SimpleTypes::COnOff<>> m_oApplyAlignment;
nullable<SimpleTypes::COnOff<>> m_oApplyBorder;
@ -308,6 +420,7 @@ namespace OOX
{
public:
WritingElement_AdditionConstructors(CCellXfs)
WritingElement_XlsbVectorConstructors(CCellXfs)
CCellXfs()
{
}
@ -353,6 +466,17 @@ namespace OOX
}
}
void fromBin(std::vector<XLS::BaseObjectPtr>& obj)
{
ReadAttributes(obj);
for(auto &xfs : obj)
{
CXfs *pXfs = new CXfs(xfs);
m_arrItems.push_back(pXfs);
}
}
virtual EElementType getType () const
{
return et_x_CellXfs;
@ -368,6 +492,10 @@ namespace OOX
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes(std::vector<XLS::BaseObjectPtr>& obj)
{
m_oCount = (_UINT32)obj.size();
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};
@ -375,6 +503,7 @@ namespace OOX
{
public:
WritingElement_AdditionConstructors(CCellStyleXfs)
WritingElement_XlsbVectorConstructors(CCellStyleXfs)
CCellStyleXfs()
{
}
@ -426,6 +555,17 @@ namespace OOX
return et_x_CellStyleXfs;
}
void fromBin(std::vector<XLS::BaseObjectPtr>& obj)
{
ReadAttributes(obj);
for(auto &xfs : obj)
{
CXfs *pXfs = new CXfs(xfs);
m_arrItems.push_back(pXfs);
}
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
@ -433,6 +573,10 @@ namespace OOX
WritingElement_ReadAttributes_Read_if ( oReader, _T("count"), m_oCount )
WritingElement_ReadAttributes_End( oReader )
}
void ReadAttributes(std::vector<XLS::BaseObjectPtr>& obj)
{
m_oCount = (_UINT32)obj.size();
}
public:
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oCount;
};

View File

@ -228,7 +228,7 @@ namespace XLSB
rt_Fmt = 44,
rt_Fill = 45,
rt_Border = 46,
rt_Xf = 47,
rt_XF = 47,
rt_Style = 48,
rt_CellMeta = 49,
rt_ValueMeta = 50,
@ -715,13 +715,13 @@ namespace XLSB
rt_EndBorders = 614,
rt_BeginFmts = 615,
rt_EndFmts = 616,
rt_BeginCellXfs = 617,
rt_EndCellXfs = 618,
rt_BeginCellXFs = 617,
rt_EndCellXFs = 618,
rt_BeginStyles = 619,
rt_EndStyles = 620,
rt_BigName = 625,
rt_BeginCellStyleXfs = 626,
rt_EndCellStyleXfs = 627,
rt_BeginCellStyleXFs = 626,
rt_EndCellStyleXFs = 627,
rt_BeginComments = 628,
rt_EndComments = 629,
rt_BeginCommentAuthors = 630,