Commit dcec7447 authored by ElenaSubbotina's avatar ElenaSubbotina

XlsFormat - apply theme style from format office 2010 and later

parent 5f12552f
...@@ -138,30 +138,13 @@ int Font::serialize_rPr(std::wostream & stream, bool rtl, bool defRPr, std::wstr ...@@ -138,30 +138,13 @@ int Font::serialize_rPr(std::wostream & stream, bool rtl, bool defRPr, std::wstr
} }
else else
CP_XML_ATTR(L"i", false); CP_XML_ATTR(L"i", false);
//if (bCharSet.value())
//{ switch(sss)
// CP_XML_NODE(L"charset") {
// { case 1: CP_XML_ATTR(L"cap", L"all");break;
// CP_XML_ATTR(L"val", bCharSet); case 2: CP_XML_ATTR(L"cap", L"small");break;
// } }
//}
//if ((fCondense.value()) && (*fCondense.value()))
//{
// CP_XML_NODE(L"condense")
// {
// CP_XML_ATTR(L"val", (int)(*fCondense.value()));
// }
//}
//if ((fExtend.value()) && (fExtend))
// {
// CP_XML_NODE(L"extend")
// {
// CP_XML_ATTR(L"val", fExtend);
// }
// }
if ( (icv < 0x7fff) || color_ext.enabled ) if ( (icv < 0x7fff) || color_ext.enabled )
{ {
if (color_ext.enabled ) if (color_ext.enabled )
...@@ -236,66 +219,7 @@ int Font::serialize_rPr(std::wostream & stream, bool rtl, bool defRPr, std::wstr ...@@ -236,66 +219,7 @@ int Font::serialize_rPr(std::wostream & stream, bool rtl, bool defRPr, std::wstr
{ {
CP_XML_NODE(namespace_ + L"rtl"); CP_XML_NODE(namespace_ + L"rtl");
} }
//if ((fOutline.value()) && (fOutline))
// {
// CP_XML_NODE(L"outline")
// {
// CP_XML_ATTR(L"val", fOutline);
// }
// }
//if (font.scheme)
//{
// CP_XML_NODE(L"scheme")
// {
// CP_XML_ATTR(L"val", *font.scheme);
// }
//}
//if ((fShadow.value()) && (fShadow))
// {
// CP_XML_NODE(L"shadow")
// {
// CP_XML_ATTR(L"val", fShadow);
// }
// }
//if ((fStrikeOut.value()) && (fStrikeOut))
//{
// CP_XML_NODE(L"strike")
// {
// CP_XML_ATTR(L"val", fStrikeOut);
// }
//}
// if ((uls.value()) && (*uls.value() > 0))
// {
// CP_XML_NODE(L"u")
// {
//switch(uls)
//{
// case 1: CP_XML_ATTR(L"val", "single");break;
// case 2: CP_XML_ATTR(L"val", "double");break;
// case 33: CP_XML_ATTR(L"val", "singleAccounting");break;
// case 34: CP_XML_ATTR(L"val", "doubleAccounting");break;
//}
// }
// }
// if ((sss.value()) && (*sss.value() > 0))
// {
// CP_XML_NODE(L"vertAlign")
// {
//switch(*sss.value())
//{
// case 1: CP_XML_ATTR(L"val", L"superscript");break;
// case 2: CP_XML_ATTR(L"val", L"subscript");break;
//}
//
// }
// }
} }
} }
return 0; return 0;
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include "TxO.h" #include "TxO.h"
#include <Logic/Biff_records/Font.h> #include "Font.h"
#include <utils.h> #include <utils.h>
......
...@@ -35,11 +35,10 @@ ...@@ -35,11 +35,10 @@
namespace XLS namespace XLS
{ {
XF::XF(size_t& cell_xf_current_id, size_t& style_xf_current_id) XF::XF(size_t& cell_xf_current_id, size_t& style_xf_current_id) : cell (cell_xf_current_id, style_xf_current_id),
: cell(cell_xf_current_id, style_xf_current_id), style(cell_xf_current_id, style_xf_current_id)
style(cell_xf_current_id, style_xf_current_id),
ixfParent(0)
{ {
ixfParent = 0;
} }
......
...@@ -32,15 +32,12 @@ ...@@ -32,15 +32,12 @@
#pragma once #pragma once
#include "BiffRecord.h" #include "BiffRecord.h"
#include <Logic/Biff_structures/FontIndex.h> #include "../Biff_structures/FontIndex.h"
#include <Logic/Biff_structures/CellXF.h> #include "../Biff_structures/CellXF.h"
#include <Logic/Biff_structures/StyleXF.h> #include "../Biff_structures/StyleXF.h"
namespace XLS namespace XLS
{ {
// Logical representation of XF record in BIFF8
class XF: public BiffRecord class XF: public BiffRecord
{ {
BIFF_RECORD_DEFINE_TYPE_INFO(XF) BIFF_RECORD_DEFINE_TYPE_INFO(XF)
......
...@@ -38,13 +38,12 @@ namespace XLS ...@@ -38,13 +38,12 @@ namespace XLS
struct FillInfoExt struct FillInfoExt
{ {
FillInfoExt() {enabled = false; xclrType = icv = 0; nTintShade = 0; xclrValue = 0;} bool enabled =false;
bool enabled;
unsigned char xclrType; unsigned char xclrType = 0;
unsigned char icv; unsigned char icv = 0;
short nTintShade; short nTintShade = 0;
unsigned int xclrValue; unsigned int xclrValue = 0;
}; };
struct FillInfo struct FillInfo
...@@ -56,9 +55,9 @@ struct FillInfo ...@@ -56,9 +55,9 @@ struct FillInfo
{ {
} }
unsigned char fls; unsigned char fls = 0;
unsigned char icvFore; unsigned char icvFore = 0;
unsigned char icvBack; unsigned char icvBack = 0;
bool operator < (const FillInfo& right) const bool operator < (const FillInfo& right) const
{ {
...@@ -84,17 +83,17 @@ struct FillInfo ...@@ -84,17 +83,17 @@ struct FillInfo
struct BorderInfo struct BorderInfo
{ {
unsigned char dgLeft; unsigned char dgLeft = 0;
unsigned char dgRight; unsigned char dgRight = 0;
unsigned char dgTop; unsigned char dgTop = 0;
unsigned char dgBottom; unsigned char dgBottom = 0;
unsigned char dgDiag; unsigned char dgDiag = 0;
unsigned char grbitDiag; unsigned char grbitDiag = 0;
unsigned char icvLeft; unsigned char icvLeft = 0;
unsigned char icvRight; unsigned char icvRight = 0;
unsigned char icvTop; unsigned char icvTop = 0;
unsigned char icvBottom; unsigned char icvBottom = 0;
unsigned char icvDiag; unsigned char icvDiag = 0;
FillInfoExt leftFillInfo_; FillInfoExt leftFillInfo_;
FillInfoExt rightFillInfo_; FillInfoExt rightFillInfo_;
......
...@@ -38,10 +38,11 @@ namespace XLS ...@@ -38,10 +38,11 @@ namespace XLS
{ {
CellXF::CellXF(size_t& cell_xf_current_id, size_t& style_xf_current_id) CellXF::CellXF(size_t& cell_xf_current_id, size_t& style_xf_current_id) : cell_xf_current_id_(cell_xf_current_id),
: cell_xf_current_id_(cell_xf_current_id), style_xf_current_id_(style_xf_current_id), font_id(0xFFFF) style_xf_current_id_(style_xf_current_id)
{ {
alc = alcV = 0; alc = alcV = 0;
font_id = 0xFFFF;
} }
...@@ -152,6 +153,91 @@ void CellXF::load(CFRecord& record) ...@@ -152,6 +153,91 @@ void CellXF::load(CFRecord& record)
} }
} }
void CellXF::Update(ExtProp* ext_prop)
{
if (!ext_prop) return;
switch(ext_prop->extType)
{
case 0x0004:
{
fill.foreFillInfo_.enabled = true;
fill.foreFillInfo_.icv = ext_prop->extPropData.color.icv;
fill.foreFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
fill.foreFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
fill.foreFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break;
case 0x0005:
{
fill.backFillInfo_.enabled = true;
fill.backFillInfo_.icv = ext_prop->extPropData.color.icv;
fill.backFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
fill.backFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
fill.backFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break;
case 0x0007:
{
border.topFillInfo_.enabled = true;
border.topFillInfo_.icv = ext_prop->extPropData.color.icv;
border.topFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
border.topFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
border.topFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break;
case 0x0008:
{
border.bottomFillInfo_.enabled = true;
border.bottomFillInfo_.icv = ext_prop->extPropData.color.icv;
border.bottomFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
border.bottomFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
border.bottomFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break;
case 0x0009:
{
border.leftFillInfo_.enabled = true;
border.leftFillInfo_.icv = ext_prop->extPropData.color.icv;
border.leftFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
border.leftFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
border.leftFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break;
case 0x000A:
{
border.rightFillInfo_.enabled = true;
border.rightFillInfo_.icv = ext_prop->extPropData.color.icv;
border.rightFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
border.rightFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
border.rightFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break;
//case 0x000B: //diag color
//case 0x000C: //diag color
case 0x000D:
{
font_color.enabled = true;
font_color.icv = ext_prop->extPropData.color.icv;
font_color.xclrType = ext_prop->extPropData.color.xclrType;
font_color.nTintShade = ext_prop->extPropData.color.nTintShade;
font_color.xclrValue = ext_prop->extPropData.color.xclrValue;
}break;
//case 0x0006:
// extPropData.gradient_fill.toXML(own_tag);
// break;
case 0x000E:
{
font_id = ext_prop->extPropData.font_scheme;
}break;
case 0x000F:
{
cIndent = ext_prop->extPropData.indent_level;
}break;
}
}
void CellXF::Update(XFProps* xfProps)
{
if (!xfProps) return;
//
// std::wstringstream strm;
// xfProps->serialize_fill(strm);
// fill.ext = strm.str();
}
void CellXF::RegisterFillBorder() void CellXF::RegisterFillBorder()
{ {
for (size_t i = 0; i < ext_props.size(); i++ ) for (size_t i = 0; i < ext_props.size(); i++ )
...@@ -231,6 +317,8 @@ void CellXF::RegisterFillBorder() ...@@ -231,6 +317,8 @@ void CellXF::RegisterFillBorder()
border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border); border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border);
fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill); fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill);
m_GlobalWorkbookInfo->RegisterFontColorId(font_id, font_color);
} }
......
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
namespace XLS namespace XLS
{ {
class XFProps;
class ExtProp;
class CFRecord; class CFRecord;
class GlobalWorkbookInfo; class GlobalWorkbookInfo;
...@@ -74,19 +76,23 @@ public: ...@@ -74,19 +76,23 @@ public:
BorderInfo border; BorderInfo border;
FillInfo fill; FillInfo fill;
BiffStructurePtrVector ext_props;
FillInfoExt font_color; FillInfoExt font_color;
size_t font_id; size_t font_id;
bool fHasXFExt; bool fHasXFExt;
bool fsxButton; bool fsxButton;
//------------------------------------------------------------------
BiffStructurePtrVector ext_props;
BiffStructurePtrVector xf_props;
size_t border_x_id; size_t border_x_id;
size_t fill_x_id; size_t fill_x_id;
size_t& cell_xf_current_id_; size_t& cell_xf_current_id_;
size_t& style_xf_current_id_; size_t& style_xf_current_id_;
void Update(ExtProp* extProp); // xls style
void Update(XFProps* xfProps); //xlsx style
void RegisterFillBorder(); void RegisterFillBorder();
}; };
......
...@@ -57,11 +57,11 @@ void List12TableStyleClientInfo::load(CFRecord& record) ...@@ -57,11 +57,11 @@ void List12TableStyleClientInfo::load(CFRecord& record)
unsigned short flags; unsigned short flags;
record >> flags; record >> flags;
nFirstColumn = GETBITS(flags, 0, 1); fFirstColumn = GETBIT(flags, 0);
nLastColumn = GETBITS(flags, 1, 2); fLastColumn = GETBIT(flags, 1);
nRowStripes = GETBITS(flags, 3, 4); fRowStripes = GETBIT(flags, 2);
nColumnStripes = GETBITS(flags, 5, 6); fColumnStripes = GETBIT(flags, 3);
nDefaultStyle = GETBITS(flags, 9, 10); fDefaultStyle = GETBIT(flags, 6);
record >> stListStyleName; record >> stListStyleName;
} }
......
...@@ -51,11 +51,11 @@ public: ...@@ -51,11 +51,11 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned char nFirstColumn; bool fFirstColumn;
unsigned char nLastColumn; bool fLastColumn;
unsigned char nRowStripes; bool fRowStripes;
unsigned char nColumnStripes; bool fColumnStripes;
unsigned char nDefaultStyle; bool fDefaultStyle;
XLUnicodeString stListStyleName; XLUnicodeString stListStyleName;
}; };
......
...@@ -37,24 +37,20 @@ namespace XLS ...@@ -37,24 +37,20 @@ namespace XLS
{ {
LongRGBA::LongRGBA() LongRGBA::LongRGBA() : is_alpha(true)
: is_alpha(true)
{ {
} }
LongRGBA::LongRGBA(const bool alpha_present) LongRGBA::LongRGBA(const bool alpha_present) : is_alpha(alpha_present)
: is_alpha(alpha_present)
{ {
} }
LongRGB::LongRGB() LongRGB::LongRGB() : LongRGBA(false)
: LongRGBA(false)
{ {
} }
BiffStructurePtr LongRGBA::clone() BiffStructurePtr LongRGBA::clone()
{ {
return BiffStructurePtr(new LongRGBA(*this)); return BiffStructurePtr(new LongRGBA(*this));
...@@ -78,9 +74,14 @@ void LongRGBA::load(CFRecord& record) ...@@ -78,9 +74,14 @@ void LongRGBA::load(CFRecord& record)
alpha = 0; alpha = 0;
record.skipNunBytes(1); // reserved record.skipNunBytes(1); // reserved
} }
strRGB = STR::toRGB (red, green, blue); strRGB = STR::toRGB (red, green, blue);
strARGB = STR::toARGB(red, green, blue, alpha); strARGB = STR::toARGB(red, green, blue, alpha);
} }
_UINT32 LongRGBA::ToRGBA()
{
return ((unsigned int)( ( (unsigned char)(red) )| ( ( (unsigned char)(green) ) << 8 ) | ( ( (unsigned char)(blue) ) << 16 ) | ( (unsigned char)(alpha) << 24 ) ) );
}
} // namespace XLS } // namespace XLS
...@@ -50,7 +50,6 @@ public: ...@@ -50,7 +50,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
unsigned char red; unsigned char red;
unsigned char green; unsigned char green;
unsigned char blue; unsigned char blue;
...@@ -59,6 +58,8 @@ public: ...@@ -59,6 +58,8 @@ public:
std::wstring strARGB; std::wstring strARGB;
std::wstring strRGB; std::wstring strRGB;
_UINT32 ToRGBA();
bool is_alpha; bool is_alpha;
}; };
......
...@@ -29,23 +29,29 @@ ...@@ -29,23 +29,29 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
#include <Binary/CFRecord.h>
#include "StyleXF.h" #include "StyleXF.h"
#include "XFProps.h"
#include "XFProp.h"
#include "ExtProp.h" #include "ExtProp.h"
#include "XFPropColor.h"
#include "BitMarkedStructs.h"
#include "XFPropBorder.h"
#include "../Biff_records/Font.h"
#include <Binary/CFRecord.h>
namespace XLS namespace XLS
{ {
StyleXF::StyleXF(size_t& cell_xf_current_id, size_t& style_xf_current_id) StyleXF::StyleXF(size_t& cell_xf_current_id, size_t& style_xf_current_id) : cell_xf_current_id_(cell_xf_current_id),
: cell_xf_current_id_(cell_xf_current_id), style_xf_current_id_(style_xf_current_id), font_id(0xFFFF) style_xf_current_id_(style_xf_current_id)
{ {
font_id = -1; font_id = 0xFFFF;
border_x_id = -1; border_x_id = -1;
fill_x_id = -1; fill_x_id = -1;
font = NULL;
fill.fls = 0; fill.fls = 0;
} }
...@@ -58,9 +64,9 @@ BiffStructurePtr StyleXF::clone() ...@@ -58,9 +64,9 @@ BiffStructurePtr StyleXF::clone()
void StyleXF::load(CFRecord& record) void StyleXF::load(CFRecord& record)
{ {
m_GlobalWorkbookInfo = record.getGlobalWorkbookInfo(); global_info = record.getGlobalWorkbookInfo();
if (m_GlobalWorkbookInfo->Version < 0x0600) if (global_info->Version < 0x0600)
{ {
_UINT16 flags1; _UINT16 flags1;
_UINT32 flags2; _UINT32 flags2;
...@@ -146,86 +152,153 @@ void StyleXF::Update(ExtProp* ext_prop) ...@@ -146,86 +152,153 @@ void StyleXF::Update(ExtProp* ext_prop)
{ {
if (!ext_prop) return; if (!ext_prop) return;
FillInfoExt color_out;
{
color_out.enabled = true;
color_out.icv = ext_prop->extPropData.color.icv;
color_out.xclrType = ext_prop->extPropData.color.xclrType;
color_out.nTintShade = ext_prop->extPropData.color.nTintShade;
color_out.xclrValue = ext_prop->extPropData.color.xclrValue;
}
switch(ext_prop->extType) switch(ext_prop->extType)
{ {
case 0x0004: case 0x0004:
{ {
fill.foreFillInfo_.enabled = true; fill.foreFillInfo_ = color_out;
fill.foreFillInfo_.icv = ext_prop->extPropData.color.icv;
fill.foreFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
fill.foreFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
fill.foreFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break; }break;
case 0x0005: case 0x0005:
{ {
fill.backFillInfo_.enabled = true; fill.backFillInfo_ = color_out;
fill.backFillInfo_.icv = ext_prop->extPropData.color.icv;
fill.backFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
fill.backFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
fill.backFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break; }break;
case 0x0007: case 0x0007:
{ {
border.topFillInfo_.enabled = true; border.topFillInfo_ = color_out;
border.topFillInfo_.icv = ext_prop->extPropData.color.icv;
border.topFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
border.topFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
border.topFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break; }break;
case 0x0008: case 0x0008:
{ {
border.bottomFillInfo_.enabled = true; border.bottomFillInfo_ = color_out;
border.bottomFillInfo_.icv = ext_prop->extPropData.color.icv;
border.bottomFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
border.bottomFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
border.bottomFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break; }break;
case 0x0009: case 0x0009:
{ {
border.leftFillInfo_.enabled = true; border.leftFillInfo_ = color_out;
border.leftFillInfo_.icv = ext_prop->extPropData.color.icv;
border.leftFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
border.leftFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
border.leftFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break; }break;
case 0x000A: case 0x000A:
{ {
border.rightFillInfo_.enabled = true; border.rightFillInfo_ = color_out;
border.rightFillInfo_.icv = ext_prop->extPropData.color.icv;
border.rightFillInfo_.xclrType = ext_prop->extPropData.color.xclrType;
border.rightFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade;
border.rightFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue;
}break; }break;
//case 0x000B: //diag color //case 0x000B: //diag color
//case 0x000C: //diag color //case 0x000C: //diag color
case 0x000D: case 0x000D:
{ {
font_color.enabled = true; font_color = color_out;
font_color.icv = ext_prop->extPropData.color.icv;
font_color.xclrType = ext_prop->extPropData.color.xclrType;
font_color.nTintShade = ext_prop->extPropData.color.nTintShade;
font_color.xclrValue = ext_prop->extPropData.color.xclrValue;
}break; }break;
//case 0x0006: //case 0x0006:
// extPropData.gradient_fill.toXML(own_tag); // extPropData.gradient_fill.toXML(own_tag);
// break; // break;
case 0x000E: case 0x000E:
{ {
font_id = ext_prop->extPropData.font_scheme; font_id = ext_prop->extPropData.font_scheme;
}break; }break;
case 0x000F: case 0x000F:
{ {
cIndent = ext_prop->extPropData.indent_level; cIndent = ext_prop->extPropData.indent_level;
}break; }break;
} }
} }
void StyleXF::Update(XFProps* xfProps) void StyleXF::Update(XFProp* xfProp)
{ {
if (!xfProps) return; if (!xfProp) return;
XFPropColor* color = dynamic_cast<XFPropColor*>(xfProp->xfPropDataBlob.get());
if (color)
{
FillInfoExt color_out;
color_out.enabled = true;
color_out.icv = color->icv;
color_out.xclrType = color->xclrType;
color_out.nTintShade = color->nTintShade;
if (color->xclrType == 3)color_out.xclrValue = color->icv;
else color_out.xclrValue = color->dwRgba.ToRGBA();
switch(xfProp->xfPropType)
{
case 0x0001: fill.foreFillInfo_ = color_out; break;
case 0x0002: fill.backFillInfo_ = color_out; break;
case 0x0005: font_color = color_out; break;
}
return;
}
BIFF_BYTE* byte_ = dynamic_cast<BIFF_BYTE*>(xfProp->xfPropDataBlob.get());
if (byte_)
{
switch(xfProp->xfPropType)
{
case 0x0025:
{
font_id = *byte_->value();
if ((global_info->m_arFonts) && (font_id >=0 && font_id < global_info->m_arFonts->size()))
{
font = dynamic_cast<Font*>(global_info->m_arFonts->at(font_id).get());
}
}break;
case 0x001C: if (font) font->fItalic = *byte_->value(); break;
case 0x001D: if (font) font->fStrikeOut = *byte_->value(); break;
case 0x001E: if (font) font->fOutline = *byte_->value(); break;
case 0x001F: if (font) font->fShadow = *byte_->value(); break;
case 0x0022: if (font) font->bCharSet = *byte_->value(); break;
}
return;
}
BIFF_WORD* word = dynamic_cast<BIFF_WORD*>(xfProp->xfPropDataBlob.get());
std::wstringstream strm; if (word)
xfProps->serialize_fill(strm); {
fill.ext = strm.str(); switch(xfProp->xfPropType)
{
case 0x0019: if (font) font->bls = *word->value(); break;
case 0x001A: if (font) font->uls = *word->value(); break;
case 0x001B: if (font) font->sss = *word->value(); break;
}
return;
}
BIFF_DWORD* dword = dynamic_cast<BIFF_DWORD*>(xfProp->xfPropDataBlob.get());
if (dword)
{
switch(xfProp->xfPropType)
{
case 0x0024: if (font) font->dyHeight = *dword->value(); break;
}
return;
}
XFPropBorder *brdr = dynamic_cast<XFPropBorder*>(xfProp->xfPropDataBlob.get());
if (brdr)
{
FillInfoExt color_out;
color_out.enabled = true;
color_out.icv = brdr->color.icv;
color_out.xclrType = brdr->color.xclrType;
color_out.nTintShade = brdr->color.nTintShade;
if (brdr->color.xclrType == 3) color_out.xclrValue = brdr->color.icv;
else color_out.xclrValue = brdr->color.dwRgba.ToRGBA();
switch(xfProp->xfPropType)
{
case 0x0006: border.topFillInfo_ = color_out; break;
case 0x0007: border.bottomFillInfo_ = color_out; break;
case 0x0008: border.leftFillInfo_ = color_out; break;
case 0x0009: border.rightFillInfo_ = color_out; break;
//horiz, vert, diag
}
return;
}
} }
void StyleXF::RegisterFillBorder() void StyleXF::RegisterFillBorder()
{ {
...@@ -234,9 +307,15 @@ void StyleXF::RegisterFillBorder() ...@@ -234,9 +307,15 @@ void StyleXF::RegisterFillBorder()
ExtProp* ext_prop = dynamic_cast<ExtProp*>(ext_props[i].get()); ExtProp* ext_prop = dynamic_cast<ExtProp*>(ext_props[i].get());
Update (ext_prop); Update (ext_prop);
} }
for (size_t i = 0; i < xf_props.size(); i++ )
border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border); {
fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill); XFProp* xf_prop = dynamic_cast<XFProp*>(xf_props[i].get());
Update (xf_prop);
}
border_x_id = global_info->RegisterBorderId(border);
fill_x_id = global_info->RegisterFillId(fill);
global_info->RegisterFontColorId(font_id, font_color);
} }
......
...@@ -36,9 +36,10 @@ ...@@ -36,9 +36,10 @@
namespace XLS namespace XLS
{ {
class XFProps; class XFProp;
class ExtProp; class ExtProp;
class CFRecord; class CFRecord;
class Font;
class GlobalWorkbookInfo; class GlobalWorkbookInfo;
typedef boost::shared_ptr<GlobalWorkbookInfo> GlobalWorkbookInfoPtr; typedef boost::shared_ptr<GlobalWorkbookInfo> GlobalWorkbookInfoPtr;
...@@ -52,17 +53,10 @@ public: ...@@ -52,17 +53,10 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
GlobalWorkbookInfoPtr m_GlobalWorkbookInfo;
static const ElementType type = typeStyleXF; static const ElementType type = typeStyleXF;
int serialize(std::wostream & stream); int serialize(std::wostream & stream);
void Update(ExtProp* extProp); // xls style
void Update(XFProps* xfProps); //xlsx style
void RegisterFillBorder();
unsigned char alc; unsigned char alc;
bool fWrap; bool fWrap;
unsigned char alcV; unsigned char alcV;
...@@ -72,13 +66,22 @@ public: ...@@ -72,13 +66,22 @@ public:
bool fShrinkToFit; bool fShrinkToFit;
unsigned char iReadOrder; unsigned char iReadOrder;
//------------------------------------------------------------------
GlobalWorkbookInfoPtr global_info;
BorderInfo border; BorderInfo border;
FillInfo fill; FillInfo fill;
FillInfoExt font_color; FillInfoExt font_color;
size_t font_id; size_t font_id;
Font *font;
BiffStructurePtrVector ext_props; BiffStructurePtrVector ext_props;
BiffStructurePtrVector xf_props;
void Update(ExtProp* extProp); // xls style
void Update(XFProp* xfProp); //xlsx style
void RegisterFillBorder();
size_t border_x_id; size_t border_x_id;
size_t fill_x_id; size_t fill_x_id;
......
...@@ -29,16 +29,15 @@ ...@@ -29,16 +29,15 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
#include <Binary/CFRecord.h>
#include "XFProp.h" #include "XFProp.h"
#include <Binary/CFRecord.h>
#include "XFPropColor.h" #include "XFPropColor.h"
#include "XFPropGradient.h" #include "XFPropGradient.h"
#include "XFPropGradientStop.h" #include "XFPropGradientStop.h"
#include "XFPropBorder.h" #include "XFPropBorder.h"
#include "BiffString.h" #include "BiffString.h"
#include "BitMarkedStructs.h"
#include <Logic/Biff_structures/BitMarkedStructs.h>
#include <utils.h> #include <utils.h>
...@@ -145,8 +144,7 @@ static void serialize_color_prop(std::wostream & stream, const std::wstring & na ...@@ -145,8 +144,7 @@ static void serialize_color_prop(std::wostream & stream, const std::wstring & na
XFPropColor * color = dynamic_cast<XFPropColor*>(val.get()); XFPropColor * color = dynamic_cast<XFPropColor*>(val.get());
if (!color) return; if (!color) return;
color->node_name = name; color->serialize(stream, name);
color->serialize(stream);
} }
static void serialize_val_prop(std::wostream & stream, const std::wstring & name, BiffStructurePtr & val) static void serialize_val_prop(std::wostream & stream, const std::wstring & name, BiffStructurePtr & val)
...@@ -218,7 +216,7 @@ static void serialize_border_prop(std::wostream & stream, const std::wstring & n ...@@ -218,7 +216,7 @@ static void serialize_border_prop(std::wostream & stream, const std::wstring & n
} }
if (border->dgBorder != 0) if (border->dgBorder != 0)
{ {
border->color.serialize(CP_XML_STREAM()); border->color.serialize(CP_XML_STREAM(), L"color");
} }
} }
} }
......
...@@ -32,8 +32,7 @@ ...@@ -32,8 +32,7 @@
#pragma once #pragma once
#include "BiffStructure.h" #include "BiffStructure.h"
#include <Logic/Biff_structures/FullColorExt.h> #include "FullColorExt.h"
#include <Logic/Biff_structures/XFExtGradient.h>
#include <simple_xml_writer.h> #include <simple_xml_writer.h>
...@@ -59,5 +58,6 @@ public: ...@@ -59,5 +58,6 @@ public:
unsigned short cb; unsigned short cb;
BiffStructurePtr xfPropDataBlob; BiffStructurePtr xfPropDataBlob;
}; };
typedef boost::shared_ptr<XFProp> XFPropPtr;
} // namespace XLS } // namespace XLS
...@@ -49,7 +49,6 @@ public: ...@@ -49,7 +49,6 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
XFPropColor color; XFPropColor color;
unsigned short dgBorder; unsigned short dgBorder;
}; };
......
...@@ -47,8 +47,6 @@ BiffStructurePtr XFPropColor::clone() ...@@ -47,8 +47,6 @@ BiffStructurePtr XFPropColor::clone()
void XFPropColor::load(CFRecord& record) void XFPropColor::load(CFRecord& record)
{ {
node_name = L"color";
unsigned char flags; unsigned char flags;
record >> flags; record >> flags;
...@@ -58,7 +56,7 @@ void XFPropColor::load(CFRecord& record) ...@@ -58,7 +56,7 @@ void XFPropColor::load(CFRecord& record)
record >> icv >> nTintShade >> dwRgba; record >> icv >> nTintShade >> dwRgba;
} }
int XFPropColor::serialize(std::wostream & stream) int XFPropColor::serialize(std::wostream & stream, const std::wstring &node_name)
{ {
if (xclrType > 3 )return 0;//not set if (xclrType > 3 )return 0;//not set
...@@ -68,11 +66,11 @@ int XFPropColor::serialize(std::wostream & stream) ...@@ -68,11 +66,11 @@ int XFPropColor::serialize(std::wostream & stream)
{ {
switch(xclrType) switch(xclrType)
{ {
case 0: CP_XML_ATTR(L"auto", 1); break; case 0: CP_XML_ATTR(L"auto", 1); break;
case 1: CP_XML_ATTR(L"indexed", icv); break; case 1: CP_XML_ATTR(L"indexed", icv); break;
case 2: case 3: CP_XML_ATTR(L"theme", icv); break;
case 3: CP_XML_ATTR(L"rgb", dwRgba.strRGB); break; default:
//CP_XML_ATTR(L"theme", icv); break; CP_XML_ATTR(L"rgb", dwRgba.strRGB); break;
} }
if (nTintShade != 0) if (nTintShade != 0)
{ {
......
...@@ -47,10 +47,9 @@ public: ...@@ -47,10 +47,9 @@ public:
virtual void load(CFRecord& record); virtual void load(CFRecord& record);
static const ElementType type = typeXFPropColor; static const ElementType type = typeXFPropColor;
int serialize(std::wostream & stream); int serialize(std::wostream & stream, const std::wstring &sNode);
bool fValidRGBA; bool fValidRGBA;
unsigned char xclrType; unsigned char xclrType;
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "XFPropGradientStop.h" #include "XFPropGradientStop.h"
#include <Binary/CFRecord.h> #include <Binary/CFRecord.h>
#include <simple_xml_writer.h> #include <simple_xml_writer.h>
namespace XLS namespace XLS
...@@ -59,7 +58,7 @@ int XFPropGradientStop::serialize(std::wostream & stream) ...@@ -59,7 +58,7 @@ int XFPropGradientStop::serialize(std::wostream & stream)
CP_XML_NODE(L"stop") CP_XML_NODE(L"stop")
{ {
CP_XML_ATTR(L"position", numPosition); CP_XML_ATTR(L"position", numPosition);
color.serialize(CP_XML_STREAM()); color.serialize(CP_XML_STREAM(), L"color");
} }
} }
return 0; return 0;
......
...@@ -29,10 +29,15 @@ ...@@ -29,10 +29,15 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
#include <Binary/CFRecord.h>
#include "XFProps.h" #include "XFProps.h"
#include <Binary/CFRecord.h> #include "XFProp.h"
#include <Logic/Biff_structures/BitMarkedStructs.h> #include "XFPropColor.h"
#include "XFPropGradient.h"
#include "XFPropGradientStop.h"
#include "BitMarkedStructs.h"
namespace XLS namespace XLS
{ {
...@@ -43,8 +48,6 @@ BiffStructurePtr XFProps::clone() ...@@ -43,8 +48,6 @@ BiffStructurePtr XFProps::clone()
return BiffStructurePtr(new XFProps(*this)); return BiffStructurePtr(new XFProps(*this));
} }
void XFProps::load(CFRecord& record) void XFProps::load(CFRecord& record)
{ {
arXFPropBorder.is_present = false; arXFPropBorder.is_present = false;
...@@ -54,21 +57,24 @@ void XFProps::load(CFRecord& record) ...@@ -54,21 +57,24 @@ void XFProps::load(CFRecord& record)
for(int i = 0; i < cprops; ++i) for(int i = 0; i < cprops; ++i)
{ {
XFProp prop; XFPropPtr prop(new XFProp);
record >> prop; if (!prop) continue;
prop->load(record);
rgExt.push_back(prop);
if (prop.xfPropType >= 0 && prop.xfPropType <= 3) if (prop->xfPropType >= 0 && prop->xfPropType <= 3)
{ {
arXFPropFill.push_back(prop); arXFPropFill.push_back(prop);
} }
else if (prop.xfPropType == 4) else if (prop->xfPropType == 4)
{ {
arXFPropGradient.push_back(prop); arXFPropGradient.push_back(prop);
} }
else if (prop.xfPropType >= 6 && prop.xfPropType <= 14) else if (prop->xfPropType >= 6 && prop->xfPropType <= 14)
{ {
arXFPropBorder.is_present = true; arXFPropBorder.is_present = true;
switch(prop.xfPropType) switch(prop->xfPropType)
{ {
case 6: arXFPropBorder.top = prop; break; case 6: arXFPropBorder.top = prop; break;
case 7: arXFPropBorder.bottom = prop; break; case 7: arXFPropBorder.bottom = prop; break;
...@@ -78,20 +84,20 @@ void XFProps::load(CFRecord& record) ...@@ -78,20 +84,20 @@ void XFProps::load(CFRecord& record)
arXFPropBorder.other.push_back(prop); arXFPropBorder.other.push_back(prop);
} }
} }
else if (prop.xfPropType >= 15 && prop.xfPropType <= 22 || prop.xfPropType == 42) else if (prop->xfPropType >= 15 && prop->xfPropType <= 22 || prop->xfPropType == 42)
{ {
arXFPropAlignment.push_back(prop); arXFPropAlignment.push_back(prop);
} }
else if (prop.xfPropType >= 24 && prop.xfPropType <= 37 || prop.xfPropType == 5) else if (prop->xfPropType >= 24 && prop->xfPropType <= 37 || prop->xfPropType == 5)
{ {
arXFPropFont.push_back(prop); arXFPropFont.push_back(prop);
} }
else if (prop.xfPropType >= 38 && prop.xfPropType <= 41) else if (prop->xfPropType >= 38 && prop->xfPropType <= 41)
{ {
bool skip_codes = false; bool skip_codes = false;
if (prop.xfPropType == 0x0029) if (prop->xfPropType == 0x0029)
{ {
BIFF_WORD* word = dynamic_cast<BIFF_WORD*>(prop.xfPropDataBlob.get()); BIFF_WORD* word = dynamic_cast<BIFF_WORD*>(prop->xfPropDataBlob.get());
if ((word) && (word->value() == (_UINT16)30)) if ((word) && (word->value() == (_UINT16)30))
{ {
skip_codes = true; skip_codes = true;
...@@ -101,7 +107,7 @@ void XFProps::load(CFRecord& record) ...@@ -101,7 +107,7 @@ void XFProps::load(CFRecord& record)
if (!skip_codes) if (!skip_codes)
arXFPropNumFmt.push_back(prop); arXFPropNumFmt.push_back(prop);
} }
else if (prop.xfPropType >= 43 && prop.xfPropType <= 44) else if (prop->xfPropType >= 43 && prop->xfPropType <= 44)
{ {
arXFPropProtection.push_back(prop); arXFPropProtection.push_back(prop);
} }
...@@ -115,23 +121,23 @@ int XFProps::serialize_fill(std::wostream & stream) ...@@ -115,23 +121,23 @@ int XFProps::serialize_fill(std::wostream & stream)
{ {
if (arXFPropFill.empty()) return 0; if (arXFPropFill.empty()) return 0;
CP_XML_WRITER(stream) XFProp *pPatternType = NULL;
{ XFPropGradient *pGradient = NULL;
XFProp *pPatternType = NULL;
XFPropGradient *pGradient = NULL; for (size_t i = 0; i < arXFPropFill.size(); i++)
{
for (size_t i = 0; i < arXFPropFill.size(); i++) switch(arXFPropFill[i]->xfPropType)
{ {
switch(arXFPropFill[i].xfPropType) case 0: pPatternType = arXFPropFill[i].get(); break;
{ case 3: pGradient = dynamic_cast<XFPropGradient*>(arXFPropFill[i]->xfPropDataBlob.get()); break;
case 1:
case 0: pPatternType = &arXFPropFill[i]; break;
case 3: pGradient = dynamic_cast<XFPropGradient*>(arXFPropFill[i].xfPropDataBlob.get()); break;
}
} }
}
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"fill") CP_XML_NODE(L"fill")
{ {
if (pGradient || arXFPropGradient.size() > 0) if (pGradient || arXFPropGradient.size() > 0)
{ {
CP_XML_NODE(L"gradientFill") CP_XML_NODE(L"gradientFill")
{ {
...@@ -140,26 +146,37 @@ int XFProps::serialize_fill(std::wostream & stream) ...@@ -140,26 +146,37 @@ int XFProps::serialize_fill(std::wostream & stream)
for (size_t i = 0 ; i < arXFPropGradient.size(); i++) for (size_t i = 0 ; i < arXFPropGradient.size(); i++)
{ {
if (arXFPropGradient[i].xfPropDataBlob == NULL) continue; if (arXFPropGradient[i]->xfPropDataBlob == NULL) continue;
arXFPropGradient[i].xfPropDataBlob->serialize(CP_XML_STREAM()); arXFPropGradient[i]->xfPropDataBlob->serialize(CP_XML_STREAM());
} }
} }
} }
else if (pPatternType) else
{ {
CP_XML_NODE(L"patternFill") CP_XML_NODE(L"patternFill")
{ {
pPatternType->serialize_attr(CP_GET_XML_NODE()); if (pPatternType)
{
pPatternType->serialize_attr(CP_GET_XML_NODE());
}
for (size_t i = 0; i < arXFPropFill.size(); i++) for (size_t i = 0; i < arXFPropFill.size(); i++)
{ {
arXFPropFill[i].serialize(CP_XML_STREAM()); XFPropColor *pColor = dynamic_cast<XFPropColor*>(arXFPropFill[i]->xfPropDataBlob.get());
if (!pColor) continue;
std::wstring sNode = L"color";
switch(arXFPropFill[i]->xfPropType)
{
case 1: sNode = L"fgColor"; break;
case 2: sNode = L"bgColor"; break;
}
pColor->serialize(CP_XML_STREAM(), sNode);
} }
} }
} }
} }
} }
return 0; return 0;
} }
...@@ -173,7 +190,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf) ...@@ -173,7 +190,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
{ {
for (size_t i = 0; i < arXFPropFont.size(); i++) for (size_t i = 0; i < arXFPropFont.size(); i++)
{ {
arXFPropFont[i].serialize(CP_XML_STREAM()); arXFPropFont[i]->serialize(CP_XML_STREAM());
} }
} }
} }
...@@ -185,11 +202,11 @@ int XFProps::serialize(std::wostream & strm, bool dxf) ...@@ -185,11 +202,11 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
{ {
if (dxf) if (dxf)
{ {
arXFPropNumFmt[i].serialize_attr(CP_GET_XML_NODE()); arXFPropNumFmt[i]->serialize_attr(CP_GET_XML_NODE());
} }
else else
{ {
arXFPropNumFmt[i].serialize(CP_XML_STREAM()); arXFPropNumFmt[i]->serialize(CP_XML_STREAM());
} }
} }
} }
...@@ -202,7 +219,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf) ...@@ -202,7 +219,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
{ {
for (size_t i = 0; i < arXFPropAlignment.size(); i++) for (size_t i = 0; i < arXFPropAlignment.size(); i++)
{ {
arXFPropAlignment[i].serialize(CP_XML_STREAM()); arXFPropAlignment[i]->serialize(CP_XML_STREAM());
} }
} }
} }
...@@ -219,7 +236,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf) ...@@ -219,7 +236,7 @@ int XFProps::serialize(std::wostream & strm, bool dxf)
//---------------------------------------- //----------------------------------------
for (size_t i = 0; i < arXFPropBorder.other.size(); i++) for (size_t i = 0; i < arXFPropBorder.other.size(); i++)
{ {
arXFPropBorder.other[i].serialize(CP_XML_STREAM()); arXFPropBorder.other[i]->serialize(CP_XML_STREAM());
} }
} }
} }
......
...@@ -32,11 +32,13 @@ ...@@ -32,11 +32,13 @@
#pragma once #pragma once
#include "BiffStructure.h" #include "BiffStructure.h"
#include "XFProp.h"
namespace XLS namespace XLS
{ {
class XFProp;
typedef boost::shared_ptr<XFProp> XFPropPtr;
class CFRecord; class CFRecord;
class XFProps : public BiffStructure class XFProps : public BiffStructure
...@@ -56,27 +58,31 @@ public: ...@@ -56,27 +58,31 @@ public:
int serialize_fill(std::wostream & stream); int serialize_fill(std::wostream & stream);
std::vector<XFProp> arXFPropFont; std::vector<XFPropPtr> arXFPropFont;
std::vector<XFProp> arXFPropNumFmt; std::vector<XFPropPtr> arXFPropNumFmt;
std::vector<XFProp> arXFPropFill; std::vector<XFPropPtr> arXFPropFill;
std::vector<XFProp> arXFPropAlignment; std::vector<XFPropPtr> arXFPropAlignment;
struct _b struct _b
{ {
bool is_present; bool is_present = false;
_CP_OPT(XFProp) left; XFPropPtr left;
_CP_OPT(XFProp) right; XFPropPtr right;
_CP_OPT(XFProp) top; XFPropPtr top;
_CP_OPT(XFProp) bottom; XFPropPtr bottom;
std::vector<XFProp> other;
std::vector<XFPropPtr> other;
}arXFPropBorder; }arXFPropBorder;
std::vector<XFProp> arXFPropProtection; std::vector<XFPropPtr> arXFPropProtection;
std::vector<XFProp> arXFPropGradient; std::vector<XFPropPtr> arXFPropGradient;
//----------------------------------------------------- //-----------------------------------------------------
BiffStructurePtrVector rgExt;
bool fNewBorder; bool fNewBorder;
bool bPresent;
}; };
} // namespace XLS } // namespace XLS
...@@ -276,6 +276,9 @@ int FEAT11::serialize(std::wostream & strm, size_t index) ...@@ -276,6 +276,9 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
CP_XML_ATTR(L"id", field->idField); CP_XML_ATTR(L"id", field->idField);
CP_XML_ATTR(L"name", field->strCaption.value()); CP_XML_ATTR(L"name", field->strCaption.value());
if (!field->strTotal.value().empty())
CP_XML_ATTR(L"totalsRowLabel", field->strTotal.value());
if (field->dxfFmtAgg.bExist || if (field->dxfFmtAgg.bExist ||
field->dxfFmtInsertRow.bExist) field->dxfFmtInsertRow.bExist)
{ {
...@@ -294,11 +297,11 @@ int FEAT11::serialize(std::wostream & strm, size_t index) ...@@ -294,11 +297,11 @@ int FEAT11::serialize(std::wostream & strm, size_t index)
{ {
CP_XML_NODE(L"tableStyleInfo") CP_XML_NODE(L"tableStyleInfo")
{ {
CP_XML_ATTR(L"name", table_style->stListStyleName.value()); CP_XML_ATTR(L"name", table_style->stListStyleName.value());
CP_XML_ATTR(L"showFirstColumn", table_style->nFirstColumn); CP_XML_ATTR(L"showFirstColumn", table_style->fFirstColumn);
CP_XML_ATTR(L"showLastColumn", table_style->nLastColumn); CP_XML_ATTR(L"showLastColumn", table_style->fLastColumn);
CP_XML_ATTR(L"showRowStripes", table_style->nRowStripes); CP_XML_ATTR(L"showRowStripes", table_style->fRowStripes);
CP_XML_ATTR(L"showColumnStripes", table_style->nColumnStripes); CP_XML_ATTR(L"showColumnStripes", table_style->fColumnStripes);
} }
} }
} }
......
...@@ -71,6 +71,7 @@ BaseObjectPtr FORMATTING::clone() ...@@ -71,6 +71,7 @@ BaseObjectPtr FORMATTING::clone()
const bool FORMATTING::loadContent(BinProcessor& proc) const bool FORMATTING::loadContent(BinProcessor& proc)
{ {
global_info = proc.getGlobalWorkbookInfo(); global_info = proc.getGlobalWorkbookInfo();
global_info->m_arFonts = &m_arFonts;
int count = 0; int count = 0;
count = proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally at least one Font is mandatory) count = proc.repeated<Font>(0, 510); // Wrong records sequence workaround (originally at least one Font is mandatory)
...@@ -156,40 +157,40 @@ void FORMATTING::update_xfs() ...@@ -156,40 +157,40 @@ void FORMATTING::update_xfs()
if (!xfs) return; if (!xfs) return;
//for (size_t i = 0; (st) && (i < st->m_arStyles.size()); i++) for (size_t i = 0; (st) && (i < st->m_arStyles.size()); i++)
//{ {
// XLS::Style * style = dynamic_cast<Style*>(st->m_arStyles[i].first.get()); XLS::Style *style = dynamic_cast<Style*> (st->m_arStyles[i].first.get());
// XLS::StyleExt * styleExt = dynamic_cast<StyleExt*>(st->m_arStyles[i].second.get()); XLS::StyleExt *styleExt = dynamic_cast<StyleExt*> (st->m_arStyles[i].second.get());
//
// if (styleExt && style) if (styleExt && style)
// { {
// if (styleExt->fBuiltIn && styleExt->xfProps.cprops > 0) if (styleExt->fBuiltIn && styleExt->xfProps.cprops > 0)
// { {
// bool bFound = false; bool bFound = false;
// for (size_t i = 0; i < xfs->m_arCellStyles.size(); i++) for (size_t i = 0; i < xfs->m_arCellStyles.size(); i++)
// { {
// XF* xf = dynamic_cast<XF*>(xfs->m_arCellStyles[i].get()); XF* xf = dynamic_cast<XF*>(xfs->m_arCellStyles[i].get());
// if (xf->ind_xf == style->ixfe) if (xf->ind_xf == style->ixfe)
// { {
// xf->style.Update(&styleExt->xfProps); xf->style.xf_props = styleExt->xfProps.rgExt;
// bFound = true; bFound = true;
// break; break;
// } }
// } }
// //for (size_t i = 0; !bFound && i < xfs->m_arCellXFs.size(); i++) //for (size_t i = 0; !bFound && i < xfs->m_arCellXFs.size(); i++) небывает совпадений
// //{ //{
// // XF* xf = dynamic_cast<XF*>(xfs->m_arCellXFs[i].get()); // XF* xf = dynamic_cast<XF*>(xfs->m_arCellXFs[i].get());
// // if (xf->ind_xf == style->ixfe) // if (xf->ind_xf == style->ixfe)
// // { // {
// // xf->cell.Update(&styleExt->xfProps); // xf->cell.xf_props = styleExt->xfProps.rgExt;
// // bFound = true; // bFound = true;
// // break; // break;
// // } // }
// //} //}
// } }
// } }
//} }
xfs->RegisterFillBorder(); xfs->RegisterFillBorder();
} }
void FORMATTING::concatinate(FORMATTING* ext) void FORMATTING::concatinate(FORMATTING* ext)
......
...@@ -94,8 +94,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName, ...@@ -94,8 +94,7 @@ std::pair<float, float> GetMaxDigitSizePixelsImpl(const std::wstring & fontName,
return std::pair<float, float>(width, maxHeight); return std::pair<float, float>(width, maxHeight);
} }
GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConverter * xls_converter_) GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConverter * converter) : CodePage(code_page), xls_converter(converter)
: CodePage(code_page)
{ {
fill_x_ids[FillInfo(0, 0, 0)] = 0; fill_x_ids[FillInfo(0, 0, 0)] = 0;
fill_x_ids[FillInfo(17, 64, 65)] = 1; fill_x_ids[FillInfo(17, 64, 65)] = 1;
...@@ -105,8 +104,6 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver ...@@ -105,8 +104,6 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
Version = 0x0600; Version = 0x0600;
xls_converter = xls_converter_;
startAddedSharedStrings = 0; startAddedSharedStrings = 0;
current_sheet = 0; current_sheet = 0;
cmt_rules = 0; cmt_rules = 0;
...@@ -122,6 +119,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver ...@@ -122,6 +119,7 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page, XlsConver
bVbaProjectExist = false; bVbaProjectExist = false;
bMacrosExist = false; bMacrosExist = false;
bThemePresent = false;
idPivotCache = 0; idPivotCache = 0;
} }
......
...@@ -84,6 +84,7 @@ public: ...@@ -84,6 +84,7 @@ public:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool bVbaProjectExist; bool bVbaProjectExist;
bool bMacrosExist; bool bMacrosExist;
bool bThemePresent;
unsigned short CodePage; unsigned short CodePage;
CRYPT::DecryptorPtr decryptor; CRYPT::DecryptorPtr decryptor;
......
...@@ -689,9 +689,9 @@ void XlsConverter::convert(XLS::GlobalsSubstream* globals) ...@@ -689,9 +689,9 @@ void XlsConverter::convert(XLS::GlobalsSubstream* globals)
{ {
if (globals == NULL) return; if (globals == NULL) return;
convert((XLS::FORMATTING*)globals->m_Formating.get());
convert((XLS::THEME*)globals->m_THEME.get()); convert((XLS::THEME*)globals->m_THEME.get());
convert((XLS::FORMATTING*)globals->m_Formating.get());
convert((XLS::SHAREDSTRINGS*)globals->m_SHAREDSTRINGS.get()); convert((XLS::SHAREDSTRINGS*)globals->m_SHAREDSTRINGS.get());
...@@ -1117,16 +1117,16 @@ void XlsConverter::convert(XLS::THEME* THEME_) ...@@ -1117,16 +1117,16 @@ void XlsConverter::convert(XLS::THEME* THEME_)
if (hresult != S_OK || pBuffer == NULL) if (hresult != S_OK || pBuffer == NULL)
hresult = OfficeUtils.LoadFileFromArchive(tempThemePath, L"theme/theme/theme1.xml", &pBuffer, nBufferSize); hresult = OfficeUtils.LoadFileFromArchive(tempThemePath, L"theme/theme/theme1.xml", &pBuffer, nBufferSize);
//??? переписать по нормальному
if (hresult == S_OK && pBuffer != NULL) if (hresult == S_OK && pBuffer != NULL)
{ {
xls_global_info->bThemePresent = true;
oox::package::theme_content_ptr content = oox::package::theme_content::create((char*)pBuffer, nBufferSize); oox::package::theme_content_ptr content = oox::package::theme_content::create((char*)pBuffer, nBufferSize);
output_document->get_xl_files().add_theme(content); output_document->get_xl_files().add_theme(content);
delete []pBuffer; delete []pBuffer;
pBuffer = NULL; pBuffer = NULL;
} }
} }
struct _group_object struct _group_object
......
...@@ -2146,6 +2146,7 @@ void xlsx_drawing_context::serialize_text(std::wostream & stream, _drawing_state ...@@ -2146,6 +2146,7 @@ void xlsx_drawing_context::serialize_text(std::wostream & stream, _drawing_state
if (drawing_state->wordart.italic) CP_XML_ATTR(L"i", 1); if (drawing_state->wordart.italic) CP_XML_ATTR(L"i", 1);
if (drawing_state->wordart.underline) CP_XML_ATTR(L"u", L"sng"); if (drawing_state->wordart.underline) CP_XML_ATTR(L"u", L"sng");
if (drawing_state->wordart.strike) CP_XML_ATTR(L"strike", L"sngStrike"); if (drawing_state->wordart.strike) CP_XML_ATTR(L"strike", L"sngStrike");
//if (drawing_state->wordart.cap) CP_XML_ATTR(L"cap", *cap);
CP_XML_ATTR(L"kern", 10); CP_XML_ATTR(L"kern", 10);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment