Commit 7f8045cf authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

XlsFormat - trendlines in chart (ver 5 & 6) + правки версии 5

parent 8656d6c6
......@@ -25,16 +25,16 @@ public:
int serialize(std::wostream & _stream);
//-----------------------------
BIFF_BYTE pst;
Boolean<unsigned char> fAutoSplit;
_UINT16 split;
_INT16 iSplitPos;
_INT16 pcSplitPercent;
_INT16 pcPie2Size;
_INT16 pcGap;
unsigned char pst;
unsigned char fAutoSplit;
_UINT16 split;
_INT16 iSplitPos;
_INT16 pcSplitPercent;
_INT16 pcPie2Size;
_INT16 pcGap;
BIFF_DOUBLE numSplitValue;
bool fHasShadow;
bool fHasShadow;
BaseObjectPtr m_Custom;
......
......@@ -26,7 +26,7 @@ public:
//-----------------------------
ForwardOnlyParam<_UINT32> lbPlyPos;
std::wstring hsState;
BIFF_BYTE dt;
unsigned char dt;
ShortXLUnicodeString stName;
};
......
......@@ -31,8 +31,8 @@ public:
int serialize(std::wostream & stream);
FrtRefHeader frtRefHeader;
BIFF_BYTE ct;
BIFF_BYTE cp;
unsigned char ct;
unsigned char cp;
DXFN12 dxf;
......@@ -40,8 +40,8 @@ public:
CFParsedFormulaNoCCE rgce2;
CFParsedFormula fmlaActive;
_UINT16 ipriority;
_UINT16 icfTemplate;
_UINT16 ipriority;
_UINT16 icfTemplate;
CFExTemplateParams rgbTemplateParms;
BiffStructurePtr rgbCT;
......
......@@ -96,7 +96,7 @@ public:
static const ElementType type = typePls;
//-----------------------------
DEVMODE rgb;
BIFF_LONG bin_data_id;
_INT32 bin_data_id;
};
......
......@@ -29,16 +29,16 @@ public:
_UINT16 miyRw;
BIFF_BYTE iOutLevel;
bool fCollapsed;
bool fDyZero;
bool fUnsynced;
bool fGhostDirty;
unsigned char iOutLevel;
bool fCollapsed;
bool fDyZero;
bool fUnsynced;
bool fGhostDirty;
_UINT16 ixfe_val;
bool fExAsc;
bool fExDes;
bool fPhonetic;
_UINT16 ixfe_val;
bool fExAsc;
bool fExDes;
bool fPhonetic;
BackwardOnlyParam<_UINT32> in_block_position;
};
......
......@@ -27,7 +27,7 @@ public:
bool fCol;
bool fCaseSensitive;
bool fAltMethod;
BIFF_BYTE sfp;
unsigned char sfp;
BIFF_DWORD cconditions;
BIFF_DWORD idParent;
......
......@@ -32,7 +32,7 @@ public:
bool fHidden;
bool fCustom;
BIFF_BYTE iCategory;
unsigned char iCategory;
BuiltInStyle builtInData;
LPWideString stName;
XFProps xfProps;
......
......@@ -6,7 +6,10 @@ namespace XLS
Text::Text()
{
is_area = false;
is_area = false;
dlp = false;
iReadingOrder = 0;
icvText = 0xff;
}
......@@ -26,13 +29,13 @@ void Text::writeFields(CFRecord& record)
unsigned short flags1 = 0;
unsigned short flags2 = 0;
SETBIT(flags1, 0, fAutoColor);
SETBIT(flags1, 1, fShowKey);
SETBIT(flags1, 2, fShowValue);
SETBIT(flags1, 4, fAutoText);
SETBIT(flags1, 5, fGenerated);
SETBIT(flags1, 6, fDeleted);
SETBIT(flags1, 7, fAutoMode);
SETBIT(flags1, 0, fAutoColor);
SETBIT(flags1, 1, fShowKey);
SETBIT(flags1, 2, fShowValue);
SETBIT(flags1, 4, fAutoText);
SETBIT(flags1, 5, fGenerated);
SETBIT(flags1, 6, fDeleted);
SETBIT(flags1, 7, fAutoMode);
SETBIT(flags1, 11, fShowLabelAndPerc);
SETBIT(flags1, 12, fShowPercent);
SETBIT(flags1, 13, fShowBubbleSizes);
......@@ -49,24 +52,39 @@ void Text::readFields(CFRecord& record)
{
unsigned short flags1;
unsigned short flags2;
record >> at >> vat >> wBkgMode >> rgbText >> x >> y >> dx >> dy >> flags1 >> icvText >> flags2 >> trot;
record >> at >> vat >> wBkgMode >> rgbText >> x >> y >> dx >> dy >> flags1;
fAutoColor = GETBIT(flags1, 0);
fShowKey = GETBIT(flags1, 1);
fShowValue = GETBIT(flags1, 2);
fAutoText = GETBIT(flags1, 4);
fGenerated = GETBIT(flags1, 5);
fDeleted = GETBIT(flags1, 6);
fAutoMode = GETBIT(flags1, 7);
fShowLabelAndPerc = GETBIT(flags1, 11);
fShowPercent = GETBIT(flags1, 12);
fShowBubbleSizes = GETBIT(flags1, 13);
fShowLabel = GETBIT(flags1, 14);
dlp = static_cast<unsigned char>(GETBITS(flags2, 0, 3));
iReadingOrder = static_cast<unsigned char>(GETBITS(flags2, 14, 15));
rot = trot;
if (record.getGlobalWorkbookInfo()->Version < 0x0600)
{
int orient = GETBITS(flags1, 8, 10);
switch(orient)
{
case 0: trot = 0; break; // Text orientation: not rotated.
case 1: trot = 0xff; break; // Text orientation: vertically stacked.
case 2: trot = 90; break; // Text orientation: 90 deg counterclockwise.
case 3: trot = 270; break; // Text orientation: 90 deg clockwise.
}
}
else
{
record >> icvText >> flags2 >> trot;
//icv -> from Palette
dlp = static_cast<unsigned char>(GETBITS(flags2, 0, 3));
iReadingOrder = static_cast<unsigned char>(GETBITS(flags2, 14, 15));
}
fAutoColor = GETBIT(flags1, 0);
fShowKey = GETBIT(flags1, 1);
fShowValue = GETBIT(flags1, 2);
fAutoText = GETBIT(flags1, 4);
fGenerated = GETBIT(flags1, 5);
fDeleted = GETBIT(flags1, 6);
fAutoMode = GETBIT(flags1, 7);
fShowLabelAndPerc = GETBIT(flags1, 11);
fShowPercent = GETBIT(flags1, 12);
fShowBubbleSizes = GETBIT(flags1, 13);
fShowLabel = GETBIT(flags1, 14);
}
int Text::serialize(std::wostream & _stream)
......
......@@ -25,14 +25,16 @@ public:
int serialize(std::wostream & _stream);
BIFF_BYTE at;
BIFF_BYTE vat;
_UINT16 wBkgMode;
LongRGB rgbText;
BIFF_LONG x;
BIFF_LONG y;
BIFF_LONG dx;
BIFF_LONG dy;
unsigned char at;
unsigned char vat;
_UINT16 wBkgMode;
LongRGB rgbText;
_INT32 x;
_INT32 y;
_INT32 dx;
_INT32 dy;
bool fAutoColor;
bool fShowKey;
......@@ -46,15 +48,13 @@ public:
bool fShowBubbleSizes;
bool fShowLabel;
Icv icvText;
BIFF_BYTE dlp;
BIFF_BYTE iReadingOrder;
_UINT16 trot;
Icv icvText;
unsigned char dlp;
unsigned char iReadingOrder;
_UINT16 trot;
//-----------------------------
bool is_area;
int rot;
};
} // namespace XLS
......
......@@ -39,12 +39,12 @@ public:
GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr;
BIFF_BYTE hAlignment;
BIFF_BYTE vAlignment;
unsigned char hAlignment;
unsigned char vAlignment;
BIFF_BYTE fLockText;
BIFF_BYTE fJustLast;
BIFF_BYTE fSecretEdit;
unsigned char fLockText;
unsigned char fJustLast;
unsigned char fSecretEdit;
_UINT16 rot;
......
......@@ -20,11 +20,11 @@ public:
virtual void store(CFRecord& record);
BIFF_BYTE fDefault;
BIFF_BYTE fHelp;
BIFF_BYTE fCancel;
BIFF_BYTE fDismiss;
_UINT16 accel1;
unsigned char fDefault;
unsigned char fHelp;
unsigned char fCancel;
unsigned char fDismiss;
_UINT16 accel1;
};
} // namespace XLS
......
......@@ -77,10 +77,17 @@ void PtgArea3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool f
std::wstring range_ref = range.toString();
if (ixals == 0xffff)//current sheet
ptg_stack.push(XMLSTUFF::make3dRef(global_info->current_sheet - 1, range_ref, global_info->sheets_names, full_ref));
if (ixals == 0xffff)
{
std::wstring prefix = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, global_info->sheets_names);
if (!prefix.empty()) prefix += L"!";
ptg_stack.push(prefix + range_ref);
}
else
{//external !!
ptg_stack.push(XMLSTUFF::make3dRef(ixals, range_ref, global_info->xti_parsed, full_ref));
}
}
else
{
......
......@@ -77,9 +77,16 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
std::wstring range_ref = cell.toString();
if (ixals == 0xffff)
ptg_stack.push(XMLSTUFF::make3dRef(global_info->current_sheet - 1, range_ref, global_info->sheets_names, full_ref));
{
std::wstring prefix = XMLSTUFF::xti_indexes2sheet_name(itabFirst, itabLast, global_info->sheets_names);
if (!prefix.empty()) prefix += L"!";
ptg_stack.push(prefix + range_ref);
}
else
ptg_stack.push(XMLSTUFF::make3dRef(ixals, range_ref, global_info->xti_parsed, full_ref));
{
ptg_stack.push(XMLSTUFF::make3dRef(ixals, range_ref, global_info->xti_parsed, full_ref)); // from External !
}
}
else
{
......
......@@ -132,16 +132,16 @@ static void serialize_val_prop(std::wostream & stream, const std::wstring & name
{
CP_XML_NODE(name)
{
BIFF_DWORD * dword = dynamic_cast<BIFF_DWORD*>(val.get());
BIFF_DWORD* dword = dynamic_cast<BIFF_DWORD*>(val.get());
if (dword) CP_XML_ATTR(L"val", dword->value());
BIFF_WORD * word = dynamic_cast<BIFF_WORD*>(val.get());
BIFF_WORD* word = dynamic_cast<BIFF_WORD*>(val.get());
if (word) CP_XML_ATTR(L"val", word->value());
BIFF_BYTE *byte_ = dynamic_cast<BIFF_BYTE*>(val.get());
BIFF_BYTE* byte_ = dynamic_cast<BIFF_BYTE*>(val.get());
if (byte_) CP_XML_ATTR(L"val", byte_->value());
LPWideString * str_ = dynamic_cast<LPWideString*>(val.get());
LPWideString* str_ = dynamic_cast<LPWideString*>(val.get());
if (str_) CP_XML_ATTR(L"val", xml::utils::replace_text_to_xml(str_->value()));
}
}
......
......@@ -122,21 +122,41 @@ const bool ATTACHEDLABEL::loadContent(BinProcessor& proc)
int ATTACHEDLABEL::serialize_txPr(std::wostream & _stream)
{
FontX *font = dynamic_cast<FontX*>(m_FontX.get());
FontX *font = dynamic_cast<FontX*>(m_FontX.get());
Text * textProps = dynamic_cast<Text*>(m_TextProperties.get());
if (font == NULL) return 0;
bool rtl = false;
if((textProps) && (textProps->iReadingOrder == (unsigned char)2)) rtl = true;
CP_XML_WRITER(_stream)
{
CP_XML_NODE(L"c:txPr")
{
CP_XML_NODE(L"a:bodyPr");
CP_XML_NODE(L"a:bodyPr")
{
if (textProps)
{
if (textProps->trot == (_UINT16)0xff)
{
CP_XML_ATTR(L"rot", 0);
CP_XML_ATTR(L"vert", L"wordArtVert");
}
else
{
if (textProps->trot > 90) CP_XML_ATTR(L"rot", (textProps->trot - 90) * 60000);
else CP_XML_ATTR(L"rot", -textProps->trot * 60000);
CP_XML_ATTR(L"vert", L"horz");
}
}
}
CP_XML_NODE(L"a:lstStyle");
CP_XML_NODE(L"a:p")
{
CP_XML_NODE(L"a:pPr")
{
serialize_rPr(CP_XML_STREAM(),font->iFont, false, true);
serialize_rPr(CP_XML_STREAM(),font->iFont, rtl, true);
}
CP_XML_NODE(L"a:endParaRPr");
}
......@@ -184,20 +204,18 @@ int ATTACHEDLABEL::serialize(std::wostream & _stream, bool isPosition)
{
if (textProps)
{
//if (textProps->trot != 0)
if (textProps->trot == (_UINT16)0xff)
{
if (textProps->trot == (_UINT16)0xff)
{
CP_XML_ATTR(L"rot", 0);
CP_XML_ATTR(L"vert", L"wordArtVert");
}
else
{
if (textProps->trot > 90) CP_XML_ATTR(L"rot", (textProps->trot - 90) * 60000);
else CP_XML_ATTR(L"rot", -textProps->trot * 60000);
CP_XML_ATTR(L"vert", L"horz");
}
}
CP_XML_ATTR(L"rot", 0);
CP_XML_ATTR(L"vert", L"wordArtVert");
}
else
{
if (textProps->trot > 90) CP_XML_ATTR(L"rot", (textProps->trot - 90) * 60000);
else CP_XML_ATTR(L"rot", -textProps->trot * 60000);
CP_XML_ATTR(L"vert", L"horz");
}
}
}
CP_XML_NODE(L"a:p")
......@@ -290,19 +308,33 @@ int ATTACHEDLABEL::serialize_rPr (std::wostream & _stream, int iFmt, bool rtl, b
Text * text_props = dynamic_cast<Text*>(m_TextProperties.get());
_CP_OPT(_UINT16) color;
_CP_OPT(_UINT16) color;
_CP_OPT(FillInfoExt) color_ext;
if (font)
{
if (text_props)
color = font->icv;
color_ext = font->color_ext;
if ((text_props) && (!text_props->fAutoColor))
{
color = font->icv;
font->icv = text_props->icvText;
if (text_props->icvText != 0xff)
{
font->icv = text_props->icvText; //biff8
}
else
{
font->color_ext.enabled = true;
font->color_ext.xclrType = 2;
font->color_ext.xclrValue = (text_props->rgbText.red << 16) +
(text_props->rgbText.green << 8) + (text_props->rgbText.blue);
}
}
font->serialize_rPr(_stream, rtl, defRPr);
if (color)font->icv = *color;
font->icv = *color;
font->color_ext = *color_ext;
}
return 0;
......
......@@ -195,7 +195,7 @@ int CELL_GROUP::serialize(std::wostream & stream)
CP_XML_ATTR(L"ht", row->miyRw / 20.);
CP_XML_ATTR(L"customHeight", true);
}
if ((row->iOutLevel.value()) && (row->iOutLevel > 0))
if (row->iOutLevel > 0)
{
CP_XML_ATTR(L"outlineLevel", row->iOutLevel);
}
......@@ -277,7 +277,7 @@ int CELL_GROUP::serialize(std::wostream & stream)
CP_XML_ATTR(L"ht", row->miyRw / 20.);
CP_XML_ATTR(L"customHeight", true);
}
if ((row->iOutLevel.value()) && (row->iOutLevel > 0))
if (row->iOutLevel > 0)
{
CP_XML_ATTR(L"outlineLevel", row->iOutLevel);
}
......
......@@ -46,7 +46,7 @@ public:
BaseObjectPtr find_label ( _UINT16 link_id, unsigned short ex);
std::vector<std::pair<int, BaseObjectPtr>> find_labels ( _UINT16 link_id, unsigned short ser);
BaseObjectPtr find_default_text ( _UINT16 link_id);
BaseObjectPtr find_default_text ( _UINT16 link_id);
};
} // namespace XLS
......
......@@ -10,11 +10,13 @@
#include <Logic/Biff_records/End.h>
#include <Logic/Biff_records/SerAuxTrend.h>
#include <Logic/Biff_records/SerAuxErrBar.h>
#include <Logic/Biff_records/AttachedLabel.h>
#include <Logic/Biff_unions/AI.h>
#include <Logic/Biff_unions/SS.h>
#include <Logic/Biff_unions/ATTACHEDLABEL.h>
#include <Logic/Biff_unions/TEXTPROPS.h>
#include <Logic/Biff_unions/CHARTFOMATS.h>
namespace XLS
{
......@@ -225,7 +227,7 @@ int SERIESFORMAT::serialize_legend(std::wostream & _stream, int idx)
return 0;
}
int SERIESFORMAT::serialize_parent(std::wostream & _stream, bool ext)
int SERIESFORMAT::serialize_parent(std::wostream & _stream, CHARTFORMATS* chart_formats, bool ext)
{
if (m_SerParent == NULL)
{
......@@ -233,13 +235,20 @@ int SERIESFORMAT::serialize_parent(std::wostream & _stream, bool ext)
{
SERIESFORMAT * series_ext = dynamic_cast<SERIESFORMAT *>(m_SERIESFORMAT_ext.get());
if (series_ext)
return series_ext->serialize_parent(_stream, true/*, series_id, crt*/);
return series_ext->serialize_parent(_stream, chart_formats, true/*, series_id, crt*/);
}
return 0;
}
SerParent *ser_parent = dynamic_cast<SerParent*>(m_SerParent.get());
SerParent *ser_parent = dynamic_cast<SerParent*>(m_SerParent.get());
if (ser_parent == NULL) return 0;
int id = ser_parent->series;
SS *series_ss = dynamic_cast<SS *>(m_SS.get());
AttachedLabel *att_label = dynamic_cast<AttachedLabel*>(series_ss->m_AttachedLabel.get());
ATTACHEDLABEL *AT_LABEL = dynamic_cast<ATTACHEDLABEL*>(chart_formats->find_label(4, id).get());
CP_XML_WRITER(_stream)
{
SerAuxTrend * trendline = dynamic_cast<SerAuxTrend *>(ser_parent->m_SerAuxTrend.get());
......@@ -249,7 +258,16 @@ int SERIESFORMAT::serialize_parent(std::wostream & _stream, bool ext)
{
CP_XML_NODE(L"c:trendline")
{
//<c:spPr><a:ln w="25400"><a:solidFill><a:srgbClr val="000000"/></a:solidFill><a:prstDash val="solid"/></a:ln></c:spPr>
if (series_ss)
{
series_ss->serialize(CP_XML_STREAM(), CHART_TYPE_Bar);
// .. fill - - ""
}
//CP_XML_NODE(L"c:spPr")
//{
//<a:ln w="25400"><a:solidFill><a:srgbClr val="000000"/></a:solidFill><a:prstDash val="solid"/></a:ln>
//}
CP_XML_NODE(L"c:trendlineType")
{
switch(trendline->regt)
......@@ -271,6 +289,25 @@ int SERIESFORMAT::serialize_parent(std::wostream & _stream, bool ext)
{
CP_XML_ATTR (L"val" , (bool)trendline->fEquation);
}
if ((AT_LABEL) && ((AT_LABEL->m_FRAME) || (AT_LABEL->m_FontX)))
{
CP_XML_NODE(L"c:trendlineLbl")
{
//CP_XML_NODE(L"c:layout")
//{
//}
//CP_XML_NODE(L"c:numFmt")
//{
//}
if (AT_LABEL->m_FRAME)
AT_LABEL->m_FRAME->serialize(CP_XML_STREAM());
if (AT_LABEL->m_FontX)
AT_LABEL->serialize_txPr(CP_XML_STREAM());
}
}
}
}
......
......@@ -5,6 +5,7 @@
namespace XLS
{
class CHARTFORMATS;
// Logical representation of SERIESFORMAT union of records
class SERIESFORMAT: public CompositeObject
......@@ -21,7 +22,7 @@ public:
static const ElementType type = typeSERIESFORMAT;
int serialize_legend(std::wostream & _stream, int idx);
int serialize_parent(std::wostream & _stream, bool ext = false);
int serialize_parent(std::wostream & _stream, CHARTFORMATS* chart_formats, bool ext = false);
BaseObjectPtr m_SS;
std::vector<BaseObjectPtr> m_arPtSS;
......
......@@ -289,7 +289,6 @@ int SS::serialize_default(std::wostream & _stream, int series_type, int ind )
int SS::serialize(std::wostream & _stream, int series_type, int indPt)
{
DataFormat *series_data_format = dynamic_cast<DataFormat *>(m_DataFormat.get());
SerFmt *series_format = dynamic_cast<SerFmt *> (m_SerFmt.get());
......
......@@ -289,6 +289,8 @@ void ChartSheetSubstream::recalc(CHARTFORMATS* charts)
continue;
}
iCrt = serCrt->id;
if (iCrt > parent0->m_arCRT.size() && iCrt < 0)
continue;
CRT * crt = dynamic_cast<CRT*>(parent0->m_arCRT[iCrt].get());
......@@ -664,7 +666,7 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream)
serialize_ser(L"c:val", CP_XML_STREAM(), series_id, series->m_arAI[1], ser->sdtY, ser->cValy);
}
//-----------------------------------------------------------------------------------------------------------------------------------------
series->serialize_parent(CP_XML_STREAM());
series->serialize_parent(CP_XML_STREAM(), chart_formats);
//-----------------------------------------------------------------------------------------------------------------------------------------
std::wstringstream stream_dLbls;
serialize_dLbls(stream_dLbls, it->second[i], crt);
......@@ -858,10 +860,11 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT *
CP_XML_WRITER(_stream)
{
Text * text = NULL;
AttachedLabel * att_label = dynamic_cast<AttachedLabel*>(series_ss->m_AttachedLabel.get());
ATTACHEDLABEL* AT_LABEL = dynamic_cast<ATTACHEDLABEL*>(chart_formats->find_label(4, id).get());
if (AT_LABEL) text = dynamic_cast<Text*> (AT_LABEL->m_TextProperties.get());
Text * text = NULL;
AttachedLabel * att_label = dynamic_cast<AttachedLabel*>(series_ss->m_AttachedLabel.get());
ATTACHEDLABEL * AT_LABEL = dynamic_cast<ATTACHEDLABEL*>(chart_formats->find_label(4, id).get());
if (AT_LABEL) text = dynamic_cast<Text*> (AT_LABEL->m_TextProperties.get());
if (att_label)
{
......
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