From 12dcf40ffe58be7f36f60f2c48df71dde09ecc0e Mon Sep 17 00:00:00 2001 From: "Elen.Subbotina" Date: Fri, 18 Dec 2015 16:47:24 +0000 Subject: [PATCH] ..... git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@67034 954022d7-b5bf-4e40-9824-e11837661b57 --- .../source/XlsFormat/Auxiliary/HelpFunc.cpp | 31 +- .../source/XlsFormat/Logic/BaseObject.h | 10 +- .../XlsFormat/Logic/Biff_records/Area.cpp | 14 + .../XlsFormat/Logic/Biff_records/Area.h | 4 +- .../Logic/Biff_records/AreaFormat.cpp | 15 + .../XlsFormat/Logic/Biff_records/AreaFormat.h | 4 + .../Logic/Biff_records/AttachedLabel.cpp | 51 +- .../Logic/Biff_records/AttachedLabel.h | 17 +- .../XlsFormat/Logic/Biff_records/AxcExt.cpp | 76 +- .../XlsFormat/Logic/Biff_records/AxcExt.h | 18 +- .../XlsFormat/Logic/Biff_records/BRAI.cpp | 1 + .../XlsFormat/Logic/Biff_records/BRAI.h | 12 +- .../XlsFormat/Logic/Biff_records/Backup.h | 5 - .../XlsFormat/Logic/Biff_records/Bar.cpp | 62 +- .../source/XlsFormat/Logic/Biff_records/Bar.h | 26 +- .../XlsFormat/Logic/Biff_records/Blank.cpp | 1 - .../XlsFormat/Logic/Biff_records/BoolErr.cpp | 1 - .../XlsFormat/Logic/Biff_records/BopPop.cpp | 60 + .../XlsFormat/Logic/Biff_records/BopPop.h | 2 + .../Logic/Biff_records/CalcSaveRecalc.h | 5 - .../Logic/Biff_records/CatSerRange.cpp | 4 +- .../Logic/Biff_records/CatSerRange.h | 13 +- .../XlsFormat/Logic/Biff_records/Chart.cpp | 6 + .../XlsFormat/Logic/Biff_records/Chart.h | 1 + .../Logic/Biff_records/Chart3DBarShape.cpp | 23 + .../Logic/Biff_records/Chart3DBarShape.h | 7 +- .../XlsFormat/Logic/Biff_records/Chart3d.h | 16 - .../Logic/Biff_records/ChartFormat.cpp | 13 + .../Logic/Biff_records/ChartFormat.h | 7 +- .../XlsFormat/Logic/Biff_records/Compat12.h | 5 - .../Logic/Biff_records/CompressPictures.h | 5 - .../XlsFormat/Logic/Biff_records/CrtLine.cpp | 52 + .../XlsFormat/Logic/Biff_records/CrtLine.h | 7 +- .../XlsFormat/Logic/Biff_records/CrtMlFrt.cpp | 8 +- .../XlsFormat/Logic/Biff_records/CrtMlFrt.h | 7 +- .../XlsFormat/Logic/Biff_records/DataFormat.h | 9 - .../Logic/Biff_records/DataLabExtContents.cpp | 57 +- .../Logic/Biff_records/DataLabExtContents.h | 14 +- .../Logic/Biff_records/Dimensions.cpp | 2 - .../XlsFormat/Logic/Biff_records/DropBar.h | 6 - .../XlsFormat/Logic/Biff_records/Font.cpp | 111 +- .../XlsFormat/Logic/Biff_records/Font.h | 2 +- .../XlsFormat/Logic/Biff_records/Format.cpp | 2 - .../XlsFormat/Logic/Biff_records/IFmtRecord.h | 5 - .../XlsFormat/Logic/Biff_records/Label.h | 7 - .../XlsFormat/Logic/Biff_records/LabelSst.cpp | 2 - .../XlsFormat/Logic/Biff_records/Legend.cpp | 79 +- .../XlsFormat/Logic/Biff_records/Legend.h | 16 +- .../Logic/Biff_records/LegendException.cpp | 27 +- .../Logic/Biff_records/LegendException.h | 13 +- .../XlsFormat/Logic/Biff_records/Line.cpp | 13 + .../XlsFormat/Logic/Biff_records/Line.h | 8 +- .../Logic/Biff_records/LineFormat.cpp | 46 + .../XlsFormat/Logic/Biff_records/LineFormat.h | 17 +- .../XlsFormat/Logic/Biff_records/MDTInfo.h | 31 - .../Logic/Biff_records/MarkerFormat.cpp | 61 +- .../Logic/Biff_records/MarkerFormat.h | 17 +- .../Logic/Biff_records/MergeCells.cpp | 2 - .../XlsFormat/Logic/Biff_records/MulBlank.cpp | 1 - .../XlsFormat/Logic/Biff_records/MulRk.cpp | 1 - .../XlsFormat/Logic/Biff_records/Number.cpp | 1 - .../XlsFormat/Logic/Biff_records/Number.h | 6 +- .../Logic/Biff_records/ObjectLink.cpp | 5 + .../XlsFormat/Logic/Biff_records/ObjectLink.h | 6 + .../XlsFormat/Logic/Biff_records/Palette.cpp | 7 +- .../XlsFormat/Logic/Biff_records/Pie.cpp | 25 + .../source/XlsFormat/Logic/Biff_records/Pie.h | 10 +- .../Logic/Biff_records/PieFormat.cpp | 12 + .../XlsFormat/Logic/Biff_records/PieFormat.h | 7 +- .../XlsFormat/Logic/Biff_records/PlotArea.h | 4 - .../XlsFormat/Logic/Biff_records/Pos.cpp | 37 +- .../source/XlsFormat/Logic/Biff_records/Pos.h | 12 +- .../XlsFormat/Logic/Biff_records/RK.cpp | 1 - .../XlsFormat/Logic/Biff_records/Radar.cpp | 19 +- .../XlsFormat/Logic/Biff_records/Radar.h | 8 +- .../Logic/Biff_records/RadarArea.cpp | 19 +- .../XlsFormat/Logic/Biff_records/RadarArea.h | 8 +- .../Logic/Biff_records/RichTextStream.h | 7 - .../XlsFormat/Logic/Biff_records/Row.cpp | 2 - .../XlsFormat/Logic/Biff_records/SIIndex.cpp | 93 ++ .../XlsFormat/Logic/Biff_records/SIIndex.h | 5 + .../XlsFormat/Logic/Biff_records/SST.cpp | 1 - .../XlsFormat/Logic/Biff_records/Scatter.cpp | 37 +- .../XlsFormat/Logic/Biff_records/Scatter.h | 10 +- .../source/XlsFormat/Logic/Biff_records/Scl.h | 6 - .../XlsFormat/Logic/Biff_records/SerFmt.cpp | 7 +- .../XlsFormat/Logic/Biff_records/SerFmt.h | 7 - .../XlsFormat/Logic/Biff_records/SerParent.h | 6 +- .../XlsFormat/Logic/Biff_records/Series.cpp | 4 - .../XlsFormat/Logic/Biff_records/Series.h | 3 + .../XlsFormat/Logic/Biff_records/SeriesList.h | 4 - .../XlsFormat/Logic/Biff_records/ShtProps.cpp | 8 +- .../XlsFormat/Logic/Biff_records/ShtProps.h | 9 - .../XlsFormat/Logic/Biff_records/Style.cpp | 2 - .../XlsFormat/Logic/Biff_records/StyleExt.cpp | 2 - .../XlsFormat/Logic/Biff_records/Surf.cpp | 18 +- .../XlsFormat/Logic/Biff_records/Surf.h | 8 +- .../XlsFormat/Logic/Biff_records/Text.cpp | 28 +- .../XlsFormat/Logic/Biff_records/Text.h | 32 +- .../XlsFormat/Logic/Biff_records/Tick.cpp | 42 + .../XlsFormat/Logic/Biff_records/Tick.h | 3 + .../XlsFormat/Logic/Biff_records/TxO.cpp | 1 - .../XlsFormat/Logic/Biff_records/ValueRange.h | 16 +- .../XlsFormat/Logic/Biff_records/XF.cpp | 2 - .../XlsFormat/Logic/Biff_records/YMult.h | 3 - .../Logic/Biff_structures/CellRangeRef.cpp | 41 +- .../Logic/Biff_structures/CellRef.cpp | 4 + .../XlsFormat/Logic/Biff_structures/CellRef.h | 1 + .../Logic/Biff_structures/CellXF.cpp | 2 - .../Biff_structures/ChartParsedFormula.cpp | 60 +- .../Biff_structures/ChartParsedFormula.h | 5 + .../Logic/Biff_structures/FixedPoint.cpp | 2 + .../Logic/Biff_structures/FixedPoint.h | 7 +- .../Logic/Biff_structures/FtLbsData.cpp | 90 -- .../Logic/Biff_structures/LongRGB.cpp | 3 +- .../XlsFormat/Logic/Biff_structures/LongRGB.h | 4 +- .../Logic/Biff_structures/ODRAW/IMsoArray.h | 1 - .../Biff_structures/ODRAW/MSOSHADECOLOR.cpp | 2 + .../Biff_structures/ODRAW/MSOSHADECOLOR.h | 3 + .../ODRAW/OfficeArtCOLORREF.cpp | 5 +- .../Biff_structures/ODRAW/OfficeArtCOLORREF.h | 5 +- .../ODRAW/OfficeArtClientAnchorSheet.h | 16 +- .../Biff_structures/ODRAW/OfficeArtFOPTE.cpp | 10 + .../Biff_structures/ODRAW/OfficeArtFOPTE.h | 43 +- .../Logic/Biff_structures/ParsedFormula.h | 5 +- .../XlsFormat/Logic/Biff_structures/Rgce.h | 26 +- .../XlsFormat/Logic/Biff_structures/Stxp.cpp | 31 - .../Logic/Biff_structures/StyleXF.cpp | 2 - .../XLUnicodeRichExtendedString.cpp | 1 - .../source/XlsFormat/Logic/Biff_unions/AI.cpp | 37 + .../source/XlsFormat/Logic/Biff_unions/AI.h | 2 + .../Logic/Biff_unions/ATTACHEDLABEL.h | 4 +- .../Logic/Biff_unions/ATTACHEDLABEL_bu.cpp | 186 ++- .../XlsFormat/Logic/Biff_unions/AXES.cpp | 161 ++- .../source/XlsFormat/Logic/Biff_unions/AXES.h | 11 +- .../XlsFormat/Logic/Biff_unions/AXISPARENT.h | 2 + .../Logic/Biff_unions/AXISPARENT_bu.cpp | 17 + .../XlsFormat/Logic/Biff_unions/AXM.cpp | 6 +- .../source/XlsFormat/Logic/Biff_unions/AXM.h | 3 + .../XlsFormat/Logic/Biff_unions/AXS.cpp | 158 ++- .../source/XlsFormat/Logic/Biff_unions/AXS.h | 6 + .../XlsFormat/Logic/Biff_unions/CELL_bu.cpp | 2 - .../Logic/Biff_unions/CHARTFOMATS.cpp | 97 +- .../XlsFormat/Logic/Biff_unions/CHARTFOMATS.h | 6 +- .../XlsFormat/Logic/Biff_unions/COLUMNS.cpp | 2 - .../XlsFormat/Logic/Biff_unions/CRT.cpp | 94 +- .../source/XlsFormat/Logic/Biff_unions/CRT.h | 5 + .../XlsFormat/Logic/Biff_unions/CRTMLFRT.h | 2 + .../Logic/Biff_unions/CRTMLFRT_bu.cpp | 4 +- .../source/XlsFormat/Logic/Biff_unions/DAT.h | 3 + .../XlsFormat/Logic/Biff_unions/DAT_bu.cpp | 9 +- .../XlsFormat/Logic/Biff_unions/DROPBAR.h | 8 + .../Logic/Biff_unions/DROPBAR_bu.cpp | 39 +- .../XlsFormat/Logic/Biff_unions/DVAXIS.cpp | 140 ++- .../XlsFormat/Logic/Biff_unions/DVAXIS.h | 17 +- .../Logic/Biff_unions/FORMATTING.cpp | 2 - .../Logic/Biff_unions/FORMULA_bu.cpp | 1 - .../XlsFormat/Logic/Biff_unions/FRAME_bu.cpp | 9 +- .../Logic/Biff_unions/GELFRAME_bu.cpp | 4 +- .../XlsFormat/Logic/Biff_unions/GLOBALS.cpp | 2 - .../XlsFormat/Logic/Biff_unions/IVAXIS.cpp | 76 +- .../XlsFormat/Logic/Biff_unions/IVAXIS.h | 8 + .../XlsFormat/Logic/Biff_unions/LBL_bu.cpp | 1 - .../source/XlsFormat/Logic/Biff_unions/LD.cpp | 67 +- .../source/XlsFormat/Logic/Biff_unions/LD.h | 7 +- .../XlsFormat/Logic/Biff_unions/PAGESETUP.cpp | 2 - .../Logic/Biff_unions/SERIESAXIS.cpp | 59 + .../XlsFormat/Logic/Biff_unions/SERIESAXIS.h | 4 + .../Logic/Biff_unions/SERIESFORMAT.cpp | 81 +- .../Logic/Biff_unions/SERIESFORMAT.h | 8 +- .../Logic/Biff_unions/SHAPEPROPS.cpp | 1 - .../Logic/Biff_unions/SHAREDSTRINGS.cpp | 2 - .../source/XlsFormat/Logic/Biff_unions/SS.cpp | 257 +++- .../source/XlsFormat/Logic/Biff_unions/SS.h | 14 + .../XlsFormat/Logic/Biff_unions/STYLES.cpp | 2 - .../XlsFormat/Logic/Biff_unions/XFS.cpp | 1 - .../XlsFormat/Logic/ChartSheetSubstream.cpp | 762 +++++++++++- .../XlsFormat/Logic/ChartSheetSubstream.h | 22 +- .../XlsFormat/Logic/GlobalWorkbookInfo.cpp | 9 +- .../XlsFormat/Logic/GlobalWorkbookInfo.h | 17 +- .../source/XlsXlsxConverter/XlsConverter.cpp | 271 +++-- .../source/XlsXlsxConverter/XlsConverter.h | 4 +- .../XlsXlsxConverter/external_items.cpp | 18 +- .../source/XlsXlsxConverter/external_items.h | 7 +- .../source/XlsXlsxConverter/oox_rels.h | 2 +- .../XlsXlsxConverter/xlsx_chart_context.h | 2 +- .../XlsXlsxConverter/xlsx_drawing_context.cpp | 1072 ++++++++++++----- .../XlsXlsxConverter/xlsx_drawing_context.h | 170 ++- .../source/XlsXlsxConverter/xlsx_drawings.cpp | 98 +- .../source/XlsXlsxConverter/xlsx_drawings.h | 13 +- .../XlsXlsxConverter/xlsx_tablecontext.cpp | 2 +- 191 files changed, 4718 insertions(+), 1440 deletions(-) diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp index 0b5fe1ba07..99f1834dd1 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Auxiliary/HelpFunc.cpp @@ -385,8 +385,10 @@ const std::wstring toARGB(const unsigned int rgba) const std::wstring toRGB(const unsigned int rgba) { - return toRGB(static_cast(rgba & 0xff), static_cast((rgba >> 8) & 0xff), - static_cast((rgba >> 16) & 0xff)); + unsigned char R = static_cast((rgba >> 16) & 0xff); + unsigned char G = static_cast((rgba >> 8) & 0xff); + unsigned char B = static_cast(rgba & 0xff); + return toRGB(R, G ,B); } const std::wstring toARGB(const unsigned char red, const unsigned char green, const unsigned char blue, const unsigned char alpha) @@ -407,21 +409,32 @@ const bool fromARGB(const std::wstring& argb, unsigned char& red, unsigned char& { return false; } - alpha = static_cast(hex_str2int(argb.substr(0, 2))); - red = static_cast(hex_str2int(argb.substr(2, 2))); - green = static_cast(hex_str2int(argb.substr(4, 2))); - blue = static_cast(hex_str2int(argb.substr(6, 2))); + alpha = static_cast (hex_str2int(argb.substr(0, 2))); + red = static_cast (hex_str2int(argb.substr(2, 2))); + green = static_cast (hex_str2int(argb.substr(4, 2))); + blue = static_cast (hex_str2int(argb.substr(6, 2))); return true; } - +const int HexChar2Int(const char value) +{ + if (value >= '0' && value <= '9') + return value - '0'; + if (value >= 'a' && value <= 'f') + return 10 + value - 'a'; + if (value >= 'A' && value <= 'F') + return 10 + value - 'A'; + return 0; +} const size_t hex_str2int(const std::wstring& hex) { - return hex_str2int(hex.begin(), hex.end()); + size_t summa = 0; + for (int i = 0; i != hex.length(); ++i) + summa += HexChar2Int((char)hex[i]) << (4 * (hex.length() - i - 1)); + return summa; } - const size_t hex_str2int(const std::wstring::const_iterator& it_begin, const std::wstring::const_iterator& it_end) { static const std::wstring hex_digits(L"0123456789ABCDEF"); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObject.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObject.h index acdb701d4e..d327ef27cb 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObject.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/BaseObject.h @@ -6,6 +6,8 @@ #include "Logging/Log.h" #include "XlsElementsType.h" //шоб со строками не работать +#include + namespace XLS { @@ -33,7 +35,7 @@ public: //virtual void toFrom(BinProcessor& proc) = 0; // This function shall contain only mark functions and is the universal XML serialiser - virtual const std::string & getClassName() const = 0; // Must be overridden in every deriver. The return value must be a reference to a static variable inside the getter + virtual const std::string & getClassName() const = 0; // Must be overridden in every deriver. The return value must be a reference to a static variable inside the getter void add_child (BaseObjectPtr e) {elements_.push_back(e);} @@ -43,11 +45,13 @@ public: virtual int serialize(std::wostream & _stream) { - std::stringstream s; - s << std::string("This element - ") << getClassName() << std::string("- not serialize"); + std::stringstream s; + s << std::string("This element - ") << getClassName() << std::string("- not serialize"); Log::warning(s.str()); return 0; } + + virtual void serialize_attribute(CP_ATTR_NODE){} }; #define BASE_OBJECT_DEFINE_CLASS_NAME(class_name)\ diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Area.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Area.cpp index 764780b004..4354538d7b 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Area.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Area.cpp @@ -39,5 +39,19 @@ void Area::readFields(CFRecord& record) fHasShadow = GETBIT(flags, 2); } +int Area::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:grouping") + { + if (f100) CP_XML_ATTR (L"val" , L"percentStacked"); + else if (fStacked) CP_XML_ATTR (L"val" , L"stacked"); + else CP_XML_ATTR (L"val" , L"standard"); + } + } + return 0; +} + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Area.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Area.h index 15222bab4b..45e7a4e4e9 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Area.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Area.h @@ -20,13 +20,13 @@ public: void writeFields(CFRecord& record); void readFields(CFRecord& record); + int serialize(std::wostream & _stream); + static const ElementType type = typeArea; BIFF_BOOL fStacked; BIFF_BOOL f100; BIFF_BOOL fHasShadow; - - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.cpp index 9f0835b9cf..5ee44b4a57 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.cpp @@ -37,5 +37,20 @@ void AreaFormat::readFields(CFRecord& record) fInvertNeg = GETBIT(flags, 1); } +int AreaFormat::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"a:solidFill") + { + CP_XML_NODE(L"a:srgbClr") + { + CP_XML_ATTR(L"val", rgbFore.strRGB); + } + } + } + return 0; +} + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.h index 6b4f87d59b..1d3f633db4 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AreaFormat.h @@ -23,11 +23,15 @@ public: static const ElementType type = typeAreaFormat; + int serialize(std::wostream & _stream); + LongRGB rgbFore; LongRGB rgbBack; + BIFF_WORD fls; BIFF_BOOL fAuto; BIFF_BOOL fInvertNeg; + IcvChart icvFore; IcvChart icvBack; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AttachedLabel.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AttachedLabel.cpp index 30553469d9..9b922d7226 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AttachedLabel.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AttachedLabel.cpp @@ -6,6 +6,7 @@ namespace XLS AttachedLabel::AttachedLabel() { + is_area = false; } @@ -37,12 +38,50 @@ void AttachedLabel::readFields(CFRecord& record) { unsigned short flags; record >> flags; - fShowValue = GETBIT(flags, 0); - fShowPercent = GETBIT(flags, 1); - fShowLabelAndPerc = GETBIT(flags, 2); - fShowLabel = GETBIT(flags, 4); - fShowBubbleSizes = GETBIT(flags, 5); - fShowSeriesName = GETBIT(flags, 6); + + fShowValue = GETBIT(flags, 0); + fShowPercent = GETBIT(flags, 1); + fShowLabelAndPerc = GETBIT(flags, 2); + fShowLabel = GETBIT(flags, 4); + fShowBubbleSizes = GETBIT(flags, 5); + fShowSeriesName = GETBIT(flags, 6); +} + +int AttachedLabel::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:showVal") + { + CP_XML_ATTR (L"val" , fShowValue); + } + CP_XML_NODE(L"c:showPercent") + { + CP_XML_ATTR (L"val" , fShowPercent); + } + CP_XML_NODE(L"c:showBubbleSize") + { + CP_XML_ATTR (L"val" , fShowBubbleSizes); + } + + if (is_area == false) + { + CP_XML_NODE(L"c:showCatName") + { + CP_XML_ATTR (L"val" ,fShowLabel); + } + CP_XML_NODE(L"c:showSerName") { CP_XML_ATTR (L"val" , 0); } + } + else + { + CP_XML_NODE(L"c:showCatName") { CP_XML_ATTR (L"val" , 0); } + CP_XML_NODE(L"c:showSerName") + { + CP_XML_ATTR (L"val" , fShowSeriesName || fShowLabel); + } + } + } + return 0; } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AttachedLabel.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AttachedLabel.h index dc4c508a34..9c75fb4d9b 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AttachedLabel.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AttachedLabel.h @@ -22,22 +22,19 @@ public: static const ElementType type = typeAttachedLabel; -//----------------------------- + int serialize(std::wostream & _stream); + BIFF_BOOL fShowValue; BIFF_BOOL fShowPercent; BIFF_BOOL fShowLabelAndPerc; BIFF_BOOL fShowLabel; BIFF_BOOL fShowBubbleSizes; BIFF_BOOL fShowSeriesName; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fShowValue) - //BO_ATTRIB_MARKUP_ATTRIB(fShowPercent) - //BO_ATTRIB_MARKUP_ATTRIB(fShowLabelAndPerc) - //BO_ATTRIB_MARKUP_ATTRIB(fShowLabel) - //BO_ATTRIB_MARKUP_ATTRIB(fShowBubbleSizes) - //BO_ATTRIB_MARKUP_ATTRIB(fShowSeriesName) - //BO_ATTRIB_MARKUP_END + +//----------------------------- + + bool is_area; + }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxcExt.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxcExt.cpp index 82c4bbdfbd..08f9712c84 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxcExt.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxcExt.cpp @@ -38,17 +38,73 @@ void AxcExt::writeFields(CFRecord& record) void AxcExt::readFields(CFRecord& record) { - unsigned short flags; - record >> catMin >> catMax >> catMajor >> duMajor >> catMinor >> duMinor >> duBase >> catCrossDate >> flags; + unsigned char flags, reserved; + record >> catMin >> catMax >> catMajor >> duMajor >> catMinor >> duMinor >> duBase >> catCrossDate >> flags >> reserved; - fAutoMin = GETBIT(flags, 0); - fAutoMax = GETBIT(flags, 1); - fAutoMajor = GETBIT(flags, 2); - fAutoMinor = GETBIT(flags, 3); - fDateAxis = GETBIT(flags, 4); - fAutoBase = GETBIT(flags, 5); - fAutoCross = GETBIT(flags, 6); - fAutoDate = GETBIT(flags, 7); + fAutoMin = GETBIT(flags, 0); + fAutoMax = GETBIT(flags, 1); + fAutoMajor = GETBIT(flags, 2); + fAutoMinor = GETBIT(flags, 3); + + fDateAxis = GETBIT(flags, 4); + fAutoBase = GETBIT(flags, 5); + fAutoCross = GETBIT(flags, 6); + fAutoDate = GETBIT(flags, 7); +} + +int AxcExt::serialize(std::wostream & _stream) +{ + if (fDateAxis == false) return 0; + + CP_XML_WRITER(_stream) + { + if (fAutoMax == false) + { + CP_XML_NODE(L"c:max") + { + CP_XML_ATTR(L"val", catMax); + } + } + if (fAutoMin == false) + { + CP_XML_NODE(L"c:min") + { + CP_XML_ATTR(L"val", catMin); + } + } + std::wstring DateUnit[] = {L"days", L"months", L"years"}; + + if ( fAutoMajor == false ) + { + CP_XML_NODE(L"c:majorUnit") + { + CP_XML_ATTR(L"val", catMajor); + } + } + if ( fAutoMinor == false ) + { + CP_XML_NODE(L"c:minorUnit") + { + CP_XML_ATTR(L"val", catMinor); + } + } + if ( fAutoBase == false) + { + CP_XML_NODE(L"c:baseTimeUnit") + { + CP_XML_ATTR(L"val", DateUnit[duBase]); + } + } + CP_XML_NODE(L"c:majorTimeUnit") + { + CP_XML_ATTR(L"val", DateUnit[duMajor]); + } + CP_XML_NODE(L"c:minorTimeUnit") + { + CP_XML_ATTR(L"val", DateUnit[duMinor]); + } + } + return 0; } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxcExt.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxcExt.h index 3438c7ce78..27e408423b 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxcExt.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxcExt.h @@ -22,6 +22,8 @@ public: static const ElementType type = typeAxcExt; + int serialize(std::wostream & _stream); + //----------------------------- BIFF_WORD catMin; BIFF_WORD catMax; @@ -32,14 +34,14 @@ public: BIFF_WORD duBase; BIFF_WORD catCrossDate; - BIFF_BOOL fAutoMin; - BIFF_BOOL fAutoMax; - BIFF_BOOL fAutoMajor; - BIFF_BOOL fAutoMinor; - BIFF_BOOL fDateAxis; - BIFF_BOOL fAutoBase; - BIFF_BOOL fAutoCross; - BIFF_BOOL fAutoDate; + bool fAutoMin; + bool fAutoMax; + bool fAutoMajor; + bool fAutoMinor; + bool fDateAxis; + bool fAutoBase; + bool fAutoCross; + bool fAutoDate; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BRAI.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BRAI.cpp index fc8002965d..a94497cf0c 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BRAI.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BRAI.cpp @@ -36,6 +36,7 @@ void BRAI::readFields(CFRecord& record) fUnlinkedIfmt = static_cast(GETBIT(flags, 0)); record >> ifmt; formula.load(record); + } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BRAI.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BRAI.h index 57b5a7f64f..7f91c66251 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BRAI.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BRAI.h @@ -1,7 +1,9 @@ #pragma once #include "BiffRecord.h" + #include +#include namespace XLS { @@ -24,12 +26,12 @@ public: static const ElementType type = typeBRAI; //----------------------------- - BIFF_BYTE id; - BIFF_BYTE rt; - BIFF_BOOL fUnlinkedIfmt; - IFmt ifmt; + BIFF_BYTE id; + BIFF_BYTE rt; + BIFF_BOOL fUnlinkedIfmt; + IFmt ifmt; - ChartParsedFormula formula; + ChartParsedFormula formula; //набор диапазонов и ячеек }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Backup.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Backup.h index a84e1ce259..a14f63e856 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Backup.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Backup.h @@ -24,11 +24,6 @@ public: //----------------------------- Boolean fBackup; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fBackup) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Bar.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Bar.cpp index de34b5720a..2d4c7b6572 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Bar.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Bar.cpp @@ -1,5 +1,6 @@ #include "Bar.h" +#include "Chart3d.h" namespace XLS { @@ -35,10 +36,63 @@ void Bar::readFields(CFRecord& record) { unsigned short flags; record >> pcOverlap >> pcGap >> flags; - fTranspose = GETBIT(flags, 0); - fStacked = GETBIT(flags, 1); - f100 = GETBIT(flags, 2); - fHasShadow = GETBIT(flags, 3); + + fTranspose = GETBIT(flags, 0); + fStacked = GETBIT(flags, 1); + f100 = GETBIT(flags, 2); + fHasShadow = GETBIT(flags, 3); +} + +int Bar::serialize(std::wostream & _stream) +{ + Chart3d *chart3D = dynamic_cast(m_chart3D.get()); + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:barDir") + { + if (fTranspose) CP_XML_ATTR (L"val" , L"bar"); + else CP_XML_ATTR (L"val" , L"col"); + } + if (fStacked || f100) + { + CP_XML_NODE(L"c:grouping") + { + if (f100) CP_XML_ATTR (L"val" , L"percentStacked"); + else if (fStacked) CP_XML_ATTR (L"val" , L"stacked"); + } + } + else + { + CP_XML_NODE(L"c:grouping") + { + if ((chart3D) && (chart3D->fCluster)) + CP_XML_ATTR (L"val" , L"clustered"); + else + CP_XML_ATTR (L"val" , L"standard"); + } + } + + CP_XML_NODE(L"c:gapWidth") + { + CP_XML_ATTR (L"val" , pcGap); + } + if (!chart3D && pcOverlap != 0) + { + CP_XML_NODE(L"c:overlap") + { + CP_XML_ATTR (L"val" , -pcOverlap); + } + } + + if ((chart3D) && (chart3D->pcGap != 150)) + { + CP_XML_NODE(L"c:gapDepth") + { + CP_XML_ATTR (L"val" , chart3D->pcGap); + } + } + } + return 0; } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Bar.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Bar.h index e28c1df822..9a86c28a43 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Bar.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Bar.h @@ -22,25 +22,17 @@ public: static const ElementType type = typeBar; -//----------------------------- - BIFF_SHORT pcOverlap; - BIFF_WORD pcGap; + int serialize(std::wostream & _stream); - BIFF_BOOL fTranspose; - BIFF_BOOL fStacked; - BIFF_BOOL f100; - BIFF_BOOL fHasShadow; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(pcOverlap) - //BO_ATTRIB_MARKUP_ATTRIB(pcGap) - - //BO_ATTRIB_MARKUP_ATTRIB(fTranspose) - //BO_ATTRIB_MARKUP_ATTRIB(fStacked) - //BO_ATTRIB_MARKUP_ATTRIB(f100) - //BO_ATTRIB_MARKUP_ATTRIB(fHasShadow) - //BO_ATTRIB_MARKUP_END + BIFF_SHORT pcOverlap; + BIFF_WORD pcGap; + BIFF_BOOL fTranspose; + BIFF_BOOL fStacked; + BIFF_BOOL f100; + BIFF_BOOL fHasShadow; +//------------------------------------ + BaseObjectPtr m_chart3D; }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Blank.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Blank.cpp index 1051e311f6..e91533affc 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Blank.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Blank.cpp @@ -1,5 +1,4 @@ #include "Blank.h" -#include namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BoolErr.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BoolErr.cpp index 5b92ac7a24..fbeee8b9f2 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BoolErr.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BoolErr.cpp @@ -1,5 +1,4 @@ #include "BoolErr.h" -#include namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.cpp index dcdb5919ec..5231421b74 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.cpp @@ -1,5 +1,6 @@ #include "BopPop.h" +#include "BopPopCustom.h" namespace XLS { @@ -35,5 +36,64 @@ void BopPop::readFields(CFRecord& record) fHasShadow = GETBIT(flags, 0); } +int BopPop::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:ofPieType") + { + if (pst == (unsigned char)1) CP_XML_ATTR (L"val" , L"pie"); + else CP_XML_ATTR (L"val" , L"bar"); + } + CP_XML_NODE(L"c:gapWidth") + { + 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:splitPos") + { + CP_XML_ATTR (L"val", iSplitPos); + } + } + //if (split == 2) + // CP_XML_ATTR (L"val", pcSplitPercent); + //else + // CP_XML_ATTR (L"val", numSplitValue); + + BopPopCustom * custom = dynamic_cast(m_Custom.get()); + if (split == (_UINT16)3 && custom) + { + CP_XML_NODE(L"c:custSplit") + { + for (int i = 0 ; i < custom->rggrbit.pie_indices.size(); i++) + { + CP_XML_NODE(L"c:secondPiePt") + { + CP_XML_ATTR (L"val", custom->rggrbit.pie_indices[i]); + } + } + } + } + CP_XML_NODE(L"c:secondPieSize") + { + CP_XML_ATTR (L"val", pcPie2Size); + } + } + return 0; +} } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.h index cc71e08b2b..9e3f68c5e9 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/BopPop.h @@ -22,6 +22,8 @@ public: static const ElementType type = typeBopPop; + int serialize(std::wostream & _stream); + //----------------------------- BIFF_BYTE pst; Boolean fAutoSplit; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CalcSaveRecalc.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CalcSaveRecalc.h index 0331ae25d6..206c4f041c 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CalcSaveRecalc.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CalcSaveRecalc.h @@ -24,11 +24,6 @@ public: //----------------------------- Boolean fSaveRecalc; - - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fSaveRecalc) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CatSerRange.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CatSerRange.cpp index cafff1293a..b0233e04e7 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CatSerRange.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CatSerRange.cpp @@ -25,7 +25,7 @@ void CatSerRange::writeFields(CFRecord& record) unsigned short flags = 0; SETBIT(flags, 0, fBetween); SETBIT(flags, 1, fMaxCross); - SETBIT(flags, 2, fReverse); + SETBIT(flags, 2, fReversed); record << catCross << catLabel << catMark << flags; } @@ -38,7 +38,7 @@ void CatSerRange::readFields(CFRecord& record) fBetween = GETBIT(flags, 0); fMaxCross = GETBIT(flags, 1); - fReverse = GETBIT(flags, 2); + fReversed = GETBIT(flags, 2); } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CatSerRange.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CatSerRange.h index fdb5920742..cec21f7e50 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CatSerRange.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CatSerRange.h @@ -26,19 +26,10 @@ public: BIFF_SHORT catCross; BIFF_SHORT catLabel; BIFF_SHORT catMark; + BIFF_BOOL fBetween; BIFF_BOOL fMaxCross; - BIFF_BOOL fReverse; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(catCross) - //BO_ATTRIB_MARKUP_ATTRIB(catLabel) - //BO_ATTRIB_MARKUP_ATTRIB(catMark) - //BO_ATTRIB_MARKUP_ATTRIB(fBetween) - //BO_ATTRIB_MARKUP_ATTRIB(fMaxCross) - //BO_ATTRIB_MARKUP_ATTRIB(fReverse) - //BO_ATTRIB_MARKUP_END - + BIFF_BOOL fReversed; }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart.cpp index d3cfe05282..651322bf44 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart.cpp @@ -29,6 +29,12 @@ void Chart::writeFields(CFRecord& record) void Chart::readFields(CFRecord& record) { record >> x >> y >> dx >> dy; + + GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo(); + + pGlobalWorkbookInfoPtr->currentChartWidth = dx.Integral + dx.Fractional / 65536.; + pGlobalWorkbookInfoPtr->currentChartHeight = dy.Integral + dy.Fractional / 65536.; + } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart.h index d8573f14b3..f186a92abf 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart.h @@ -26,6 +26,7 @@ public: //----------------------------- OSHARED::FixedPoint x; OSHARED::FixedPoint y; + OSHARED::FixedPoint dx; OSHARED::FixedPoint dy; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.cpp index a5d4fc95f7..e85aa4fdae 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.cpp @@ -31,5 +31,28 @@ void Chart3DBarShape::readFields(CFRecord& record) record >> riser >> taper; } +int Chart3DBarShape::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:shape") + { + if (taper >=0 && taper < 3 && riser == (unsigned char)0) + { + switch(taper) + { + case 0: CP_XML_ATTR(L"val", L"box"); break; + case 1: CP_XML_ATTR(L"val", L"pyramid"); break; + case 2: CP_XML_ATTR(L"val", L"pyramidToMax");break; + } + } + else + CP_XML_ATTR(L"val", L"cylinder"); + } + } + return 0; +} + + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.h index 7497dccd20..9092cab2e8 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3DBarShape.h @@ -20,16 +20,13 @@ public: void writeFields(CFRecord& record); void readFields(CFRecord& record); + int serialize(std::wostream & _stream); + static const ElementType type = typeChart3DBarShape; //----------------------------- BIFF_BYTE riser; BIFF_BYTE taper; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(riser) - //BO_ATTRIB_MARKUP_ATTRIB(taper) - //BO_ATTRIB_MARKUP_END }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3d.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3d.h index a2fc1c9f90..d89e7f3596 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3d.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Chart3d.h @@ -36,22 +36,6 @@ public: BIFF_BOOL fNotPieChart; BIFF_BOOL fWalls2D; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(anRot) - //BO_ATTRIB_MARKUP_ATTRIB(anElev) - //BO_ATTRIB_MARKUP_ATTRIB(pcDist) - //BO_ATTRIB_MARKUP_ATTRIB(pcHeight) - //BO_ATTRIB_MARKUP_ATTRIB(pcDepth) - //BO_ATTRIB_MARKUP_ATTRIB(pcGap) - - //BO_ATTRIB_MARKUP_ATTRIB(fPerspective) - //BO_ATTRIB_MARKUP_ATTRIB(fCluster) - //BO_ATTRIB_MARKUP_ATTRIB(f3DScaling) - //BO_ATTRIB_MARKUP_ATTRIB(fNotPieChart) - //BO_ATTRIB_MARKUP_ATTRIB(fWalls2D) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ChartFormat.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ChartFormat.cpp index d09ccb3a73..38d98a7ac5 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ChartFormat.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ChartFormat.cpp @@ -34,8 +34,21 @@ void ChartFormat::readFields(CFRecord& record) record.skipNunBytes(16); // reserved unsigned short flags; record >> flags >> icrt; + fVaried = GETBIT(flags, 0); } +int ChartFormat::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:varyColors") + { + CP_XML_ATTR (L"val" , fVaried); + } + } + return 0; +} + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ChartFormat.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ChartFormat.h index a18360728d..1d3be62452 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ChartFormat.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ChartFormat.h @@ -22,15 +22,10 @@ public: static const ElementType type = typeChartFormat; + int serialize(std::wostream & _stream); //----------------------------- BIFF_BOOL fVaried; BIFF_WORD icrt; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fVaried) - //BO_ATTRIB_MARKUP_ATTRIB(icrt) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Compat12.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Compat12.h index 557c17aa4e..505dd0fecc 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Compat12.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Compat12.h @@ -24,11 +24,6 @@ public: //----------------------------- Boolean fNoCompatChk; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fNoCompatChk) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CompressPictures.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CompressPictures.h index 9ee5d26308..36a8cb280c 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CompressPictures.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CompressPictures.h @@ -24,11 +24,6 @@ public: //----------------------------- Boolean fAutoCompressPictures; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fAutoCompressPictures) - //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 5a0fa896db..32276f36eb 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.cpp @@ -6,6 +6,7 @@ namespace XLS CrtLine::CrtLine() { + m_iChartType = -1; } @@ -31,5 +32,56 @@ void CrtLine::readFields(CFRecord& record) record >> id; } +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) + } + if (sNode.empty()) + return 0; + + CP_XML_WRITER(_stream) + { + CP_XML_NODE(sNode) + { + CP_XML_NODE(L"c:spPr") + { + if (m_LineFormat) + m_LineFormat->serialize(CP_XML_STREAM()); + else + { + CP_XML_NODE(L"a:ln") + { + CP_XML_ATTR(L"w", 3175); + CP_XML_NODE(L"a:solidFill") + { + CP_XML_NODE(L"a:srgbClr") + { + CP_XML_ATTR (L"val" , L"000000"); + } + } + CP_XML_NODE(L"a:prstDash") + { + CP_XML_ATTR (L"val" , L"solid"); + } + } + } + } + } + + if (m_iChartType == 2) + { + CP_XML_NODE(L"c:marker") { CP_XML_ATTR (L"val" , L"1"); } + } + } + return 0; + +} + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.h index 2a641b1422..3b37faa031 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtLine.h @@ -22,9 +22,14 @@ public: static const ElementType type = typeCrtLine; -//----------------------------- + int serialize(std::wostream & _stream); + BIFF_WORD id; BaseObjectPtr m_LineFormat; + +//----------------------------- + + int m_iChartType; }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtMlFrt.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtMlFrt.cpp index ed447f9c4e..7fb514fdbb 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtMlFrt.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtMlFrt.cpp @@ -32,7 +32,13 @@ void CrtMlFrt::readFields(CFRecord& record) { #pragma message("####################### CrtMlFrt record is not implemented") Log::error("CrtMlFrt record is not implemented."); - //record >> some_value; + + record >> cb; +// +// if (cb > 0) +// { +// //XmlTkChain +// } } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtMlFrt.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtMlFrt.h index 3b01321291..4cd6b3a81b 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtMlFrt.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/CrtMlFrt.h @@ -23,11 +23,8 @@ public: static const ElementType type = typeCrtMlFrt; //----------------------------- -// BIFF_WORD userName; -public: - //BO_ATTRIB_MARKUP_BEGIN -// //BO_ATTRIB_MARKUP_ATTRIB(userName) - //BO_ATTRIB_MARKUP_END + + BIFF_DWORD cb; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataFormat.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataFormat.h index 9d085e3886..6ff09a98ee 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataFormat.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataFormat.h @@ -22,19 +22,10 @@ public: static const ElementType type = typeDataFormat; -//----------------------------- BIFF_WORD xi; BIFF_WORD yi; BIFF_WORD iss; BIFF_BOOL fUnknown; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(xi) - //BO_ATTRIB_MARKUP_ATTRIB(yi) - //BO_ATTRIB_MARKUP_ATTRIB(iss) - //BO_ATTRIB_MARKUP_ATTRIB(fUnknown) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.cpp index 26f1f87a7c..93ec41d875 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.cpp @@ -7,6 +7,7 @@ namespace XLS DataLabExtContents::DataLabExtContents() { + is_area = false; } @@ -45,11 +46,57 @@ void DataLabExtContents::readFields(CFRecord& record) unsigned short flags; record >> flags >> rgchSep; - fSerName = GETBIT(flags, 0); - fCatName = GETBIT(flags, 1); - fValue = GETBIT(flags, 2); - fPercent = GETBIT(flags, 3); - fBubSizes = GETBIT(flags, 4); + fSerName = GETBIT(flags, 0); + fCatName = GETBIT(flags, 1); + fValue = GETBIT(flags, 2); + fPercent = GETBIT(flags, 3); + fBubSizes = GETBIT(flags, 4); +} + +int DataLabExtContents::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:showVal") + { + CP_XML_ATTR (L"val" , fValue); + } + CP_XML_NODE(L"c:showPercent") + { + CP_XML_ATTR (L"val" , fPercent); + } + CP_XML_NODE(L"c:showBubbleSize") + { + CP_XML_ATTR (L"val" , fBubSizes); + } + + if (rgchSep.value().empty() == false) + { + CP_XML_NODE(L"c:separator") + { + CP_XML_STREAM() << rgchSep.value(); + } + } + if (is_area == false) + { + CP_XML_NODE(L"c:showCatName") + { + CP_XML_ATTR (L"val" , fCatName); + } + CP_XML_NODE(L"c:showSerName") { CP_XML_ATTR (L"val" , 0); } + } + else + { + CP_XML_NODE(L"c:showCatName") { CP_XML_ATTR (L"val" , 0); } + CP_XML_NODE(L"c:showSerName") + { + CP_XML_ATTR (L"val" , fSerName); + } + } + + + } + return 0; } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.h index 7c87d015c7..7be3294b3f 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DataLabExtContents.h @@ -23,7 +23,7 @@ public: static const ElementType type = typeDataLabExtContents; -//----------------------------- + int serialize(std::wostream & _stream); BIFF_BOOL fSerName; BIFF_BOOL fCatName; @@ -33,17 +33,9 @@ public: XLUnicodeStringMin2 rgchSep; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fSerName) - //BO_ATTRIB_MARKUP_ATTRIB(fCatName) - //BO_ATTRIB_MARKUP_ATTRIB(fValue) - //BO_ATTRIB_MARKUP_ATTRIB(fPercent) - //BO_ATTRIB_MARKUP_ATTRIB(fBubSizes) - - //BO_ATTRIB_MARKUP_ATTRIB(rgchSep) - //BO_ATTRIB_MARKUP_END +//----------------------------- + bool is_area; }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Dimensions.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Dimensions.cpp index 929a744e84..f8e03342a6 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Dimensions.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Dimensions.cpp @@ -2,8 +2,6 @@ #include "Dimensions.h" #include -#include - namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DropBar.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DropBar.h index 65f2f39365..0e583b13f3 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DropBar.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/DropBar.h @@ -22,13 +22,7 @@ public: static const ElementType type = typeDropBar; -//----------------------------- BIFF_SHORT pcGap; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(pcGap) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.cpp index f0d742edd3..84e9aedbad 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.cpp @@ -1,8 +1,6 @@ #include "Font.h" -#include - namespace XLS { const static std::wstring shemeColor[17] = @@ -75,26 +73,33 @@ void Font::set_color_ext(FillInfoExt & color_ext_) { color_ext = color_ext_; } -int Font::serialize_rPr(std::wostream & stream) +int Font::serialize_rPr(std::wostream & stream, bool rtl, bool defRPr) { CP_XML_WRITER(stream) { - CP_XML_NODE(L"a:rPr") + std::wstring strRpr = L"a:rPr"; + if (defRPr)strRpr = L"a:defRPr"; + + CP_XML_NODE(strRpr) { if (dyHeight.value()) { - CP_XML_ATTR(L"sz", dyHeight/20 * 100); + CP_XML_ATTR(L"sz", (int)(dyHeight/20. * 100)); } if ((bls.value()) && (*bls.value() == 700)) { CP_XML_ATTR(L"b", true); } + else + CP_XML_ATTR(L"b", false); if ((fItalic.value()) && (fItalic)) { CP_XML_ATTR(L"i", fItalic); } + else + CP_XML_ATTR(L"i", false); //if (bCharSet.value()) //{ // CP_XML_NODE(L"charset") @@ -119,58 +124,80 @@ int Font::serialize_rPr(std::wostream & stream) // CP_XML_ATTR(L"val", fExtend); // } // } - //if (!fontName.value().empty()) - //{ - // CP_XML_ATTR(L"typeface", fontName.value()); - //} - if (((icv.value()) && (icv < 0x7fff)) || color_ext.enabled ) { - CP_XML_NODE(L"a:solidFill") + if (color_ext.enabled ) { - if (color_ext.enabled ) + CP_XML_NODE(L"a:solidFill") { switch(color_ext.xclrType) - { - case 0://auto - /*CP_XML_ATTR(L"auto");*/ break; - case 1://indexed - CP_XML_NODE(L"a:schemeClr") { - CP_XML_ATTR(L"val", color_ext.icv); break; - } - case 2://rgb - CP_XML_NODE(L"a:srgbClr") - { - CP_XML_ATTR(L"val", STR::toRGB(color_ext.xclrValue)); - }break; - case 3://theme color - CP_XML_NODE(L"a:schemeClr") - { - CP_XML_ATTR(L"val", color_ext.xclrValue + 1); - CP_XML_NODE(L"tint") + case 0://auto + /*CP_XML_ATTR(L"auto");*/ break; + case 1://indexed + CP_XML_NODE(L"a:schemeClr") { - CP_XML_ATTR(L"val", color_ext.nTintShade / 32767.0); - } - }break; - case 4://not set - break; + CP_XML_ATTR(L"val", color_ext.icv); break; + } + case 2://rgb + CP_XML_NODE(L"a:srgbClr") + { + CP_XML_ATTR(L"val", STR::toRGB(color_ext.xclrValue)); + }break; + case 3://theme color + CP_XML_NODE(L"a:schemeClr") + { + CP_XML_ATTR(L"val", color_ext.xclrValue + 1); + CP_XML_NODE(L"tint") + { + CP_XML_ATTR(L"val", color_ext.nTintShade / 32767.0); + } + }break; + case 4://not set + break; + } } - } - else + } + else + { + std::wstring strColor; + + std::map::iterator it = global_info->colors_palette.find(icv); + + if (it != global_info->colors_palette.end()) strColor = it->second; + else if ( icv < 64) strColor = DefaultPalette[icv].substr(2); + + if (!strColor.empty()) { - std::map::iterator it = global_info->colors_palette.find(icv); - if (it != global_info->colors_palette.end()) - { + CP_XML_NODE(L"a:solidFill") + { CP_XML_NODE(L"a:srgbClr") { - CP_XML_ATTR(L"val", it->second); - } + CP_XML_ATTR(L"val", strColor); + } } } } } - + if (!fontName.value().empty()) + { + CP_XML_NODE(L"a:latin") + { + CP_XML_ATTR(L"typeface", fontName.value()); + } + CP_XML_NODE(L"a:ea") + { + CP_XML_ATTR(L"typeface", fontName.value()); + } + CP_XML_NODE(L"a:cs") + { + CP_XML_ATTR(L"typeface", fontName.value()); + } + } + if (rtl) + { + CP_XML_NODE(L"a:rtl"); + } //if ((fOutline.value()) && (fOutline)) // { // CP_XML_NODE(L"outline") diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.h index 647464e2a4..889ef74d6f 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Font.h @@ -26,7 +26,7 @@ public: int serialize (std::wostream & stream); int serialize_properties (std::wostream & stream, bool rPr = false); - int serialize_rPr (std::wostream & stream); + int serialize_rPr (std::wostream & stream, bool rtl = false, bool defRPr = false); void set_color_ext (FillInfoExt & color_ext); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Format.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Format.cpp index 804fddacd6..df6d18331b 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Format.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Format.cpp @@ -1,8 +1,6 @@ #include "Format.h" -#include - namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/IFmtRecord.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/IFmtRecord.h index f3903b0655..7b7cc803f6 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/IFmtRecord.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/IFmtRecord.h @@ -24,11 +24,6 @@ public: //----------------------------- BIFF_WORD ifmt; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(ifmt) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.h index 9f8bffdab8..19bbc10aa5 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Label.h @@ -27,13 +27,6 @@ public: //----------------------------- Cell cell; XLUnicodeString st; - -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_COMPLEX(cell) - //BO_ATTRIB_MARKUP_ATTRIB(st) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LabelSst.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LabelSst.cpp index dd972ab755..970bac22d3 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LabelSst.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LabelSst.cpp @@ -1,7 +1,5 @@ #include "LabelSst.h" -#include - namespace XLS { extern int cellStyleXfs_count; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.cpp index 0dc2414bd6..f8870ff586 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.cpp @@ -41,11 +41,80 @@ void Legend::readFields(CFRecord& record) record.skipNunBytes(1); // unused record >> wSpace >> flags; - fAutoPosition = GETBIT(flags, 0); - fAutoPosX = GETBIT(flags, 2); - fAutoPosY = GETBIT(flags, 3); - fVert = GETBIT(flags, 4); - fWasDataTable = GETBIT(flags, 5); + fAutoPosition = GETBIT(flags, 0); + fAutoPosX = GETBIT(flags, 2); + fAutoPosY = GETBIT(flags, 3); + fVert = GETBIT(flags, 4); + + fWasDataTable = GETBIT(flags, 5); +} + +int Legend::serialize(std::wostream & _stream, int size) +{ + double x1Kf = x / 4000.; + double y1Kf = y / 4000.; + + double x2Kf = (4000 - dx - x) / 4000.; + double y2Kf = (4000 - dy - y) / 4000.; + + CP_XML_WRITER(_stream) + { + if (fAutoPosX && fAutoPosY) + { + CP_XML_NODE(L"c:legendPos") + { + if (y1Kf > 0.5) + { + CP_XML_ATTR(L"val", "b"); + x = x - (size - 1 ) * dx / 2; + dx = dx * size; + } + else if (x1Kf > 0.5) + { + CP_XML_ATTR(L"val", "r"); + y = y - (size - 1 ) * dy / 2; + dy = dy * size; + } + else if (x2Kf > 0.5) + { + CP_XML_ATTR(L"val", "l"); + y = y - (size - 1 ) * dy / 2; + dy = dy * size; + } + else if (y2Kf > 0.5) + { + CP_XML_ATTR(L"val", "t"); + x = x - (size - 1 ) * dx / 2; + dx = dx * size; + } + else + { + //нету откровенного смещения + CP_XML_ATTR(L"val", "l"); + dy = dy * size; + } + } + } + else + { + CP_XML_NODE(L"c:layout") + { + CP_XML_NODE(L"c:manualLayout") + { + 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 (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.);} + } + } + } + } + + return 0; } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.h index a28a1047f4..77c3558a11 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Legend.h @@ -20,6 +20,8 @@ public: void writeFields(CFRecord& record); void readFields(CFRecord& record); + int serialize(std::wostream & _stream, int sz); + static const ElementType type = typeLegend; //----------------------------- @@ -34,20 +36,6 @@ public: BIFF_BOOL fAutoPosY; BIFF_BOOL fVert; BIFF_BOOL fWasDataTable; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(x) - //BO_ATTRIB_MARKUP_ATTRIB(y) - //BO_ATTRIB_MARKUP_ATTRIB(dx) - //BO_ATTRIB_MARKUP_ATTRIB(dy) - //BO_ATTRIB_MARKUP_ATTRIB(wSpace) - - //BO_ATTRIB_MARKUP_ATTRIB(fAutoPosition) - //BO_ATTRIB_MARKUP_ATTRIB(fAutoPosX) - //BO_ATTRIB_MARKUP_ATTRIB(fAutoPosY) - //BO_ATTRIB_MARKUP_ATTRIB(fVert) - //BO_ATTRIB_MARKUP_ATTRIB(fWasDataTable) - //BO_ATTRIB_MARKUP_END }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LegendException.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LegendException.cpp index a176f4ad2f..83d5962897 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LegendException.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LegendException.cpp @@ -22,17 +22,32 @@ BaseObjectPtr LegendException::clone() void LegendException::writeFields(CFRecord& record) { -#pragma message("####################### LegendException record is not implemented") - Log::error("LegendException record is not implemented."); - //record << some_value; + unsigned short flags = 0; + SETBIT(flags, 0, fDelete); + SETBIT(flags, 1, fLabel); + record << iss << flags; } void LegendException::readFields(CFRecord& record) { -#pragma message("####################### LegendException record is not implemented") - Log::error("LegendException record is not implemented."); - //record >> some_value; + unsigned short flags; + record >> iss >> flags; + + fDelete = GETBIT(flags, 0); + fLabel = GETBIT(flags, 1); +} +int LegendException::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:delete") + { + CP_XML_ATTR(L"val", fDelete); + } + } + + return 0; } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LegendException.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LegendException.h index 3ed49df7e0..86c7b4bca3 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LegendException.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LegendException.h @@ -19,12 +19,13 @@ public: void writeFields(CFRecord& record); void readFields(CFRecord& record); -//----------------------------- -// BIFF_WORD userName; -public: - //BO_ATTRIB_MARKUP_BEGIN -// //BO_ATTRIB_MARKUP_ATTRIB(userName) - //BO_ATTRIB_MARKUP_END + + BIFF_WORD iss; + BIFF_BOOL fDelete; + BIFF_BOOL fLabel; + + int serialize(std::wostream & _stream); + }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Line.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Line.cpp index cb1a096b8d..73af422ec8 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Line.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Line.cpp @@ -39,5 +39,18 @@ void Line::readFields(CFRecord& record) fHasShadow = GETBIT(flags, 2); } +int Line::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:grouping") + { + if (fStacked) CP_XML_ATTR (L"val" , L"stacked"); + else if (f100) CP_XML_ATTR (L"val" , L"percentStacked"); + else CP_XML_ATTR (L"val" , L"standard"); + } + } + return 0; +} } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Line.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Line.h index 596554202a..ea571cf8f7 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Line.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Line.h @@ -22,16 +22,12 @@ public: static const ElementType type = typeLine; + int serialize(std::wostream & _stream); + //----------------------------- BIFF_BOOL fStacked; BIFF_BOOL f100; BIFF_BOOL fHasShadow; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fStacked) - //BO_ATTRIB_MARKUP_ATTRIB(f100) - //BO_ATTRIB_MARKUP_ATTRIB(fHasShadow) - //BO_ATTRIB_MARKUP_END }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.cpp index 4198146e70..7c85055072 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.cpp @@ -34,10 +34,56 @@ void LineFormat::readFields(CFRecord& record) { unsigned short flags; record >> rgb >> lns >> we >> flags >> icv; + fAuto = GETBIT(flags, 0); fAxisOn = GETBIT(flags, 2); fAutoCo = GETBIT(flags, 3); } +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 + } + 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") + { + 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 6: break; //Dark gray pattern + case 7: break; //Medium gray pattern + case 8: break; //Light gray patternn + } + } + } + return 0; +} } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.h index 59ab88856d..f84f5020ca 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LineFormat.h @@ -20,25 +20,16 @@ public: void writeFields(CFRecord& record); void readFields(CFRecord& record); + + int serialize(std::wostream & _stream); //----------------------------- LongRGB rgb; BIFF_WORD lns; - BIFF_SHORT we; + BIFF_WORD we; BIFF_BOOL fAuto; BIFF_BOOL fAxisOn; BIFF_BOOL fAutoCo; - IcvChart icv; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_COMPLEX(rgb) - //BO_ATTRIB_MARKUP_ATTRIB(lns) - //BO_ATTRIB_MARKUP_ATTRIB(we) - //BO_ATTRIB_MARKUP_ATTRIB(fAuto) - //BO_ATTRIB_MARKUP_ATTRIB(fAxisOn) - //BO_ATTRIB_MARKUP_ATTRIB(fAutoCo) - //BO_ATTRIB_MARKUP_ATTRIB(icv) - //BO_ATTRIB_MARKUP_END - + IcvChart icv; }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MDTInfo.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MDTInfo.h index 4338ba865c..10da5c88ee 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MDTInfo.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MDTInfo.h @@ -49,37 +49,6 @@ public: BIFF_BOOL fCellMeta; LPWideString stName; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fGhostRow) - //BO_ATTRIB_MARKUP_ATTRIB(fGhostCol) - //BO_ATTRIB_MARKUP_ATTRIB(fEdit) - //BO_ATTRIB_MARKUP_ATTRIB(fDelete) - //BO_ATTRIB_MARKUP_ATTRIB(fCopy) - //BO_ATTRIB_MARKUP_ATTRIB(fPasteAll) - //BO_ATTRIB_MARKUP_ATTRIB(fPasteFormulas) - //BO_ATTRIB_MARKUP_ATTRIB(fPasteValues) - //BO_ATTRIB_MARKUP_ATTRIB(fPasteFormats) - //BO_ATTRIB_MARKUP_ATTRIB(fPasteComments) - //BO_ATTRIB_MARKUP_ATTRIB(fPasteDataValidation) - //BO_ATTRIB_MARKUP_ATTRIB(fPasteBorders) - //BO_ATTRIB_MARKUP_ATTRIB(fPasteColWidths) - //BO_ATTRIB_MARKUP_ATTRIB(fPasteNumberFormats) - //BO_ATTRIB_MARKUP_ATTRIB(fMerge) - //BO_ATTRIB_MARKUP_ATTRIB(fSplitFirst) - //BO_ATTRIB_MARKUP_ATTRIB(fSplitAll) - //BO_ATTRIB_MARKUP_ATTRIB(fRowColShift) - //BO_ATTRIB_MARKUP_ATTRIB(fClearAll) - //BO_ATTRIB_MARKUP_ATTRIB(fClearFormats) - //BO_ATTRIB_MARKUP_ATTRIB(fClearContents) - //BO_ATTRIB_MARKUP_ATTRIB(fClearComments) - //BO_ATTRIB_MARKUP_ATTRIB(fAssign) - //BO_ATTRIB_MARKUP_ATTRIB(fCoerce) - //BO_ATTRIB_MARKUP_ATTRIB(fAdjust) - //BO_ATTRIB_MARKUP_ATTRIB(fCellMeta) - - //BO_ATTRIB_MARKUP_ATTRIB(stName) - //BO_ATTRIB_MARKUP_END }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MarkerFormat.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MarkerFormat.cpp index a7645ab4b3..72c0acabc7 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MarkerFormat.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MarkerFormat.cpp @@ -29,15 +29,70 @@ void MarkerFormat::writeFields(CFRecord& record) record << rgbFore << rgbBack << imk << flags << icvFore << icvBack << miSize; } - void MarkerFormat::readFields(CFRecord& record) { unsigned short flags; record >> rgbFore >> rgbBack >> imk >> flags >> icvFore >> icvBack >> miSize; - fAuto = GETBIT(flags, 0); + + fAuto = GETBIT(flags, 0); fNotShowInt = GETBIT(flags, 4); fNotShowBrd = GETBIT(flags, 5); } -} // namespace XLS +int MarkerFormat::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:marker") + { + CP_XML_NODE(L"c:symbol") + { + std::wstring strSymbol; + switch (imk) + { + case 0x0000: strSymbol = L"none"; break;// No marker. + case 0x0001: strSymbol = L"square"; break;// Square markers. + case 0x0002: strSymbol = L"diamond"; break;// Diamond-shaped markers. + case 0x0003: strSymbol = L"triangle";break;// Triangular markers. + case 0x0004: strSymbol = L"x"; break;// Square markers with an X. + case 0x0005: strSymbol = L"star"; break;// Square markers with an asterisk. + case 0x0006: strSymbol = L"dot"; break;// Short bar markers. + case 0x0007: strSymbol = L"dash"; break;// Long bar markers. + case 0x0008: strSymbol = L"circle"; break;// Circular markers. + case 0x0009: strSymbol = L"plus"; break;// Square markers with a plus sign. + } + CP_XML_ATTR(L"val", strSymbol); + } + if (imk > 0) + { + CP_XML_NODE(L"c:size") { CP_XML_ATTR(L"val", miSize / 20); } + CP_XML_NODE(L"c:spPr") + { + CP_XML_NODE(L"a:solidFill") + { + CP_XML_NODE(L"a:srgbClr") + { + CP_XML_ATTR(L"val", rgbBack.strRGB); + } + } + CP_XML_NODE(L"a:ln") + { + CP_XML_NODE(L"a:solidFill") + { + CP_XML_NODE(L"a:srgbClr") + { + CP_XML_ATTR(L"val", rgbFore.strRGB); + } + } + CP_XML_NODE(L"a:prstDash") { CP_XML_ATTR(L"val", L"solid"); } + } + } + } + } + } + + return 0; +} + +} // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MarkerFormat.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MarkerFormat.h index df5e24e997..aec09b181a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MarkerFormat.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MarkerFormat.h @@ -20,29 +20,20 @@ public: void writeFields(CFRecord& record); void readFields(CFRecord& record); + + int serialize(std::wostream & _stream); //----------------------------- LongRGB rgbFore; LongRGB rgbBack; + BIFF_WORD imk; BIFF_BOOL fAuto; BIFF_BOOL fNotShowInt; BIFF_BOOL fNotShowBrd; + IcvChart icvFore; IcvChart icvBack; BIFF_DWORD miSize; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_COMPLEX(rgbFore) - //BO_ATTRIB_MARKUP_COMPLEX(rgbBack) - //BO_ATTRIB_MARKUP_ATTRIB(imk) - //BO_ATTRIB_MARKUP_ATTRIB(fAuto) - //BO_ATTRIB_MARKUP_ATTRIB(fNotShowInt) - //BO_ATTRIB_MARKUP_ATTRIB(fNotShowBrd) - //BO_ATTRIB_MARKUP_ATTRIB(icvFore) - //BO_ATTRIB_MARKUP_ATTRIB(icvBack) - //BO_ATTRIB_MARKUP_ATTRIB(miSize) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MergeCells.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MergeCells.cpp index bae52abc2e..dc0be854e7 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MergeCells.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MergeCells.cpp @@ -1,8 +1,6 @@ #include "MergeCells.h" -#include - namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulBlank.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulBlank.cpp index 71159e57cc..be077f53d4 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulBlank.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulBlank.cpp @@ -2,7 +2,6 @@ #include "MulBlank.h" #include -#include namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulRk.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulRk.cpp index 91fb1fc9e9..9dfd6941e1 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulRk.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulRk.cpp @@ -1,5 +1,4 @@ #include "MulRk.h" -#include namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp index ba0465685c..cb3fa34fb3 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp @@ -1,6 +1,5 @@ #include "Number.h" #include -#include namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.h index 072e25725b..7fa8a1904e 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.h @@ -29,9 +29,9 @@ public: const CellRef getLocation() const; //----------------------------- - CellOffsetResender resender; - Cell cell; - BIFF_DOUBLE num; + CellOffsetResender resender; + Cell cell; + BIFF_DOUBLE num; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ObjectLink.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ObjectLink.cpp index 3591c67a26..89422ad56f 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ObjectLink.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ObjectLink.cpp @@ -29,6 +29,11 @@ void ObjectLink::writeFields(CFRecord& record) void ObjectLink::readFields(CFRecord& record) { record >> wLinkObj >> wLinkVar1 >> wLinkVar2; + +//-------------------------------------------------- + testLinkObj = wLinkObj; + testLinkVar1= wLinkVar1; + testLinkVar2= wLinkVar2; } } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ObjectLink.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ObjectLink.h index 453f0e7eb5..d7625f73f0 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ObjectLink.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ObjectLink.h @@ -26,6 +26,12 @@ public: BIFF_WORD wLinkVar1; BIFF_WORD wLinkVar2; +//------------------------------- + + int testLinkObj; + int testLinkVar1; + int testLinkVar2; + }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Palette.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Palette.cpp index 12f6c4ff9e..efc33ffd5d 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Palette.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Palette.cpp @@ -1,6 +1,5 @@ #include "Palette.h" -#include namespace XLS { @@ -62,9 +61,7 @@ void Palette::readFields(CFRecord& record) record >> *rgb; rgColor.push_back(rgb); - std::wstring rgb_color = STR::toRGB(rgb->red, rgb->green, rgb->blue); - - global_info->RegisterPaletteColor(i+8, rgb_color); + global_info->RegisterPaletteColor(i+8, rgb->strRGB); } } @@ -89,7 +86,7 @@ int Palette::serialize(std::wostream & stream) LongRGB * rgb = dynamic_cast(rgColor[i].get()); CP_XML_NODE(L"rgbColor") { - CP_XML_ATTR(L"rgb", rgb->argb); + CP_XML_ATTR(L"rgb", rgb->strARGB); } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pie.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pie.cpp index df4cc5c848..c08be2a273 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pie.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pie.cpp @@ -25,6 +25,7 @@ void Pie::writeFields(CFRecord& record) unsigned short flags = 0; SETBIT(flags, 0, fHasShadow); SETBIT(flags, 1, fShowLdrLines); + record >> anStart >> pcDonut >> flags; } @@ -33,9 +34,33 @@ void Pie::readFields(CFRecord& record) { unsigned short flags; record >> anStart >> pcDonut >> flags; + fHasShadow = GETBIT(flags, 0); fShowLdrLines = GETBIT(flags, 1); } +int Pie::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + if (anStart > 0) + { + CP_XML_NODE(L"c:firstSliceAng") + { + CP_XML_ATTR (L"val" , anStart); + } + } + if (pcDonut > 0 && pcDonut != 10) + { + CP_XML_NODE(L"c:holeSize") + { + CP_XML_ATTR (L"val" , pcDonut); + } + } + + } + return 0; +} + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pie.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pie.h index fd935fb055..96dabbd799 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pie.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pie.h @@ -22,19 +22,13 @@ public: static const ElementType type = typePie; + int serialize(std::wostream & _stream); + //----------------------------- BIFF_WORD anStart; BIFF_WORD pcDonut; BIFF_BOOL fHasShadow; BIFF_BOOL fShowLdrLines; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(anStart) - //BO_ATTRIB_MARKUP_ATTRIB(pcDonut) - //BO_ATTRIB_MARKUP_ATTRIB(fHasShadow) - //BO_ATTRIB_MARKUP_ATTRIB(fShowLdrLines) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PieFormat.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PieFormat.cpp index 46c98de53c..d49e823d62 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PieFormat.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PieFormat.cpp @@ -31,5 +31,17 @@ void PieFormat::readFields(CFRecord& record) record >> pcExplode; } +int PieFormat::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:explosion") + { + CP_XML_ATTR(L"val", pcExplode); + } + } + return 0; +} + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PieFormat.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PieFormat.h index 3fa052c7f5..4c72583be2 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PieFormat.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PieFormat.h @@ -22,12 +22,9 @@ public: static const ElementType type = typePieFormat; -//----------------------------- + int serialize(std::wostream & _stream); + BIFF_SHORT pcExplode; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(pcExplode) - //BO_ATTRIB_MARKUP_END }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PlotArea.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PlotArea.h index 0277835a89..a8ead78b2a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PlotArea.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/PlotArea.h @@ -22,10 +22,6 @@ public: static const ElementType type = typePlotArea; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.cpp index a1b955a173..fca63f9b33 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.cpp @@ -1,6 +1,5 @@ #include "Pos.h" -#include #include namespace XLS @@ -8,6 +7,7 @@ namespace XLS Pos::Pos() { + m_iLinkObject = -1; } @@ -38,6 +38,8 @@ void Pos::writeFields(CFRecord& record) void Pos::readFields(CFRecord& record) { + pGlobalWorkbookInfoPtr = record.getGlobalWorkbookInfo(); + record >> mdTopLt >> mdBotRt; record >> x1; record.skipNunBytes(2); // unused1 @@ -51,18 +53,43 @@ void Pos::readFields(CFRecord& record) int Pos::serialize(std::wostream & _stream) { + double x = x1 / 4000.; + double y = y1 / 4000.; + + double w = x2 / 4000.; + double h = y2 / 4000.; + CP_XML_WRITER(_stream) { CP_XML_NODE(L"c:layout") { CP_XML_NODE(L"c:manualLayout") { + 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");} - CP_XML_NODE(L"c:x") {CP_XML_ATTR(L"val", (int)(x1 / 4000));} - CP_XML_NODE(L"c:y") {CP_XML_ATTR(L"val", (int)(y1 / 4000));} - CP_XML_NODE(L"c:w") {CP_XML_ATTR(L"val", (int)((x2 - x1)/ 4000));} - CP_XML_NODE(L"c:h") {CP_XML_ATTR(L"val", (int)((y2 - y1)/ 4000));} + + 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 + { + 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 || m_iLinkObject == 2 || m_iLinkObject == 3) + { + CP_XML_NODE(L"c:overlay") + { + CP_XML_ATTR(L"val", 0); } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.h index bb579f2501..bf50c5a163 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Pos.h @@ -20,18 +20,24 @@ public: void writeFields(CFRecord& record); void readFields(CFRecord& record); + GlobalWorkbookInfoPtr pGlobalWorkbookInfoPtr; + int serialize(std::wostream & stream_); static const ElementType type = typePos; -//----------------------------- - BIFF_WORD mdTopLt; - BIFF_WORD mdBotRt; + _UINT16 mdTopLt; + _UINT16 mdBotRt; + BIFF_SHORT x1; BIFF_SHORT y1; BIFF_SHORT x2; BIFF_SHORT y2; +//----------------------------- + + short m_iLinkObject; + }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RK.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RK.cpp index 4c7aad97b1..d4abd66919 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RK.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RK.cpp @@ -1,5 +1,4 @@ #include "RK.h" -#include namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Radar.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Radar.cpp index 32f1807cb4..05bb223b76 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Radar.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Radar.cpp @@ -34,10 +34,25 @@ void Radar::readFields(CFRecord& record) { unsigned short flags; record >> flags; - fRdrAxLab = GETBIT(flags, 0); - fHasShadow = GETBIT(flags, 1); + + fRdrAxLab = GETBIT(flags, 0); //in tick + fHasShadow = GETBIT(flags, 1); + record.skipNunBytes(2); // unused } +int Radar::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:radarStyle") + { + CP_XML_ATTR (L"val" , L"standard"); + } + } + + return 0; +} + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Radar.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Radar.h index d26a0a8e82..f553af7b36 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Radar.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Radar.h @@ -22,15 +22,11 @@ public: static const ElementType type = typeRadar; + int serialize(std::wostream & _stream); + //----------------------------- BIFF_BOOL fRdrAxLab; BIFF_BOOL fHasShadow; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fRdrAxLab) - //BO_ATTRIB_MARKUP_ATTRIB(fHasShadow) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RadarArea.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RadarArea.cpp index 5c26e4ef9a..ca5b12633e 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RadarArea.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RadarArea.cpp @@ -34,10 +34,25 @@ void RadarArea::readFields(CFRecord& record) { unsigned short flags; record >> flags; - fRdrAxLab = GETBIT(flags, 0); - fHasShadow = GETBIT(flags, 1); + + fRdrAxLab = GETBIT(flags, 0); //in tick + fHasShadow = GETBIT(flags, 1); + record.skipNunBytes(2); // unused } +int RadarArea::serialize(std::wostream & _stream) +{ + CP_XML_WRITER(_stream) + { + CP_XML_NODE(L"c:radarStyle") + { + CP_XML_ATTR (L"val" , L"filled"); + } + } + + return 0; +} + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RadarArea.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RadarArea.h index a627e65e86..9a34d3d1c1 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RadarArea.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RadarArea.h @@ -22,15 +22,11 @@ public: static const ElementType type = typeRadarArea; + int serialize(std::wostream & _stream); + //----------------------------- BIFF_BOOL fRdrAxLab; BIFF_BOOL fHasShadow; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(fRdrAxLab) - //BO_ATTRIB_MARKUP_ATTRIB(fHasShadow) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RichTextStream.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RichTextStream.h index 220a991846..25e1635d0e 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RichTextStream.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RichTextStream.h @@ -22,13 +22,6 @@ public: static const ElementType type = typeRichTextStream; -//----------------------------- -// BIFF_WORD userName; -public: - //BO_ATTRIB_MARKUP_BEGIN -// //BO_ATTRIB_MARKUP_ATTRIB(userName) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Row.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Row.cpp index dd71da24da..6f3a0f7837 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Row.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Row.cpp @@ -1,8 +1,6 @@ #include "Row.h" -#include - namespace XLS { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SIIndex.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SIIndex.cpp index b6bcf5c154..279827ff78 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SIIndex.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SIIndex.cpp @@ -1,6 +1,12 @@ #include "SIIndex.h" +#include +#include +#include +#include + + namespace XLS { @@ -31,5 +37,92 @@ void SIIndex::readFields(CFRecord& record) record >> numIndex; } +int SIIndex::serialize(std::wostream & _stream, int idx, const CellRef & in_ref) +{ + int res = 0; + CP_XML_WRITER(_stream) + { + for (int i = 0 ; i < m_arData.size(); i++) + { + Number * number = dynamic_cast (m_arData[i].get()); + BoolErr * boolErr = dynamic_cast(m_arData[i].get()); + Blank * blank = dynamic_cast (m_arData[i].get()); + Label * label = dynamic_cast