From a948a51afe8400674cd639bc6d948999b4e0e4f3 Mon Sep 17 00:00:00 2001 From: "Elen.Subbotina" Date: Wed, 22 Jul 2015 15:25:46 +0000 Subject: [PATCH] =?UTF-8?q?XlsFile2=20-=20=D1=80=D0=B0=D1=81=D1=88=D0=B8?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D0=B8=D0=BB=D0=B5?= =?UTF-8?q?=D0=B9,=20=D0=B1=D1=83=D0=BA=D0=BE=D0=B2=D0=BA=D0=B8=20=D0=B8?= =?UTF-8?q?=20=D1=86=D1=8B=D1=84=D0=B5=D1=80=D0=BA=D0=B8,=20=D0=B7=D0=B0?= =?UTF-8?q?=D1=81=D1=82=D0=B8=D0=BB=D0=B5=D0=BD=D0=BD=D1=8B=D0=B5=20=D0=B5?= =?UTF-8?q?=D1=81-=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63653 954022d7-b5bf-4e40-9824-e11837661b57 --- .../XlsFormat/Logic/Biff_records/Blank.cpp | 4 +- .../XlsFormat/Logic/Biff_records/Continue.h | 8 -- .../XlsFormat/Logic/Biff_records/LabelSst.cpp | 15 +- .../XlsFormat/Logic/Biff_records/MulBlank.cpp | 4 +- .../XlsFormat/Logic/Biff_records/Number.cpp | 12 +- .../XlsFormat/Logic/Biff_records/RK.cpp | 8 +- .../XlsFormat/Logic/Biff_records/SST.cpp | 29 +++- .../source/XlsFormat/Logic/Biff_records/SST.h | 10 +- .../XlsFormat/Logic/Biff_records/XF.cpp | 2 +- .../Logic/Biff_structures/BitMarkedStructs.h | 14 +- .../Logic/Biff_structures/BorderFillInfo.cpp | 40 +++++- .../Logic/Biff_structures/BorderFillInfo.h | 18 +++ .../Logic/Biff_structures/CellXF.cpp | 133 ++++++------------ .../XlsFormat/Logic/Biff_structures/CellXF.h | 3 +- .../Logic/Biff_structures/ExtProp.cpp | 36 ----- .../XlsFormat/Logic/Biff_structures/ExtProp.h | 4 +- .../Logic/Biff_structures/FullColorExt.cpp | 23 +-- .../Logic/Biff_structures/FullColorExt.h | 10 +- .../Logic/Biff_structures/GradStop.cpp | 24 ---- .../Logic/Biff_structures/GradStop.h | 3 - .../XlsFormat/Logic/Biff_structures/RkRec.cpp | 19 +-- .../XlsFormat/Logic/Biff_structures/RkRec.h | 4 +- .../Logic/Biff_structures/StyleXF.cpp | 53 ++++++- .../XlsFormat/Logic/Biff_structures/StyleXF.h | 19 +-- .../Logic/Biff_structures/XFExtGradient.h | 11 +- .../Logic/Biff_structures/XFPropGradient.cpp | 20 --- .../Logic/Biff_structures/XFPropGradient.h | 4 - .../XLUnicodeRichExtendedString.h | 6 +- .../Logic/Biff_unions/SHAREDSTRINGS.cpp | 12 ++ .../Logic/Biff_unions/SHAREDSTRINGS.h | 1 + .../XlsFormat/Logic/GlobalsSubstream.cpp | 8 +- .../source/XlsFormat/Logic/GlobalsSubstream.h | 1 + .../source/XlsXlsxConverter/XlsConverter.cpp | 23 +-- .../source/XlsXlsxConverter/XlsConverter.h | 2 + .../xlsx_conversion_context.cpp | 6 +- .../xlsx_conversion_context.h | 3 + .../XlsXlsxConverter/xlsx_sharedstrings.cpp | 61 -------- .../XlsXlsxConverter/xlsx_sharedstrings.h | 25 ---- .../XlsXlsxConverter/xlsx_textcontext.cpp | 14 +- .../XlsXlsxConverter/xlsx_textcontext.h | 2 - .../source/win32/XlsXlsxConverter.vcproj | 8 -- 41 files changed, 291 insertions(+), 411 deletions(-) delete mode 100644 ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_sharedstrings.cpp delete mode 100644 ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_sharedstrings.h diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Blank.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Blank.cpp index 6f647c8d01..5414c443a5 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Blank.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Blank.cpp @@ -48,9 +48,9 @@ int Blank::serialize(std::wostream & stream) { CP_XML_ATTR(L"r", ref); - if (cell.ixfe.value()) + if ((cell.ixfe.value()) && (cell.ixfe > cellStyleXfs_count)) { - CP_XML_ATTR(L"s", *cell.ixfe.value() - cellStyleXfs_count); + CP_XML_ATTR(L"s", cell.ixfe - cellStyleXfs_count); } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Continue.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Continue.h index b9ec979c3f..d36214e43e 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Continue.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Continue.h @@ -21,14 +21,6 @@ public: void readFields(CFRecord& record); static const ElementType type = typeContinue; - -//----------------------------- -// 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/LabelSst.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LabelSst.cpp index d8aa414e6e..9e6a4d6bd5 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LabelSst.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/LabelSst.cpp @@ -1,4 +1,5 @@ #include "LabelSst.h" + #include namespace XLS @@ -49,9 +50,19 @@ int LabelSst::serialize(std::wostream & stream) { CP_XML_ATTR(L"r", ref); - if (cell.ixfe.value()) + if ((cell.ixfe.value()) && (cell.ixfe > cellStyleXfs_count)) { - CP_XML_ATTR(L"s", *cell.ixfe.value() - cellStyleXfs_count); + CP_XML_ATTR(L"s", cell.ixfe - cellStyleXfs_count); + } + + CP_XML_ATTR(L"t", L"s"); + + if (isst.value()) + { + CP_XML_NODE(L"v") + { + CP_XML_STREAM() << isst; + } } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulBlank.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulBlank.cpp index f4a1f5a4ed..76958714c8 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulBlank.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/MulBlank.cpp @@ -95,11 +95,11 @@ int MulBlank::serialize(std::wostream & stream) { CP_XML_ATTR(L"r", ref); - if (rgixfe.common_ixfe > 0) + if ((rgixfe.common_ixfe > 0) && (rgixfe.common_ixfe > cellStyleXfs_count)) { CP_XML_ATTR(L"s", rgixfe.common_ixfe - cellStyleXfs_count); } - else if( i < rgixfe.rgixfe.size()) + else if(( i < rgixfe.rgixfe.size()) && (rgixfe.rgixfe[i] > cellStyleXfs_count)) { CP_XML_ATTR(L"s", rgixfe.rgixfe[i] - cellStyleXfs_count); } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp index 3fb62993d0..914f9e0eeb 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/Number.cpp @@ -1,4 +1,5 @@ #include "Number.h" +#include #include namespace XLS @@ -49,9 +50,16 @@ int Number::serialize(std::wostream & stream) { CP_XML_ATTR(L"r", ref); - if (cell.ixfe.value()) + if ((cell.ixfe.value()) && (cell.ixfe > cellStyleXfs_count)) { - CP_XML_ATTR(L"s", *cell.ixfe.value() - cellStyleXfs_count); + CP_XML_ATTR(L"s", cell.ixfe - cellStyleXfs_count); + } + if (num.value()) + { + CP_XML_NODE(L"v") + { + CP_XML_STREAM() << STR::double2str(num); + } } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RK.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RK.cpp index e8cd6a1f23..6067b1c02b 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RK.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/RK.cpp @@ -53,9 +53,13 @@ int RK::serialize(std::wostream & stream) { CP_XML_ATTR(L"r", ref); - if (cell.ixfe.value()) + if ((cell.ixfe.value()) && (cell.ixfe > cellStyleXfs_count)) { - CP_XML_ATTR(L"s", *cell.ixfe.value() - cellStyleXfs_count); + CP_XML_ATTR(L"s", cell.ixfe - cellStyleXfs_count); + } + CP_XML_NODE(L"v") + { + CP_XML_STREAM() << rkrec.RK_.value(); } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SST.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SST.cpp index b3233ad5bc..07222109e4 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SST.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SST.cpp @@ -1,6 +1,7 @@ - #include "SST.h" +#include + namespace XLS {; @@ -74,5 +75,31 @@ void SST::readFields(CFRecord& record) } } + +int SST::serialize(std::wostream & stream) +{ + CP_XML_WRITER(stream) + { + CP_XML_NODE(L"sst") + { + CP_XML_ATTR(L"uniqueCount", rgb.size()); + CP_XML_ATTR(L"xmlns", "http://schemas.openxmlformats.org/spreadsheetml/2006/main"); + + for (long i=0; i < rgb.size(); i++) + { + CP_XML_NODE(L"si") + { + CP_XML_NODE(L"t") + { + XLUnicodeRichExtendedString *richText = dynamic_cast(rgb[i].get()); + CP_XML_STREAM() << richText->str_; + } + } + } + } + } + return 0; +} + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SST.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SST.h index 55e3d0a41b..130dfb2e86 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SST.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/SST.h @@ -23,6 +23,8 @@ public: static const ElementType type = typeSST; + int serialize(std::wostream & stream); + //----------------------------- BIFF_LONG cstTotal; BIFF_LONG cstUnique; @@ -31,14 +33,6 @@ public: //----------------------------- unsigned short code_page_; -public: - //BO_ATTRIB_MARKUP_BEGIN - //BO_ATTRIB_MARKUP_ATTRIB(cstTotal) - //BO_ATTRIB_MARKUP_ATTRIB(cstUnique) - //proc.markVector(rgb, XLUnicodeRichExtendedString(continue_records[rt_Continue])); - ////BO_ATTRIB_MARKUP_VECTOR_COMPLEX(rgb, XLUnicodeRichExtendedString) - //BO_ATTRIB_MARKUP_END - }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.cpp index f719c27395..71995a0732 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/XF.cpp @@ -81,7 +81,7 @@ int XF::serialize(std::wostream & stream) if (ifmt.value()) { - CP_XML_ATTR(L"numFmtIs" , *ifmt.value()); + CP_XML_ATTR(L"numFmtId" , *ifmt.value()); } if(fStyle) diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h index 04e5a8a827..8436fca80a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BitMarkedStructs.h @@ -3,7 +3,7 @@ #include "../../../Common/DocxFormat/Source/Base/Types_32.h" #include "BiffStructure.h" #include "BiffAttribute.h" -//#include +#include #include "Boolean.h" #pragma pack(1) @@ -75,6 +75,18 @@ struct RkNumber : public BiffStructure_NoVtbl return fX100 ? toDouble() / 100.0 : toDouble(); } } + std::wstring value() + { + if(fInt) + { + //return fX100 ? num / 100 : num; + return fX100 ? STR::double2str(num / 100.0) : STR::int2wstr(num); + } + else + { + return STR::double2str( fX100 ? toDouble() / 100.0 : toDouble() ); + } + } private: const double toDouble() const { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.cpp index 1424b95a5d..f70b503d42 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.cpp @@ -1,4 +1,5 @@ #include "BorderFillInfo.h" +#include #include #include @@ -86,13 +87,48 @@ int FillInfo::serialize(std::wostream & stream) { CP_XML_NODE(L"fgColor") { - //if (icvFore < 65 ) + if (foreFillInfo_.enabled) + { + switch(foreFillInfo_.xclrType) + { + case 0://auto + /*CP_XML_ATTR(L"auto");*/ break; + case 1://indexed + CP_XML_ATTR(L"indexed", foreFillInfo_.icv); break; + case 2://rgb + CP_XML_ATTR(L"rgb", STR::toARGB(foreFillInfo_.xclrValue)); break; + case 3://theme color + CP_XML_ATTR(L"theme", foreFillInfo_.xclrValue + 1); + CP_XML_ATTR(L"tint", foreFillInfo_.nTintShade / 32767.0); break; + case 4://not set + break; + } + }else CP_XML_ATTR(L"indexed", icvFore); + } CP_XML_NODE(L"bgColor") { - //if (icvBack < 65 ) + if (backFillInfo_.enabled) + { + switch(backFillInfo_.xclrType) + { + case 0://auto + /*CP_XML_ATTR(L"auto");*/ break; + case 1://indexed + CP_XML_ATTR(L"indexed", backFillInfo_.icv); break; + case 2://rgb + CP_XML_ATTR(L"rgb", STR::toARGB(backFillInfo_.xclrValue)); break; + case 3://theme color + CP_XML_ATTR(L"theme", backFillInfo_.xclrValue + 1); + CP_XML_ATTR(L"tint", backFillInfo_.nTintShade / 32767.0); break; + case 4://not set + break; + } + } + else CP_XML_ATTR(L"indexed", icvBack); + } } } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h index c7ad054afa..56be8a4094 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/BorderFillInfo.h @@ -5,6 +5,17 @@ namespace XLS {; +struct FillInfoExt +{ + FillInfoExt() {enabled = false; xclrType = icv = 0; nTintShade = 0; xclrValue = 0;} + bool enabled; + + unsigned char xclrType; + unsigned char icv; + short nTintShade; + unsigned int xclrValue; +}; + struct FillInfo { FillInfo(){} @@ -31,6 +42,13 @@ struct FillInfo friend std::size_t hash_value(FillInfo const & val); int serialize(std::wostream & stream); + +//additional ( , ) + + FillInfoExt foreFillInfo_; + FillInfoExt backFillInfo_; + + }; struct BorderInfo diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.cpp index 2e9f941177..d9233b34eb 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.cpp @@ -1,5 +1,6 @@ #include "CellXF.h" +#include "ExtProp.h" #include #include @@ -19,89 +20,6 @@ BiffStructurePtr CellXF::clone() return BiffStructurePtr(new CellXF(*this)); } - -//void CellXF::setXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag) -//{ -// xml_tag->setAttribute(L"alc", alc); -// xml_tag->setAttribute(L"fWrap", fWrap); -// xml_tag->setAttribute(L"alcV", alcV); -// xml_tag->setAttribute(L"fJustLast", fJustLast); -// xml_tag->setAttribute(L"trot", trot); -// xml_tag->setAttribute(L"cIndent", cIndent); -// xml_tag->setAttribute(L"fShrinkToFit", fShrinkToFit); -// xml_tag->setAttribute(L"iReadOrder", iReadOrder); -// xml_tag->setAttribute(L"fAtrNum", fAtrNum); -// xml_tag->setAttribute(L"fAtrFnt", fAtrFnt); -// xml_tag->setAttribute(L"fAtrAlc", fAtrAlc); -// xml_tag->setAttribute(L"fAtrBdr", fAtrBdr); -// xml_tag->setAttribute(L"fAtrPat", fAtrPat); -// xml_tag->setAttribute(L"fAtrProt", fAtrProt); -// -// xml_tag->setAttribute(L"dgLeft", border.dgLeft); -// xml_tag->setAttribute(L"dgRight", border.dgRight); -// xml_tag->setAttribute(L"dgTop", border.dgTop); -// xml_tag->setAttribute(L"dgBottom", border.dgBottom); -// xml_tag->setAttribute(L"icvLeft", border.icvLeft); -// xml_tag->setAttribute(L"icvRight", border.icvRight); -// xml_tag->setAttribute(L"grbitDiag", border.grbitDiag); -// -// xml_tag->setAttribute(L"icvTop", border.icvTop); -// xml_tag->setAttribute(L"icvBottom", border.icvBottom); -// xml_tag->setAttribute(L"icvDiag", border.icvDiag); -// xml_tag->setAttribute(L"dgDiag", border.dgDiag); -// xml_tag->setAttribute(L"fHasXFExt", fHasXFExt); -// xml_tag->setAttribute(L"fls", fill.fls); -// -// xml_tag->setAttribute(L"icvFore", fill.icvFore); -// xml_tag->setAttribute(L"icvBack", fill.icvBack); -// xml_tag->setAttribute(L"fsxButton", fsxButton); -// -// xml_tag->setAttribute(L"xf_current_id", cell_xf_current_id_ + style_xf_current_id_); -// xml_tag->setAttribute(L"cell_xf_current_id", cell_xf_current_id_++); -// -// xml_tag->setAttribute(L"border_x_id", border_x_id); -// xml_tag->setAttribute(L"fill_x_id", fill_x_id); -//} -// -// -//void CellXF::getXMLAttributes(MSXML2::IXMLDOMElementPtr xml_tag) -//{ -// alc = getStructAttribute(xml_tag, L"alc"); -// fWrap = getStructAttribute(xml_tag, L"fWrap"); -// alcV = getStructAttribute(xml_tag, L"alcV"); -// fJustLast = getStructAttribute(xml_tag, L"fJustLast"); -// trot = getStructAttribute(xml_tag, L"trot"); -// cIndent = getStructAttribute(xml_tag, L"cIndent"); -// fShrinkToFit = getStructAttribute(xml_tag, L"fShrinkToFit"); -// iReadOrder = getStructAttribute(xml_tag, L"iReadOrder"); -// fAtrNum = getStructAttribute(xml_tag, L"fAtrNum"); -// fAtrFnt = getStructAttribute(xml_tag, L"fAtrFnt"); -// fAtrAlc = getStructAttribute(xml_tag, L"fAtrAlc"); -// fAtrBdr = getStructAttribute(xml_tag, L"fAtrBdr"); -// fAtrPat = getStructAttribute(xml_tag, L"fAtrPat"); -// fAtrProt = getStructAttribute(xml_tag, L"fAtrProt"); -// -// border.dgLeft = getStructAttribute(xml_tag, L"dgLeft"); -// border.dgRight = getStructAttribute(xml_tag, L"dgRight"); -// border.dgTop = getStructAttribute(xml_tag, L"dgTop"); -// border.dgBottom = getStructAttribute(xml_tag, L"dgBottom"); -// border.icvLeft = getStructAttribute(xml_tag, L"icvLeft"); -// border.icvRight = getStructAttribute(xml_tag, L"icvRight"); -// border.grbitDiag = getStructAttribute(xml_tag, L"grbitDiag"); -// -// border.icvTop = getStructAttribute(xml_tag, L"icvTop"); -// border.icvBottom = getStructAttribute(xml_tag, L"icvBottom"); -// border.icvDiag = getStructAttribute(xml_tag, L"icvDiag"); -// border.dgDiag = getStructAttribute(xml_tag, L"dgDiag"); -// fHasXFExt = getStructAttribute(xml_tag, L"fHasXFExt"); -// fill.fls = getStructAttribute(xml_tag, L"fls"); -// -// fill.icvFore = getStructAttribute(xml_tag, L"icvFore"); -// fill.icvBack = getStructAttribute(xml_tag, L"icvBack"); -// fsxButton = getStructAttribute(xml_tag, L"fsxButton"); -//} -// -// void CellXF::store(CFRecord& record) { unsigned int flags = 0; @@ -196,14 +114,49 @@ void CellXF::load(CFRecord& record) void CellXF::RegisterFillBorder() { + for (long i = 0; i < ext_props.size(); i++ ) + { + ExtProp* ext_prop = dynamic_cast(ext_props[i].get()); + + switch(ext_prop->extType) + { + case 0x0004: + { + fill.foreFillInfo_.enabled = true; + fill.foreFillInfo_.icv = ext_prop->extPropData.color.icv; + fill.foreFillInfo_.xclrType = ext_prop->extPropData.color.xclrType; + fill.foreFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade; + fill.foreFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue; + }break; + case 0x0005: + { + fill.backFillInfo_.enabled = true; + fill.backFillInfo_.icv = ext_prop->extPropData.color.icv; + fill.backFillInfo_.xclrType = ext_prop->extPropData.color.xclrType; + fill.backFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade; + fill.backFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue; + }break; + //case 0x0007: + //case 0x0008: + //case 0x0009: + //case 0x000A: + //case 0x000B: + //case 0x000C: + //case 0x000D: + // extPropData.color.toXML(own_tag); + // break; + //case 0x0006: + // extPropData.gradient_fill.toXML(own_tag); + // break; + //case 0x000E: + // own_tag->Puttext(STR::int2str(extPropData.font_scheme, 10).c_str()); + // break; + //case 0x000F: + // own_tag->Puttext(STR::int2str(extPropData.indent_level, 10).c_str()); + // break; + } + } border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border); - - if (ext_props.size() > 0 ) - { - } - else - { - } fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill); } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.h index 71a0287b54..119075e049 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/CellXF.h @@ -2,12 +2,13 @@ #include "BiffStructure.h" #include "BorderFillInfo.h" -#include "ExtProp.h" namespace XLS {; class CFRecord; +class GlobalWorkbookInfo; +typedef boost::shared_ptr GlobalWorkbookInfoPtr; class CellXF : public BiffStructure { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ExtProp.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ExtProp.cpp index eddb478bd4..1a4c647fa2 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ExtProp.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ExtProp.cpp @@ -12,42 +12,6 @@ BiffStructurePtr ExtProp::clone() return BiffStructurePtr(new ExtProp(*this)); } - -//void ExtProp::toXML(BiffStructurePtr & parent) -//{ -// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent); -// own_tag->setAttribute(L"extType", extType); -// own_tag->setAttribute(L"cb", cb); -// -// switch(extType) -// { -// case 0x0004: -// case 0x0005: -// case 0x0007: -// case 0x0008: -// case 0x0009: -// case 0x000A: -// case 0x000B: -// case 0x000C: -// case 0x000D: -// extPropData.color.toXML(own_tag); -// break; -// case 0x0006: -// extPropData.gradient_fill.toXML(own_tag); -// break; -// case 0x000E: -// own_tag->Puttext(STR::int2str(extPropData.font_scheme, 10).c_str()); -// break; -// case 0x000F: -// own_tag->Puttext(STR::int2str(extPropData.indent_level, 10).c_str()); -// break; -// default: -// break; -// } -// -//} -// - void ExtProp::store(CFRecord& record) { #pragma message("####################### ExtProp record has no BiffStructure::store() implemented") diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ExtProp.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ExtProp.h index 70065418fd..da76c39812 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ExtProp.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/ExtProp.h @@ -15,14 +15,12 @@ class ExtProp : public BiffStructure public: BiffStructurePtr clone(); - //virtual void toXML(BiffStructurePtr & parent); - //virtual const bool fromXML(BiffStructurePtr & parent); virtual void load(CFRecord& record); virtual void store(CFRecord& record); -private: unsigned short extType; unsigned short cb; + struct extPropData_Tag { FullColorExt color; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/FullColorExt.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/FullColorExt.cpp index 352afef63b..768239a14d 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/FullColorExt.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/FullColorExt.cpp @@ -11,27 +11,6 @@ BiffStructurePtr FullColorExt::clone() return BiffStructurePtr(new FullColorExt(*this)); } -// -//void FullColorExt::toXML(BiffStructurePtr & parent) -//{ -// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent); -// own_tag->setAttribute(L"xclrType", xclrType); -// own_tag->setAttribute(L"numTint", static_cast(nTintShade) / 32767.0); // universal names for any color providing structures -// own_tag->setAttribute(L"xclrValue", xclrValue); -// if(2 == xclrType) // if the type is ARGB -// { -// own_tag->setAttribute(L"argb", STR::toARGB(xclrValue).c_str()); -// } -//} - -//const bool FullColorExt::fromXML(BiffStructurePtr & parent) -//{ -//#pragma message("####################### FullColorExt record has no BiffStructure::fromXML() implemented") -// Log::error(" Error!!! FullColorExt record has no BiffStructure::fromXML() implemented."); -// return false; -//} - - void FullColorExt::store(CFRecord& record) { #pragma message("####################### FullColorExt record has no BiffStructure::store() implemented") @@ -42,7 +21,7 @@ void FullColorExt::store(CFRecord& record) void FullColorExt::load(CFRecord& record) { - record >> xclrType >> nTintShade >> xclrValue; + record >> xclrType >> icv >> nTintShade >> xclrValue; record.skipNunBytes(8); //unused } diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/FullColorExt.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/FullColorExt.h index bba1ea0039..cedeb1325e 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/FullColorExt.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/FullColorExt.h @@ -13,15 +13,13 @@ class FullColorExt : public BiffStructure public: BiffStructurePtr clone(); - //virtual void toXML(BiffStructurePtr & parent); - //virtual const bool fromXML(BiffStructurePtr & parent); virtual void load(CFRecord& record); virtual void store(CFRecord& record); -private: - unsigned short xclrType; - short nTintShade; - unsigned int xclrValue; + unsigned char icv; + unsigned char xclrType; + short nTintShade; + unsigned int xclrValue; }; } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/GradStop.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/GradStop.cpp index e89cff2d3b..88d07cbbac 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/GradStop.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/GradStop.cpp @@ -11,30 +11,6 @@ BiffStructurePtr GradStop::clone() return BiffStructurePtr(new GradStop(*this)); } -// -//void GradStop::toXML(BiffStructurePtr & parent) -//{ -// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent); -// own_tag->setAttribute(L"xclrType", xclrType); -// if(2 == xclrType) -// { -// xclrValue_rgb.toXML(own_tag); -// } -// else -// { -// own_tag->setAttribute(L"xclrValue", xclrValue); -// } -// own_tag->setAttribute(L"numPosition", numPosition); -// own_tag->setAttribute(L"numTint", numTint); -//} -// -//const bool GradStop::fromXML(BiffStructurePtr & parent) -//{ -//#pragma message("####################### GradStop record has no BiffStructure::fromXML() implemented") -// Log::error(" Error!!! GradStop record has no BiffStructure::fromXML() implemented."); -// return false; -//} - void GradStop::store(CFRecord& record) { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/GradStop.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/GradStop.h index 26cb05f615..2dc9e726aa 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/GradStop.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/GradStop.h @@ -14,12 +14,9 @@ class GradStop : public BiffStructure public: BiffStructurePtr clone(); - //virtual void toXML(BiffStructurePtr & parent); - //virtual const bool fromXML(BiffStructurePtr & parent); virtual void load(CFRecord& record); virtual void store(CFRecord& record); -private: unsigned short xclrType; unsigned int xclrValue; LongRGBA xclrValue_rgb; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/RkRec.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/RkRec.cpp index a9edc19d95..642e01a013 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/RkRec.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/RkRec.cpp @@ -4,30 +4,13 @@ namespace XLS {; - +extern int cellStyleXfs_count; BiffStructurePtr RkRec::clone() { return BiffStructurePtr(new RkRec(*this)); } -// -//void RkRec::toXML(BiffStructurePtr & parent) -//{ -// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent); -// -// own_tag->setAttribute(L"RK", RK_); -//} -// -// -//const bool RkRec::fromXML(BiffStructurePtr & parent) -//{ -//#pragma message("####################### RkRec record has no BiffStructure::fromXML() implemented") -// Log::error(" Error!!! RkRec record has no BiffStructure::fromXML() implemented."); -// return false; -//} - - void RkRec::store(CFRecord& record) { record << ixfe << RK_; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/RkRec.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/RkRec.h index 0b91a44e3c..2905f7afeb 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/RkRec.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/RkRec.h @@ -14,13 +14,11 @@ class RkRec : public BiffStructure public: BiffStructurePtr clone(); - //virtual void toXML(BiffStructurePtr & parent); - //virtual const bool fromXML(BiffStructurePtr & parent); virtual void load(CFRecord& record); virtual void store(CFRecord& record); + const unsigned short get_ixfe() const; -public: unsigned short ixfe; RkNumber RK_; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.cpp index 4d6cf400e5..60fd1ee7a5 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.cpp @@ -1,5 +1,6 @@ #include "StyleXF.h" +#include "ExtProp.h" #include #include @@ -96,15 +97,53 @@ void StyleXF::load(CFRecord& record) void StyleXF::RegisterFillBorder() { - border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border); + for (long i = 0; i < ext_props.size(); i++ ) + { + ExtProp* ext_prop = dynamic_cast(ext_props[i].get()); - if (ext_props.size() > 0 ) - { - } - else - { - } + switch(ext_prop->extType) + { + case 0x0004: + { + fill.foreFillInfo_.enabled = true; + fill.foreFillInfo_.icv = ext_prop->extPropData.color.icv; + fill.foreFillInfo_.xclrType = ext_prop->extPropData.color.xclrType; + fill.foreFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade; + fill.foreFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue; + }break; + case 0x0005: + { + fill.backFillInfo_.enabled = true; + fill.backFillInfo_.icv = ext_prop->extPropData.color.icv; + fill.backFillInfo_.xclrType = ext_prop->extPropData.color.xclrType; + fill.backFillInfo_.nTintShade = ext_prop->extPropData.color.nTintShade; + fill.backFillInfo_.xclrValue = ext_prop->extPropData.color.xclrValue; + }break; + //case 0x0007: + //case 0x0008: + //case 0x0009: + //case 0x000A: + //case 0x000B: + //case 0x000C: + //case 0x000D: + // extPropData.color.toXML(own_tag); + // break; + //case 0x0006: + // extPropData.gradient_fill.toXML(own_tag); + // break; + //case 0x000E: + // own_tag->Puttext(STR::int2str(extPropData.font_scheme, 10).c_str()); + // break; + //case 0x000F: + // own_tag->Puttext(STR::int2str(extPropData.indent_level, 10).c_str()); + // break; + } + } + + border_x_id = m_GlobalWorkbookInfo->RegisterBorderId(border); fill_x_id = m_GlobalWorkbookInfo->RegisterFillId(fill); + + } int StyleXF::serialize(std::wostream & stream) { diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.h index 6f5aa1351d..332714846a 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/StyleXF.h @@ -2,12 +2,13 @@ #include "BiffStructure.h" #include "BorderFillInfo.h" -#include "ExtProp.h" namespace XLS {; class CFRecord; +class GlobalWorkbookInfo; +typedef boost::shared_ptr GlobalWorkbookInfoPtr; class StyleXF : public BiffStructure { @@ -25,14 +26,14 @@ public: void RegisterFillBorder(); - unsigned char alc; - bool fWrap; - unsigned char alcV; - bool fJustLast; - unsigned char trot; - unsigned char cIndent; - bool fShrinkToFit; - unsigned char iReadOrder; + unsigned char alc; + bool fWrap; + unsigned char alcV; + bool fJustLast; + unsigned char trot; + unsigned char cIndent; + bool fShrinkToFit; + unsigned char iReadOrder; BorderInfo border; FillInfo fill; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFExtGradient.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFExtGradient.h index 695c705d27..903fa633c6 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFExtGradient.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFExtGradient.h @@ -9,23 +9,18 @@ namespace XLS class CFRecord; -//#pragma pack(1) class XFExtGradient : public BiffStructure { BASE_STRUCTURE_DEFINE_CLASS_NAME(XFExtGradient) public: BiffStructurePtr clone(); - //virtual void toXML(BiffStructurePtr & parent); - //virtual const bool fromXML(BiffStructurePtr & parent); virtual void load(CFRecord& record); virtual void store(CFRecord& record); -private: - XFPropGradient gradient; - unsigned int cGradStops; - std::vector rgGradStops; + XFPropGradient gradient; + unsigned int cGradStops; + std::vector rgGradStops; }; -//#pragma pack() // restore } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradient.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradient.cpp index 430f9b9f25..c85d9bcd0f 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradient.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradient.cpp @@ -11,26 +11,6 @@ BiffStructurePtr XFPropGradient::clone() return BiffStructurePtr(new XFPropGradient(*this)); } - -//void XFPropGradient::toXML(BiffStructurePtr & parent) -//{ -// MSXML2::IXMLDOMElementPtr own_tag = XMLSTUFF::createElement(getClassName(), parent); -// own_tag->setAttribute(L"type", type); -// own_tag->setAttribute(L"numDegree", numDegree); -// own_tag->setAttribute(L"numFillToLeft", numFillToLeft); -// own_tag->setAttribute(L"numFillToRight", numFillToRight); -// own_tag->setAttribute(L"numFillToTop", numFillToTop); -// own_tag->setAttribute(L"numFillToBottom", numFillToBottom); -//} - -//const bool XFPropGradient::fromXML(BiffStructurePtr & parent) -//{ -//#pragma message("####################### XFPropGradient record has no BiffStructure::fromXML() implemented") -// Log::error(" Error!!! XFPropGradient record has no BiffStructure::fromXML() implemented."); -// return false; -//} - - void XFPropGradient::store(CFRecord& record) { #pragma message("####################### XFPropGradient record has no BiffStructure::store() implemented") diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradient.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradient.h index ecf775bb54..a4a053b5b8 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradient.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XFPropGradient.h @@ -13,13 +13,9 @@ class XFPropGradient : public BiffStructure BASE_STRUCTURE_DEFINE_CLASS_NAME(XFPropGradient) public: BiffStructurePtr clone(); - - //virtual void toXML(BiffStructurePtr & parent); - //virtual const bool fromXML(BiffStructurePtr & parent); virtual void load(CFRecord& record); virtual void store(CFRecord& record); -private: Boolean type; double numDegree; double numFillToLeft; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XLUnicodeRichExtendedString.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XLUnicodeRichExtendedString.h index b7d12102e8..9f2788fece 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XLUnicodeRichExtendedString.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_structures/XLUnicodeRichExtendedString.h @@ -30,16 +30,16 @@ public: const size_t getNonVariablePartSize() const; const size_t getFullSize() const; -//private: - // Append data of the next Continue record if exists and remove it from the list const bool appendNextContinue(CFRecord& record, const bool read_high_byte); -private: std::wstring str_; + bool fHighByte; bool fExtSt; bool fRichSt; + std::vector rgRun; + ExtRst extRst; std::list& cont_recs_; bool mark_set_start; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.cpp index d1429845b3..815a7a2f82 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.cpp @@ -3,6 +3,8 @@ #include #include +#include + namespace XLS {; @@ -35,5 +37,15 @@ const bool SHAREDSTRINGS::loadContent(BinProcessor& proc) return true; } +int SHAREDSTRINGS::serialize(std::wostream & stream) +{ + for (std::list::iterator it = elements_.begin(); it != elements_.end(); it++) + { + (*it)->serialize(stream); + } + return 0; +} + + } // namespace XLS diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.h index 5901d51a06..ce7145c92f 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.h @@ -20,6 +20,7 @@ public: static const ElementType type = typeSHAREDSTRINGS; + int serialize(std::wostream & stream); unsigned short code_page_; }; diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp b/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp index bbc3de7d71..3a11e4dc6b 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp @@ -175,7 +175,13 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc) proc.optional(); proc.repeated(0, 0); ///// proc.repeated(MSODRAWINGGROUP(false), 0, 0); - proc.optional(SHAREDSTRINGS(code_page_)); + + if (proc.optional(SHAREDSTRINGS(code_page_))) + { + m_SHAREDSTRINGS = elements_.back(); + elements_.pop_back(); + } + proc.optional(); // OpenOffice Calc stored files workaround (ExtSST is mandatory according to [MS-XLS]) proc.repeated(0, 0); proc.optional(); diff --git a/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.h b/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.h index 528530e13e..c0f0a67c69 100644 --- a/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.h +++ b/ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.h @@ -28,6 +28,7 @@ public: BaseObjectPtr m_Theme; BaseObjectPtr m_Formating; BaseObjectPtr m_Template; + BaseObjectPtr m_SHAREDSTRINGS; unsigned short code_page_; }; diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp index c6481e96d2..fe87298ec5 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.cpp @@ -14,6 +14,7 @@ #include "../XlsFormat/Logic/Biff_unions/THEME.h" #include "../XlsFormat/Logic/Biff_unions/GLOBALS.h" #include "../XlsFormat/Logic/Biff_unions/COLUMNS.h" +#include "../XlsFormat/Logic/Biff_unions/SHAREDSTRINGS.h" #include "xlsx_conversion_context.h" @@ -151,7 +152,7 @@ void XlsConverter::convert(XLS::BaseObject *xls_unknown) { for (std::list::iterator it = xls_unknown->elements_.begin(); it != xls_unknown->elements_.end(); it++) { - it->get()->serialize(xlsx_context->current_stream()); + (*it)->serialize(xlsx_context->current_stream()); } } } @@ -230,16 +231,8 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global) convert((XLS::THEME*)global->m_Theme.get()); + convert((XLS::SHAREDSTRINGS*)global->m_SHAREDSTRINGS.get()); } -template -struct map_data_compare : public std::binary_function -{ - public: - bool operator() (typename T::value_type &pair,typename T::mapped_type i) - { - return pair.second == i; - } -}; typedef boost::unordered_map mapFillInfo; typedef boost::unordered_map mapBorderInfo; @@ -301,4 +294,14 @@ void XlsConverter::convert(XLS::FORMATTING* formating) void XlsConverter::convert(XLS::THEME* theme) { if (theme == NULL) return; +} + +void XlsConverter::convert(XLS::SHAREDSTRINGS* sharedstrings) +{ + if (sharedstrings == NULL) return; + + for (std::list::iterator it = sharedstrings->elements_.begin(); it != sharedstrings->elements_.end(); it++) + { + (*it)->serialize(xlsx_context->shared_strings()); + } } \ No newline at end of file diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h index 73ef006583..9fb2808e61 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/XlsConverter.h @@ -28,6 +28,7 @@ namespace XLS class FORMATTING; class THEME; + class SHAREDSTRINGS; } @@ -58,6 +59,7 @@ private: void convert(XLS::GlobalsSubstream * elem); void convert(XLS::FORMATTING * formating); void convert(XLS::THEME * theme); + void convert(XLS::SHAREDSTRINGS * sharedstrings); }; diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp index 21c84dbfb7..37b5a97661 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.cpp @@ -228,10 +228,8 @@ void xlsx_conversion_context::end_document() //} //workbook_content << L""; - { - std::wstringstream strm; - xlsx_text_context_.write_shared_strings(strm); - output_document_->get_xl_files().set_sharedStrings( package::simple_element::create(L"sharedStrings.xml", strm.str()) ); + { + output_document_->get_xl_files().set_sharedStrings( package::simple_element::create(L"sharedStrings.xml", xlsx_shared_strings_.str()) ); } diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h index 7467959739..7b64fbeac7 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_conversion_context.h @@ -28,6 +28,7 @@ public: void end_document(); std::wostream & current_stream(); + std::wostream & shared_strings() {return xlsx_shared_strings_;} // void start_chart(std::wstring const & name); @@ -124,6 +125,8 @@ private: //xlsx_defined_names xlsx_defined_names_; xlsx_table_context xlsx_table_context_; xlsx_text_context xlsx_text_context_; + std::wstringstream xlsx_shared_strings_; + //xlsx_drawing_context_handle xlsx_drawing_context_handle_; //xlsx_comments_context_handle xlsx_comments_context_handle_; diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_sharedstrings.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_sharedstrings.cpp deleted file mode 100644 index fa228ac419..0000000000 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_sharedstrings.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include - -#include - -#include "utils.h" - -#include "xlsx_sharedstrings.h" - - -namespace oox { - -class xlsx_shared_strings::Impl -{ -public: - void xlsx_serialize(std::wostream & _Wostream) const; - size_t add(const std::wstring & content); - -private: - std::vector strings_; -}; - -void xlsx_shared_strings::Impl::xlsx_serialize(std::wostream & _Wostream) const -{ - _Wostream << L""; - - BOOST_FOREACH(const std::wstring & str, strings_) - { - _Wostream << L""; - _Wostream << str; - _Wostream << L""; - } - - _Wostream << L""; -} - -size_t xlsx_shared_strings::Impl::add(const std::wstring & content) -{ - strings_.push_back(content); - return strings_.size() - 1; -} - -xlsx_shared_strings::xlsx_shared_strings(): impl_( new xlsx_shared_strings::Impl() ) -{ -} - -xlsx_shared_strings::~xlsx_shared_strings() -{ -} - -void xlsx_shared_strings::xlsx_serialize(std::wostream & _Wostream) const -{ - return impl_->xlsx_serialize(_Wostream); -} - -size_t xlsx_shared_strings::add(const std::wstring & content) -{ - return impl_->add(content); -} - -} diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_sharedstrings.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_sharedstrings.h deleted file mode 100644 index 81f0a6de9b..0000000000 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_sharedstrings.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include -#include -#include - - -namespace oox { - -class xlsx_shared_strings: boost::noncopyable -{ -public: - xlsx_shared_strings(); - ~xlsx_shared_strings(); - -public: - void xlsx_serialize(std::wostream & _Wostream) const; - size_t add(const std::wstring & content); - -private: - class Impl; - boost::scoped_ptr impl_; -}; - -} diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_textcontext.cpp b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_textcontext.cpp index 307ed69146..15dd743649 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_textcontext.cpp +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_textcontext.cpp @@ -45,8 +45,7 @@ public: void start_drawing_content(); std::wstring end_drawing_content(); - void write_shared_strings(std::wostream & strm); - + void ApplyTextProperties(); void set_local_styles_container();//это если стили объектов содержатся в другом документе @@ -76,17 +75,12 @@ private: std::wstringstream text_; std::wstringstream output_; - xlsx_shared_strings xlsx_shared_strings_; std::wstring paragraph_style_name_;//был вектор ... не нужен, так как в один момент времени может быть тока один стиль параграфа,текста,объекта при приходе нового - дампится std::wstring span_style_name_; }; -void xlsx_text_context::Impl::write_shared_strings(std::wostream & strm) -{ - xlsx_shared_strings_.xlsx_serialize(strm); -} xlsx_text_context::Impl::Impl(): paragraphs_cout_(0), @@ -341,7 +335,7 @@ int xlsx_text_context::Impl::end_cell_content() { dump_text(); - const int sharedStrId = output_.str().empty() ? (-1) : static_cast(xlsx_shared_strings_.add(output_.str())); + const int sharedStrId = 0;//output_.str().empty() ? (-1) : static_cast(xlsx_shared_strings_.add(output_.str())); //???? нужно ли здесь очищать все ????? - проверить стили на кучках - и проверить как меняются стили внутри одной ячейки - то есть здешнее переопределение внешнего стиля in_cell_content = false; return sharedStrId; @@ -436,10 +430,6 @@ std::wstring xlsx_text_context::end_drawing_content() { return impl_->end_drawing_content(); } -void xlsx_text_context::write_shared_strings(std::wostream & strm) -{ - return impl_->write_shared_strings(strm); -} } diff --git a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_textcontext.h b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_textcontext.h index b0aeeeaee0..8b1f863d77 100644 --- a/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_textcontext.h +++ b/ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_textcontext.h @@ -42,8 +42,6 @@ public: void add_text(const std::wstring & text); - void write_shared_strings(std::wostream & strm); - bool is_drawing_context(); private: diff --git a/ASCOfficeXlsFile2/source/win32/XlsXlsxConverter.vcproj b/ASCOfficeXlsFile2/source/win32/XlsXlsxConverter.vcproj index 71d9a13095..189e16289f 100644 --- a/ASCOfficeXlsFile2/source/win32/XlsXlsxConverter.vcproj +++ b/ASCOfficeXlsFile2/source/win32/XlsXlsxConverter.vcproj @@ -372,14 +372,6 @@ RelativePath="..\XlsXlsxConverter\xlsx_package.h" > - - - -