diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.cpp index 5ee44b4a57..56d1f05e36 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.cpp @@ -32,7 +32,9 @@ void AreaFormat::writeFields(CFRecord& record) void AreaFormat::readFields(CFRecord& record) { unsigned short flags; + record >> rgbFore >> rgbBack >> fls >> flags >> icvFore >> icvBack; + fAuto = GETBIT(flags, 0); fInvertNeg = GETBIT(flags, 1); } @@ -41,11 +43,18 @@ int AreaFormat::serialize(std::wostream & _stream) { CP_XML_WRITER(_stream) { - CP_XML_NODE(L"a:solidFill") + if (fls == (_UINT16)0) { - CP_XML_NODE(L"a:srgbClr") + CP_XML_NODE(L"a:noFill"); + } + else + { + CP_XML_NODE(L"a:solidFill") { - CP_XML_ATTR(L"val", rgbFore.strRGB); + CP_XML_NODE(L"a:srgbClr") + { + CP_XML_ATTR(L"val", rgbFore.strRGB); + } } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.cpp index 5231421b74..766823e28d 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.cpp @@ -49,21 +49,21 @@ int BopPop::serialize(std::wostream & _stream) { CP_XML_ATTR (L"val", pcGap); } - CP_XML_NODE(L"c:splitType") - { - switch(split) - { - case 0: CP_XML_ATTR (L"val" , L"pos"); break; - case 1: CP_XML_ATTR (L"val" , L"val"); break; - case 2: CP_XML_ATTR (L"val" , L"percent"); break; - case 3: CP_XML_ATTR (L"val" , L"cust"); break; - default: - CP_XML_ATTR (L"val" , L"auto"); break; - } - } if (fAutoSplit == (unsigned char)0) { + CP_XML_NODE(L"c:splitType") + { + switch(split) + { + case 0: CP_XML_ATTR (L"val" , L"pos"); break; + case 1: CP_XML_ATTR (L"val" , L"val"); break; + case 2: CP_XML_ATTR (L"val" , L"percent"); break; + case 3: CP_XML_ATTR (L"val" , L"cust"); break; + default: + CP_XML_ATTR (L"val" , L"auto"); break; + } + } CP_XML_NODE(L"c:splitPos") { CP_XML_ATTR (L"val", iSplitPos); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.cpp index e85aa4fdae..a8ac0a180b 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.cpp @@ -37,7 +37,7 @@ int Chart3DBarShape::serialize(std::wostream & _stream) { CP_XML_NODE(L"c:shape") { - if (taper >=0 && taper < 3 && riser == (unsigned char)0) + if (riser == (unsigned char)0) { switch(taper) { @@ -47,7 +47,14 @@ int Chart3DBarShape::serialize(std::wostream & _stream) } } else - CP_XML_ATTR(L"val", L"cylinder"); + { + switch(taper) + { + case 0: CP_XML_ATTR(L"val", L"cylinder"); break; + case 1: CP_XML_ATTR(L"val", L"cone"); break; + case 2: CP_XML_ATTR(L"val", L"coneToMax");break; + } + } } } return 0; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLayout12.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLayout12.h index 5eed270089..bf98362435 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLayout12.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLayout12.h @@ -25,29 +25,16 @@ public: //----------------------------- BIFF_DWORD dwCheckSum; BIFF_BYTE autolayouttype; + CrtLayout12Mode wXMode; CrtLayout12Mode wYMode; CrtLayout12Mode wWidthMode; CrtLayout12Mode wHeightMode; + BIFF_DOUBLE x; BIFF_DOUBLE y; BIFF_DOUBLE dx; BIFF_DOUBLE dy; - -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(dwCheckSum) - //BO_ATTRIB_MARKUP_ATTRIB(autolayouttype) - //BO_ATTRIB_MARKUP_ATTRIB(wXMode) - //BO_ATTRIB_MARKUP_ATTRIB(wYMode) - //BO_ATTRIB_MARKUP_ATTRIB(wWidthMode) - //BO_ATTRIB_MARKUP_ATTRIB(wHeightMode) - //BO_ATTRIB_MARKUP_ATTRIB(x) - //BO_ATTRIB_MARKUP_ATTRIB(y) - //BO_ATTRIB_MARKUP_ATTRIB(dx) - //BO_ATTRIB_MARKUP_ATTRIB(dy) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.cpp index 32276f36eb..f1e812d717 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.cpp @@ -37,10 +37,10 @@ int CrtLine::serialize(std::wostream & _stream) std::wstring sNode; switch (id) { - case 0: sNode = L"c:dropLines"; break; //m_iChartType == 2 || m_iChartType == 3 (line & area & stock) - case 1: sNode = L"c:hiLowLines"; break; // m_iChartType == 2, 11 (line & stock) - case 2: sNode = L"c:serLines"; break; // m_iChartType == 1 || m_iChartType == 8 (bar & ofPie) - case 3: sNode = L"c:leaderLines"; break; // m_iChartType == 3 (pie) + case 0: sNode = L"c:dropLines"; break; // m_iChartType == CHART_TYPE_Line , CHART_TYPE_Area, CHART_TYPE_Stock + case 1: sNode = L"c:hiLowLines"; break; // m_iChartType == CHART_TYPE_Line, CHART_TYPE_Stock + case 2: sNode = L"c:serLines"; break; // m_iChartType == CHART_TYPE_Bar || m_iChartType == CHART_TYPE_BopPop + case 3: sNode = L"c:leaderLines"; break; // m_iChartType == CHART_TYPE_Pie } if (sNode.empty()) return 0; @@ -74,7 +74,7 @@ int CrtLine::serialize(std::wostream & _stream) } } - if (m_iChartType == 2) + if (m_iChartType == /*CHART_TYPE_Line*/2) { CP_XML_NODE(L"c:marker") { CP_XML_ATTR (L"val" , L"1"); } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Frame.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Frame.cpp index 302a5e446b..c3664de1b0 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Frame.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Frame.cpp @@ -25,6 +25,7 @@ void Frame::writeFields(CFRecord& record) unsigned short flags = 0; SETBIT(flags, 0, fAutoSize); SETBIT(flags, 1, fAutoPosition); + record << frt << flags; } @@ -33,6 +34,7 @@ void Frame::readFields(CFRecord& record) { unsigned short flags; record >> frt >> flags; + fAutoSize = GETBIT(flags, 0); fAutoPosition = GETBIT(flags, 1); } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.cpp index f8870ff586..3713f0fa4f 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.cpp @@ -107,10 +107,11 @@ int Legend::serialize(std::wostream & _stream, int size) if (fAutoPosX == false) CP_XML_NODE(L"c:x") {CP_XML_ATTR(L"val", x / 4000.);} if (fAutoPosY == false) CP_XML_NODE(L"c:y") {CP_XML_ATTR(L"val", y / 4000.);} - if (fAutoPosX == false) CP_XML_NODE(L"c:w") {CP_XML_ATTR(L"val", (dx )/ 4000.);} - if (fAutoPosY == false) CP_XML_NODE(L"c:h") {CP_XML_ATTR(L"val", (dy )/ 4000.);} + if (fAutoPosX == false) CP_XML_NODE(L"c:w") {CP_XML_ATTR(L"val", (dx )/ 4000. + 0.01);} + if (fAutoPosY == false) CP_XML_NODE(L"c:h") {CP_XML_ATTR(L"val", (dy )/ 4000. + 0.01);} } } + CP_XML_NODE(L"c:overlay") {CP_XML_ATTR(L"val", 0);} } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.cpp index 7c85055072..7818636bc8 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.cpp @@ -23,9 +23,11 @@ BaseObjectPtr LineFormat::clone() void LineFormat::writeFields(CFRecord& record) { unsigned short flags = 0; + SETBIT(flags, 0, fAuto); SETBIT(flags, 2, fAxisOn); SETBIT(flags, 3, fAutoCo); + record << rgb << lns << we << flags << icv; } @@ -42,44 +44,49 @@ void LineFormat::readFields(CFRecord& record) int LineFormat::serialize(std::wostream & _stream) { - if ( lns == (_UINT16) 5 ) return 0; //none - CP_XML_WRITER(_stream) { CP_XML_NODE(L"a:ln") { switch(we) { - case 0xFFFF: CP_XML_ATTR(L"w", 3175); break; //Hairline - case 0: CP_XML_ATTR(L"w", 12700); break; //single - case 1: CP_XML_ATTR(L"w", 25400); break; //double - case 2: CP_XML_ATTR(L"w", 38100); break; //triple + case 0xFFFF: CP_XML_ATTR(L"w", 3175); break; //Hairline + case 0: CP_XML_ATTR(L"w", 12700); break; //single + case 1: CP_XML_ATTR(L"w", 25400); break; //double + case 2: CP_XML_ATTR(L"w", 38100); break; //triple } - CP_XML_NODE(L"a:solidFill") + if (lns == (_UINT16) 5) { - CP_XML_NODE(L"a:srgbClr") - { - CP_XML_ATTR(L"val", rgb.strRGB); - } + CP_XML_NODE(L"a:noFill"); } + else + { + CP_XML_NODE(L"a:solidFill") + { + CP_XML_NODE(L"a:srgbClr") + { + CP_XML_ATTR(L"val", rgb.strRGB); + } + } - CP_XML_NODE(L"a:prstDash") - { + CP_XML_NODE(L"a:prstDash") + { + switch(lns) + { + case 1: CP_XML_ATTR(L"val", L"dash"); break; //Dash + case 2: CP_XML_ATTR(L"val", L"dot"); break; //Dot + case 3: CP_XML_ATTR(L"val", L"dashDot"); break; //Dash-dot + case 4: CP_XML_ATTR(L"val", L"sysDashDotDot"); break; //Dash dot-dot + case 0: + default:CP_XML_ATTR(L"val", L"solid"); break; //Solid + } + } switch(lns) { - case 1: CP_XML_ATTR(L"val", L"dash"); break; //Dash - case 2: CP_XML_ATTR(L"val", L"dot"); break; //Dot - case 3: CP_XML_ATTR(L"val", L"dashDot"); break; //Dash-dot - case 4: CP_XML_ATTR(L"val", L"sysDashDotDot"); break; //Dash dot-dot - case 0: - default:CP_XML_ATTR(L"val", L"solid"); break; //Solid + case 6: break; //Dark gray pattern + case 7: break; //Medium gray pattern + case 8: break; //Light gray patternn } - } - switch(lns) - { - case 6: break; //Dark gray pattern - case 7: break; //Medium gray pattern - case 8: break; //Light gray patternn } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.cpp index fca63f9b33..e21157dbf5 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.cpp @@ -1,5 +1,7 @@ #include "Pos.h" +#include "Frame.h" + #include namespace XLS @@ -53,6 +55,16 @@ void Pos::readFields(CFRecord& record) int Pos::serialize(std::wostream & _stream) { + bool bPosition = true; + bool bSize = true; + + if (m_Frame) + { + Frame* Frame_ = dynamic_cast(m_Frame.get()); + + bPosition = !Frame_->fAutoPosition; + bSize = !Frame_->fAutoSize; + } double x = x1 / 4000.; double y = y1 / 4000.; @@ -63,25 +75,32 @@ int Pos::serialize(std::wostream & _stream) { CP_XML_NODE(L"c:layout") { - CP_XML_NODE(L"c:manualLayout") + if (bPosition || bSize) { - if (m_iLinkObject == 1) x += 0.5 + (w > 0 ? w : 0); - if (m_iLinkObject == 2) x += 0.5 + (w > 0 ? w : 0); - if (m_iLinkObject == 3) y += 0 + (h > 0 ? h : 0); - - CP_XML_NODE(L"c:xMode") {CP_XML_ATTR(L"val", L"edge");} - CP_XML_NODE(L"c:yMode") {CP_XML_ATTR(L"val", L"edge");} - - if (x < 0) x = 0; - if (y < 0) y = 0; - - CP_XML_NODE(L"c:x") {CP_XML_ATTR(L"val", x);} - CP_XML_NODE(L"c:y") {CP_XML_ATTR(L"val", y);} - - if (m_iLinkObject != 1 && m_iLinkObject != 2 && m_iLinkObject != 3) //title, axis title vert, axis title horiz + CP_XML_NODE(L"c:manualLayout") { - if (w > 0) CP_XML_NODE(L"c:w") {CP_XML_ATTR(L"val", w);} - if (h > 0) CP_XML_NODE(L"c:h") {CP_XML_ATTR(L"val", h);} + if (m_iLinkObject == 1) x += 0.5 + (w > 0 ? w : 0); + if (m_iLinkObject == 2) x += 0.5 + (w > 0 ? w : 0); + if (m_iLinkObject == 3) y += 0 + (h > 0 ? h : 0); + + CP_XML_NODE(L"c:xMode") {CP_XML_ATTR(L"val", L"edge");} + CP_XML_NODE(L"c:yMode") {CP_XML_ATTR(L"val", L"edge");} + + //if (x < 0) x = 0; + //if (y < 0) y = 0; + + if (bPosition) + { + if (x >= 0 && x < 1) CP_XML_NODE(L"c:x") {CP_XML_ATTR(L"val", x);} + if (y >= 0 && y < 1) CP_XML_NODE(L"c:y") {CP_XML_ATTR(L"val", y);} + } + + if (bSize && m_iLinkObject != 1 && m_iLinkObject != 2 && m_iLinkObject != 3) + //title, axis title vert, axis title horiz + { + if (w > 0 && w < 1) CP_XML_NODE(L"c:w") {CP_XML_ATTR(L"val", w);} + if (h > 0 && h < 1) CP_XML_NODE(L"c:h") {CP_XML_ATTR(L"val", h);} + } } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.h index bf50c5a163..b5a2a7989a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.h @@ -36,7 +36,8 @@ public: //----------------------------- - short m_iLinkObject; + short m_iLinkObject; + BaseObjectPtr m_Frame; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ShtProps.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ShtProps.cpp index 38a340f383..e0bcb2094a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ShtProps.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ShtProps.cpp @@ -42,6 +42,7 @@ void ShtProps::readFields(CFRecord& record) fManSerAlloc = GETBIT(flags, 0); fPlotVisOnly = GETBIT(flags, 1); fNotSizeWith = GETBIT(flags, 2); + fManPlotArea = GETBIT(flags, 3); fAlwaysAutoPlotArea = GETBIT(flags, 4); record.skipNunBytes(1); // reserved2 diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ShtProps.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ShtProps.h index c4b38dba53..0b94cdb9b2 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ShtProps.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ShtProps.h @@ -24,6 +24,7 @@ public: //----------------------------- BIFF_BOOL fManSerAlloc; + BIFF_BOOL fManPlotArea; BIFF_BOOL fPlotVisOnly; BIFF_BOOL fNotSizeWith; BIFF_BOOL fAlwaysAutoPlotArea; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Text.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Text.h index 340775b053..17b68a5dca 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Text.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Text.h @@ -49,7 +49,7 @@ public: Icv icvText; BIFF_BYTE dlp; BIFF_BYTE iReadingOrder; - BIFF_WORD trot; + _UINT16 trot; //----------------------------- bool is_area; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/ATTACHEDLABEL.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/ATTACHEDLABEL.h index 6a951bc011..a2e234a5ee 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/ATTACHEDLABEL.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/ATTACHEDLABEL.h @@ -19,7 +19,7 @@ public: virtual const bool loadContent (BinProcessor& proc); int serialize (std::wostream & _stream); - int serialize (std::wostream & _stream, bool position = true); + int serialize (std::wostream & _stream, bool position); int serialize_rPr (std::wostream & _stream, int iFmt, bool rtl = false, bool defRPr = false); int serialize_txPr (std::wostream & _stream); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/ATTACHEDLABEL_bu.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/ATTACHEDLABEL_bu.cpp index 75e616460a..158be59076 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/ATTACHEDLABEL_bu.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/ATTACHEDLABEL_bu.cpp @@ -164,6 +164,14 @@ int ATTACHEDLABEL::serialize(std::wostream & _stream, bool isPosition) bool rtl = false; if((textProps) && (textProps->iReadingOrder == (unsigned char)2)) rtl = true; + FRAME *FRAME_ = dynamic_cast (m_FRAME.get()); + Pos *Pos_ = dynamic_cast (m_Pos.get()); + + if (FRAME_ && Pos_) + { + Pos_->m_Frame = FRAME_->m_Frame; + } + CP_XML_WRITER(_stream) { if (seriesText) @@ -176,9 +184,13 @@ int ATTACHEDLABEL::serialize(std::wostream & _stream, bool isPosition) { if (textProps) { - if (textProps->trot != 0) + //if (textProps->trot != 0) { - if (textProps->trot == (_UINT16)0xffff) CP_XML_ATTR(L"vert", L"vert"); + 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); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AXES.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AXES.cpp index 4e90d03699..e0664d7415 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AXES.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/AXES.cpp @@ -235,7 +235,7 @@ int AXES::serialize(std::wostream & _stream, bool secondary) { ATTACHEDLABEL *label = dynamic_cast (m_arATTACHEDLABEL[i].get() ); - label->serialize(CP_XML_STREAM(), false); + label->serialize(CP_XML_STREAM()); } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/CRT.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/CRT.cpp index 2b4c269eb0..5595c77d63 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/CRT.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/CRT.cpp @@ -241,18 +241,19 @@ const bool CRT::loadContent(BinProcessor& proc) m_bIs3D = true; } - m_iChartType = 1; + m_iChartType = CHART_TYPE_Bar; + switch(m_ChartType->get_type()) { - case typeBar: m_iChartType = 1; break; - case typeLine: m_iChartType = 2; break; - case typePie: m_iChartType = 3; break; - case typeArea: m_iChartType = 4; break; - case typeSurf: m_iChartType = 5; break; - case typeRadar: m_iChartType = 6; break; - case typeRadarArea: m_iChartType = 7; break; - case typeBopPop: m_iChartType = 8; break; - case typeScatter: m_iChartType = 9; break; + case typeBar: m_iChartType = CHART_TYPE_Bar; break; + case typeLine: m_iChartType = CHART_TYPE_Line; break; + case typePie: m_iChartType = CHART_TYPE_Pie; break; + case typeArea: m_iChartType = CHART_TYPE_Area; break; + case typeSurf: m_iChartType = CHART_TYPE_Surf; break; + case typeRadar: m_iChartType = CHART_TYPE_Radar; break; + case typeRadarArea: m_iChartType = CHART_TYPE_RadarArea; break; + case typeBopPop: m_iChartType = CHART_TYPE_BopPop; break; + case typeScatter: m_iChartType = CHART_TYPE_Scatter; break; } return true; @@ -277,7 +278,7 @@ std::wstring CRT::getOoxChartType() if ((dropBar) && (dropBar->pcGap != (short)1)) { - m_iChartType = 11; + m_iChartType = CHART_TYPE_Stock; return L"c:stockChart"; } } @@ -288,7 +289,7 @@ std::wstring CRT::getOoxChartType() Pie * p = dynamic_cast(m_ChartType.get()); if (p->pcDonut.value() && p->pcDonut > 0) { - m_iChartType = 12; + m_iChartType = CHART_TYPE_Doughnut; return L"c:doughnutChart"; } else return (m_bIs3D ? L"c:pie3DChart" : L"c:pieChart"); @@ -307,10 +308,10 @@ std::wstring CRT::getOoxChartType() Scatter * sc = dynamic_cast(m_ChartType.get()); if ((sc->fBubbles.value()) && (sc->fBubbles)) { - m_iChartType = 10; + m_iChartType = CHART_TYPE_Bubble; return L"c:bubbleChart"; } - else return L"c:scatterChart"; + else return L"c:scatterChart"; }break; case typeRadar: return L"c:radarChart"; case typeRadarArea: return L"c:radarChart"; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FRAME_bu.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FRAME_bu.cpp index 3fa1646f57..3c40884c4a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FRAME_bu.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FRAME_bu.cpp @@ -73,15 +73,29 @@ const bool FRAME::loadContent(BinProcessor& proc) int FRAME::serialize(std::wostream & _stream) { + AreaFormat * area = dynamic_cast(m_AreaFormat.get()); + LineFormat * line = dynamic_cast(m_LineFormat.get()); + + bool bArea = m_GELFRAME ? true : false; + if (!bArea && (area) && (area->fAuto == false)) bArea = true; + + bool bLine = false; + if ((line) && (line->fAuto == false)) bLine = true; + + if (!bArea && !bLine) return 0; + CP_XML_WRITER(_stream) { CP_XML_NODE(L"c:spPr") { - if (m_GELFRAME) - m_GELFRAME->serialize(CP_XML_STREAM()); - else if (m_AreaFormat) m_AreaFormat->serialize(CP_XML_STREAM()); + if (bArea) + { + if (m_GELFRAME) + m_GELFRAME->serialize(CP_XML_STREAM()); + else if (m_AreaFormat) m_AreaFormat->serialize(CP_XML_STREAM()); + } - if (m_LineFormat) m_LineFormat->serialize(CP_XML_STREAM()); + if (m_LineFormat && bLine) m_LineFormat->serialize(CP_XML_STREAM()); } } return 0; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.cpp index 129db99a71..8cfeecd723 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.cpp @@ -194,25 +194,27 @@ int SS::serialize_default(std::wostream & _stream, int series_type, int ind ) { } } - //if (m_MarkerFormat && series_type != 10) + //if (m_MarkerFormat && series_type != CHART_TYPE_Bubble) // m_MarkerFormat->serialize(_stream); //else //{ // //генерация (series_data_format->iss) // //todooo //} - if (m_PieFormat && (series_type == 12 || series_type == 8 || series_type == 3)) + if (m_PieFormat && (series_type == CHART_TYPE_Doughnut || + series_type == CHART_TYPE_BopPop || + series_type == CHART_TYPE_Pie)) { m_PieFormat->serialize(_stream); } - if (m_Chart3DBarShape && series_type == 1 && m_is3D) + if (m_Chart3DBarShape && series_type == CHART_TYPE_Bar && m_is3D) { m_Chart3DBarShape->serialize(_stream); } if (series_format) { - if (series_type == 2 || series_type == 6 || series_type == 9) + if (series_type == CHART_TYPE_Line || series_type == CHART_TYPE_Radar || series_type == CHART_TYPE_Scatter) { CP_XML_NODE(L"c:smooth") { @@ -253,7 +255,9 @@ int SS::serialize(std::wostream & _stream, int series_type, int indPt) { CP_XML_NODE(L"c:spPr") { - if ((series_type != 2 && series_type != 9 && series_type != 11) || m_is3D == true ) //line & scatter & stock + if (m_is3D == true || ( series_type != CHART_TYPE_Line && + series_type != CHART_TYPE_Scatter && + series_type != CHART_TYPE_Stock)) { if (m_GELFRAME && bArea) { @@ -285,13 +289,14 @@ int SS::serialize(std::wostream & _stream, int series_type, int indPt) else { //генерация (automatic) - if ( series_type != 2 || m_is3D == true ) //line & !3dLine + if ( series_type != CHART_TYPE_Line || m_is3D == true ) //line & !3dLine ind = 31; //black CP_XML_NODE(L"a:ln") { CP_XML_ATTR(L"w", 12700);//single - if (series_type == 9 || series_type == 11) //points only - todooo сделать дефолтовые точки ala 95 стиль & stork + if (series_type == CHART_TYPE_Scatter || series_type == CHART_TYPE_Stock) + //points only - todooo сделать дефолтовые точки ala 95 стиль & stork { CP_XML_NODE(L"a:noFill"); } @@ -313,12 +318,16 @@ int SS::serialize(std::wostream & _stream, int series_type, int indPt) } } } - if (m_PieFormat && (series_type == 12 || series_type == 8 || series_type == 3)) + if (m_PieFormat && (series_type == CHART_TYPE_Doughnut || + series_type == CHART_TYPE_BopPop || + series_type == CHART_TYPE_Pie)) m_PieFormat->serialize(_stream); - if (m_MarkerFormat && series_type != 10 && series_type != 1) + if (m_MarkerFormat && series_type != CHART_TYPE_Bubble && + series_type != CHART_TYPE_Bar && + series_type != CHART_TYPE_BopPop ) m_MarkerFormat->serialize(_stream); - else if (/*series_type == 2 ||*/ series_type == 9) + else if (/*series_type == CHART_TYPE_Line ||*/ series_type == CHART_TYPE_Scatter) { CP_XML_NODE(L"c:marker"); } @@ -336,12 +345,12 @@ int SS::serialize2(std::wostream & _stream, int series_type) CP_XML_WRITER(_stream) { - if (m_Chart3DBarShape && series_type == 1 && m_is3D) + if (m_Chart3DBarShape && series_type == CHART_TYPE_Bar && m_is3D) { m_Chart3DBarShape->serialize(_stream); } - if (series_type == 10) + if (series_type == CHART_TYPE_Bubble) { if ((series_format) && (series_format->f3DBubbles == true)) { @@ -349,7 +358,9 @@ int SS::serialize2(std::wostream & _stream, int series_type) } } - if ((series_type == 2 || series_type == 6 || series_type == 9) && m_isAutoLine == false) + if (m_isAutoLine == false && ( series_type == CHART_TYPE_Line || + series_type == CHART_TYPE_Radar || + series_type == CHART_TYPE_Scatter)) { if (series_format) { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.h index 74d07af6d4..0628c0cdf0 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SS.h @@ -2,6 +2,19 @@ #include +#define CHART_TYPE_Bar 1 +#define CHART_TYPE_Line 2 +#define CHART_TYPE_Pie 3 +#define CHART_TYPE_Area 4 +#define CHART_TYPE_Surf 5 +#define CHART_TYPE_Radar 6 +#define CHART_TYPE_RadarArea 7 +#define CHART_TYPE_BopPop 8 +#define CHART_TYPE_Scatter 9 +#define CHART_TYPE_Bubble 10 +#define CHART_TYPE_Stock 11 +#define CHART_TYPE_Doughnut 12 + namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/ChartSheetSubstream.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/ChartSheetSubstream.cpp index 93deab927a..62e88770d3 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/ChartSheetSubstream.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/ChartSheetSubstream.cpp @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -442,8 +443,8 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) { CP_XML_NODE(L"c:plotArea") { - BaseObjectPtr PlotAreaFrame; - BaseObjectPtr PlotAreaPos; + FRAME *PlotAreaFRAME = NULL; + Pos *PlotAreaPos = NULL; for (int i = 0; i < chart_formats->m_arAXISPARENT.size(); i++) { @@ -453,13 +454,21 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) if (((bool)ax_parent->iax == false) && axes) //primary axes { - PlotAreaFrame = axes->m_PlotArea_FRAME; - PlotAreaPos = parent->m_Pos; + PlotAreaFRAME = dynamic_cast (axes->m_PlotArea_FRAME.get()); + PlotAreaPos = dynamic_cast (parent->m_Pos.get()); + + if (PlotAreaFRAME && PlotAreaPos) + { + PlotAreaPos->m_Frame = PlotAreaFRAME->m_Frame; + } } } if (PlotAreaPos && (sht_props) && (sht_props->fAlwaysAutoPlotArea != false)) + { + PlotAreaPos->serialize(CP_XML_STREAM()); + } for (std::map>::iterator it = m_mapTypeChart.begin(); it != m_mapTypeChart.end(); it++) { @@ -471,7 +480,8 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) CP_XML_NODE(crt->getOoxChartType()) { crt->m_ChartType->serialize_attribute( CP_GET_XML_NODE()); - if (crt->m_iChartType != 11) + + if (crt->m_iChartType != CHART_TYPE_Stock) crt->m_ChartType->serialize(CP_XML_STREAM()); format->serialize(CP_XML_STREAM()); @@ -486,8 +496,11 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) series_ss->apply_crt_ss(crt->m_SS); series_ss->m_is3D = crt->m_bIs3D; - if (crt->m_iChartType == 3 || crt->m_iChartType == 8 || crt->m_iChartType == 12 || crt->m_iChartType == 5) - series_ss->m_isVaried = format->fVaried; + if (crt->m_iChartType == CHART_TYPE_Pie || + crt->m_iChartType == CHART_TYPE_BopPop || + crt->m_iChartType == CHART_TYPE_Doughnut || + crt->m_iChartType == CHART_TYPE_Surf ) + series_ss->m_isVaried = format->fVaried; DataFormat * series_data_format = dynamic_cast(series_ss->m_DataFormat.get()); int series_id = series_data_format->iss; @@ -505,12 +518,13 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) serialize_dPt(CP_XML_STREAM(), it->second[i], crt, std::max(ser->cValx, ser->cValy));//+bubbles - if (crt->m_iChartType == 9 || crt->m_iChartType == 10)//scatter & bubble + if (crt->m_iChartType == CHART_TYPE_Scatter || + crt->m_iChartType == CHART_TYPE_Bubble) { serialize_ser(L"c:xVal", CP_XML_STREAM(), series_id, series->m_arAI[2], ser->sdtX, ser->cValx); serialize_ser(L"c:yVal", CP_XML_STREAM(), series_id, series->m_arAI[1], ser->sdtY, ser->cValy); - if (crt->m_iChartType == 10) + if (crt->m_iChartType == CHART_TYPE_Bubble) serialize_ser(L"c:bubbleSize", CP_XML_STREAM(), series_id, series->m_arAI[3], ser->sdtBSize, ser->cValBSize); } else @@ -588,8 +602,8 @@ int ChartSheetSubstream::serialize_plot_area (std::wostream & _stream) axes->serialize(CP_XML_STREAM(), secondary); } - if (PlotAreaFrame) - PlotAreaFrame->serialize(CP_XML_STREAM()); + if (PlotAreaFRAME) + PlotAreaFRAME->serialize(CP_XML_STREAM()); } serialize_legend (_stream, stream_legend_entries.str()); @@ -620,8 +634,11 @@ int ChartSheetSubstream::serialize_dPt(std::wostream & _stream, int id, CRT *crt series_ss->m_is3D = crt->m_bIs3D; - if (crt->m_iChartType == 3 || crt->m_iChartType == 8 || crt->m_iChartType == 12 || crt->m_iChartType == 5) - series_ss->m_isVaried = format->fVaried; + if (crt->m_iChartType == CHART_TYPE_Pie || + crt->m_iChartType == CHART_TYPE_BopPop || + crt->m_iChartType == CHART_TYPE_Doughnut || + crt->m_iChartType == CHART_TYPE_Surf ) + series_ss->m_isVaried = format->fVaried; CP_XML_NODE(L"c:idx") { @@ -636,8 +653,11 @@ int ChartSheetSubstream::serialize_dPt(std::wostream & _stream, int id, CRT *crt } bool varied = false; - if (crt->m_iChartType == 3 || crt->m_iChartType == 8 || crt->m_iChartType == 12 || crt->m_iChartType == 5) - varied = format->fVaried; + if (crt->m_iChartType == CHART_TYPE_Pie || + crt->m_iChartType == CHART_TYPE_BopPop || + crt->m_iChartType == CHART_TYPE_Doughnut || + crt->m_iChartType == CHART_TYPE_Surf ) + varied = format->fVaried; if (varied && present_idx.size() < count_point) { @@ -673,7 +693,7 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT * SS *series_ss = dynamic_cast(series->m_SS.get()); DataFormat *series_df = dynamic_cast(series_ss->m_DataFormat.get()); - bool is_area = (crt->m_iChartType == 4 || crt->m_iChartType == 7); + bool is_area = (crt->m_iChartType == CHART_TYPE_Area || crt->m_iChartType == CHART_TYPE_RadarArea); int series_id = series_df->iss; std::vector> labels = chart_formats->find_labels ( 4, id); @@ -683,39 +703,30 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT * CP_XML_WRITER(_stream) { + Text * text = NULL; AttachedLabel * att_label = dynamic_cast(series_ss->m_AttachedLabel.get()); + ATTACHEDLABEL* AT_LABEL = dynamic_cast(chart_formats->find_label(4, id).get()); + if (AT_LABEL) text = dynamic_cast (AT_LABEL->m_TextProperties.get()); + if (att_label) { att_label->is_area = is_area; series_ss->m_AttachedLabel->serialize(_stream); add_labels = true; } - else - { - Text * text = NULL; - ATTACHEDLABEL* AT_LABEL = dynamic_cast(chart_formats->find_label(4, id).get()); - if (AT_LABEL) + else + { + if ((AT_LABEL) && (AT_LABEL->m_FRAME)) { - text = dynamic_cast (AT_LABEL->m_TextProperties.get()); - - if (AT_LABEL->m_FRAME) - { - AT_LABEL->m_FRAME->serialize(_stream); - add_labels = true; - } - - if (text) - { - CP_XML_NODE(L"c:showLegendKey") {CP_XML_ATTR(L"val", text->fShowKey);} - need_add_labels = true; - } - } + AT_LABEL->m_FRAME->serialize(_stream); + add_labels = true; + } DataLabExtContents * data_ext_cont = NULL; if (!data_ext_cont && AT_LABEL) data_ext_cont = dynamic_cast(AT_LABEL->m_DataLabExtContents.get()); - if (!data_ext_cont) + if (!data_ext_cont && crt) data_ext_cont = dynamic_cast(crt->m_DataLabExtContents.get()); if (data_ext_cont) @@ -735,6 +746,13 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT * need_add_labels = true; } } + + if (text) + { + CP_XML_NODE(L"c:showLegendKey") {CP_XML_ATTR(L"val", text->fShowKey);} + need_add_labels = true; + } + Pie *pie = dynamic_cast(crt->m_ChartType.get()); if ( (pie) && (pie->fShowLdrLines) ) { @@ -744,6 +762,7 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT * } if (!add_labels && need_add_labels) { + CP_XML_NODE(L"c:showLegendKey") { CP_XML_ATTR (L"val" , 0); } CP_XML_NODE(L"c:showVal") { CP_XML_ATTR (L"val" , 0); } CP_XML_NODE(L"c:showPercent") { CP_XML_ATTR (L"val" , 0); } CP_XML_NODE(L"c:showBubbleSize"){ CP_XML_ATTR (L"val" , 0); } @@ -771,6 +790,9 @@ int ChartSheetSubstream::serialize_dLbls (std::wostream & _stream, int id, CRT * { CP_XML_NODE(L"c:showLegendKey") {CP_XML_ATTR(L"val", text->fShowKey);} } + else + CP_XML_NODE(L"c:showLegendKey") {CP_XML_ATTR(L"val", 0);} + } DataLabExtContents * data_ext_cont = dynamic_cast(crt->m_DataLabExtContents.get());