Commit f6e08db4 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

XlsFile2 - styles

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63583 954022d7-b5bf-4e40-9824-e11837661b57
parent 23e5e6d7
......@@ -2,7 +2,7 @@
#include "HelpFunc.h"
#include "shlwapi.h"
//#include <Exception/UnexpectedProgramPath.h>
#include <Logic/Biff_structures/CellRangeRef.h>
#include <boost/regex.hpp>
#include <boost/lexical_cast.hpp>
......@@ -393,17 +393,9 @@ const size_t hex_str2int(const std::wstring::const_iterator& it_begin, const std
return numeric;
}
//const std::wstring hres2str(const HRESULT hres)
//{
// _com_error error(hres);
// std::string errorText = error.ErrorMessage();
// return (errorText);
//}
const std::string toStdString(const std::wstring& wide_string, const unsigned int code_page)
{
//todooo ðàçðóëèòü íà linux - e !!!
unsigned int bufferSize = (unsigned int)wide_string.length() + 1;
boost::scoped_array<char> pBuffer(new char[bufferSize]);
WideCharToMultiByte(code_page, 0, wide_string.c_str(), (int)wide_string.length(), pBuffer.get(), bufferSize, NULL, NULL);
......@@ -414,6 +406,7 @@ const std::string toStdString(const std::wstring& wide_string, const unsigned in
const std::wstring toStdWString(const std::string& ansi_string, const unsigned int code_page)
{
//todooo ðàçðóëèòü íà linux - e !!!
unsigned int bufferSize = (unsigned int)ansi_string.length() + 1;
boost::scoped_array<wchar_t> pBuffer(new wchar_t[bufferSize]);
unsigned int code = code_page == 1251 ? 1252 : code_page ;
......@@ -429,60 +422,7 @@ const std::wstring toStdWString(const std::string& ansi_string, const unsigned i
namespace XMLSTUFF
{;
//
//
//const bool loadXSLTFromResources(MSXML2::IXMLDOMDocumentPtr xslt_doc, const std::vector<std::wstring>& resources)
//{
// if(resources.empty())
// {
// return true;
// }
// //std::wstring prefix = std::wstring(L"res://") + moduleFileName() + L"/XSL/";
//
// if(VARIANT_TRUE != xslt_doc->load(resources.begin()->c_str()))
// {
// return false;
// }
// MSXML2::IXMLDOMNodePtr dst_node = xslt_doc->GetdocumentElement(); // assuming xsl:stylesheet
// if(!dst_node)
// {
// return false;
// }
// for (std::vector<std::wstring>::const_iterator it = ++resources.begin(), itEnd = resources.end(); it != itEnd; ++it)
// {
// MSXML2::IXMLDOMDocument3Ptr another_xslt(_T("Msxml2.FreeThreadedDOMDocument.6.0"));
// another_xslt->Putasync(VARIANT_TRUE);
// if(VARIANT_TRUE != another_xslt->load(it->c_str()))
// {
// return false;
// }
// MSXML2::IXMLDOMDocumentFragmentPtr fragment = another_xslt->createDocumentFragment();
// //MSXML2::IXMLDOMNodeListPtr ins_elems = another_xslt->selectNodes(L"xsl:stylesheet/* | xsl:stylesheet/@*" );
// MSXML2::IXMLDOMNodePtr root_node = another_xslt->GetdocumentElement(); // assuming xsl:stylesheet
// MSXML2::IXMLDOMNodeListPtr ins_elems = root_node->GetchildNodes();
// MSXML2::IXMLDOMNodePtr child;
// while(child = ins_elems->nextNode())
// {
// fragment->appendChild(child->cloneNode(VARIANT_TRUE));
// }
//
// dst_node->appendChild(fragment);
// }
//
// return true;
//}
//
//
//// Makes a new XML tag and append it to parent (no attributes set)
//BiffStructurePtr createElement(const std::wstring & tag_name, BiffStructurePtr & parent)
//{
// BiffStructurePtr own_tag;// = createElement(tag_name);
//
// if (parent)
// parent->appendChild(own_tag);
//
// return own_tag;
//}
const std::wstring tab2sheet_name(const short tabid, std::vector<std::wstring>& sheets_names)
......@@ -532,56 +472,6 @@ const std::wstring make3dRef(const unsigned short ixti, const std::wstring cell_
return sheets_prefix + L'!' + cell_ref;
}
//
//const std::wstring sheet_name2tabid(const std::wstring sheet_name, MSXML2::IXMLDOMDocumentPtr doc)
//{
// std::wstring query = L"root/WorkbookStreamObject/GlobalsSubstream/BUNDLESHEET/BoundSheet8";
// MSXML2::IXMLDOMNodeListPtr nodes = doc->selectNodes(query);
// MSXML2::IXMLDOMElementPtr sheet;
// for(size_t counter = 0; (sheet = nodes->nextNode()); ++counter)
// {
// MSXML2::IXMLDOMAttributePtr stName(sheet->getAttributeNode(L"stName"));
// if(stName && std::wstring (sheet_name.c_str()) == static_cast<std::wstring >(stName->Getvalue()))
// {
// return STR::int2wstr(counter).c_str();
// }
// }
// return L"-1";
//}
//
//
//const unsigned short sheetsnames2ixti(const std::wstring str, MSXML2::IXMLDOMDocumentPtr doc)
//{
// std::wstring sheet_first_id;
// std::wstring sheet_last_id;
// size_t colon_pos = str.find_first_of(L':');
// if(std::wstring::npos == colon_pos)
// {
// sheet_last_id = sheet_first_id = sheet_name2tabid(str, doc);
// }
// else
// {
// sheet_first_id = sheet_name2tabid(str.substr(0, colon_pos), doc);
// sheet_last_id = sheet_name2tabid(str.substr(colon_pos + 1, str.length() - colon_pos - 1), doc);
// }
//
// std::wstring query(L"root/WorkbookStreamObject/GlobalsSubstream/SUPBOOK/ExternSheet/XTI");
// MSXML2::IXMLDOMNodeListPtr nodes = doc->selectNodes(query);
// MSXML2::IXMLDOMElementPtr xti;
// for(size_t counter = 0; (xti = nodes->nextNode()); ++counter)
// {
// MSXML2::IXMLDOMAttributePtr itabFirst(xti->getAttributeNode(L"itabFirst"));
// MSXML2::IXMLDOMAttributePtr itabLast(xti->getAttributeNode(L"itabLast"));
// if(itabFirst && itabLast && sheet_first_id == static_cast<std::wstring >(itabFirst->Getvalue()) &&
// sheet_last_id == static_cast<std::wstring >(itabLast->Getvalue()))
// {
// return counter;
// }
// }
// return 0xFFFF;
//}
//
//
//
} //namespace XMLSTUFF
......@@ -61,13 +61,13 @@ int Font::serialize(std::wostream & stream)
{
CP_XML_NODE(L"font")
{
//if (font.bold)
//{
// CP_XML_NODE(L"b")
// {
// CP_XML_ATTR(L"val", (int)(*font.bold));
// }
//}
if ((bls.value()) && (*bls.value() == 700))
{
CP_XML_NODE(L"b")
{
CP_XML_ATTR(L"val", true);
}
}
if (bCharSet.value())
{
......@@ -77,10 +77,15 @@ int Font::serialize(std::wostream & stream)
}
}
//if (icv.val)
// xlsx_serialize(CP_XML_STREAM(), *icv.val);
if (icv.value())
{
CP_XML_NODE(L"color")
{
CP_XML_ATTR(L"indexed", *icv.value());
}
}
if (fCondense.value())
if ((fCondense.value()) && (*fCondense.value()))
{
CP_XML_NODE(L"condense")
{
......@@ -88,7 +93,7 @@ int Font::serialize(std::wostream & stream)
}
}
if (fExtend.value())
if ((fExtend.value()) && (*fExtend.value()))
{
CP_XML_NODE(L"extend")
{
......@@ -104,7 +109,7 @@ int Font::serialize(std::wostream & stream)
}
}
if (fItalic.value())
if ((fItalic.value()) && (*fItalic.value()))
{
CP_XML_NODE(L"i")
{
......@@ -136,7 +141,7 @@ int Font::serialize(std::wostream & stream)
// }
//}
if (fShadow.value())
if ((fShadow.value()) && (*fShadow.value()))
{
CP_XML_NODE(L"shadow")
{
......@@ -144,7 +149,7 @@ int Font::serialize(std::wostream & stream)
}
}
if (fStrikeOut.value())
if ((fStrikeOut.value()) && (*fStrikeOut.value()))
{
CP_XML_NODE(L"strike")
{
......@@ -160,21 +165,32 @@ int Font::serialize(std::wostream & stream)
}
}
//if (font.u)
//{
// CP_XML_NODE(L"u")
// {
// CP_XML_ATTR(L"val", *font.u);
// }
//}
if ((uls.value()) && (*uls.value() > 0))
{
CP_XML_NODE(L"u")
{
switch(*uls.value())
{
case 1: CP_XML_ATTR(L"val", "single");break;
case 2: CP_XML_ATTR(L"val", "double");break;
case 33: CP_XML_ATTR(L"val", "singleAccounting");break;
case 34: CP_XML_ATTR(L"val", "doubleAccounting");break;
}
}
}
//if (font.vertAlign)
//{
// CP_XML_NODE(L"vertAlign")
// {
// CP_XML_ATTR(L"val", *font.vertAlign);
// }
//}
if ((sss.value()) && (*sss.value() > 0))
{
CP_XML_NODE(L"vertAlign")
{
switch(*sss.value())
{
case 1: CP_XML_ATTR(L"val", L"superscript");break;
case 2: CP_XML_ATTR(L"val", L"subscript");break;
}
}
}
}
}
......
#include "precompiled_xls.h"
#include "Format.h"
#include <simple_xml_writer.h>
namespace XLS
{;
......@@ -30,6 +32,18 @@ void Format::readFields(CFRecord& record)
{
record >> ifmt >> stFormat;
}
int Format::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"numFmt")
{
CP_XML_ATTR(L"numFmtId", ifmt);
CP_XML_ATTR(L"formatCode", stFormat.value());
}
}
return 0;
}
} // namespace XLS
......@@ -23,14 +23,10 @@ public:
static const ElementType type = typeFormat;
int serialize(std::wostream & stream);
//-----------------------------
BIFF_WORD ifmt;
XLUnicodeString stFormat;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(ifmt)
//BO_ATTRIB_MARKUP_ATTRIB(stFormat)
//BO_ATTRIB_MARKUP_END
};
......
#include "precompiled_xls.h"
#include "Style.h"
#include <simple_xml_writer.h>
namespace XLS
{;
......@@ -53,6 +55,10 @@ void Style::readFields(CFRecord& record)
}
}
int Style::serialize(std::wostream & stream)
{
return 0;
}
} // namespace XLS
......@@ -24,27 +24,13 @@ public:
static const ElementType type = typeStyle;
int serialize(std::wostream & stream);
//-----------------------------
BIFF_WORD ixfe;
BIFF_BOOL fBuiltIn;
BuiltInStyle builtInData;
XLUnicodeString user;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(ixfe)
//BO_ATTRIB_MARKUP_ATTRIB(fBuiltIn)
//if(fBuiltIn)
//{
// //BO_ATTRIB_MARKUP_COMPLEX(builtInData)
//}
//else
//{
// //BO_ATTRIB_MARKUP_ATTRIB(user)
//}
//BO_ATTRIB_MARKUP_END
};
} // namespace XLS
......
#include "precompiled_xls.h"
#include "StyleExt.h"
#include <simple_xml_writer.h>
namespace XLS
{;
......@@ -40,6 +42,11 @@ void StyleExt::readFields(CFRecord& record)
record >> iCategory>> builtInData >> stName >> xfProps;
}
int StyleExt::serialize(std::wostream & stream)
{
return 0;
}
} // namespace XLS
......@@ -25,6 +25,8 @@ public:
static const ElementType type = typeStyleExt;
int serialize(std::wostream & stream);
//-----------------------------
BIFF_BOOL fBuiltIn;
BIFF_BOOL fHidden;
......@@ -33,21 +35,6 @@ public:
BuiltInStyle builtInData;
LPWideString stName;
XFProps xfProps;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(fBuiltIn)
//BO_ATTRIB_MARKUP_ATTRIB(fHidden)
//BO_ATTRIB_MARKUP_ATTRIB(fCustom)
//BO_ATTRIB_MARKUP_ATTRIB(iCategory)
//BO_ATTRIB_MARKUP_ATTRIB(stName)
//if(fBuiltIn)
//{
// //BO_ATTRIB_MARKUP_COMPLEX(builtInData)
//}
//BO_ATTRIB_MARKUP_COMPLEX(xfProps)
//BO_ATTRIB_MARKUP_END
};
} // namespace XLS
......
......@@ -27,12 +27,14 @@ BaseObjectPtr XF::clone()
void XF::writeFields(CFRecord& record)
{
unsigned short flags = 0;
SETBIT(flags, 0, fLocked);
SETBIT(flags, 1, fHidden);
SETBIT(flags, 2, fStyle);
SETBIT(flags, 3, f123Prefix);
SETBITS(flags, 4, 15, ixfParent);
record << ifnt << ifmt << flags;
if(fStyle)
{
style.store(record);
......@@ -47,12 +49,15 @@ void XF::writeFields(CFRecord& record)
void XF::readFields(CFRecord& record)
{
unsigned short flags;
record >> ifnt >> ifmt >> flags;
fLocked = GETBIT(flags, 0);
fHidden = GETBIT(flags, 1);
fStyle = GETBIT(flags, 2);
f123Prefix = GETBIT(flags, 3);
ixfParent = GETBITS(flags, 4, 15);
if(fStyle)
{
style.load(record);
......@@ -65,11 +70,32 @@ void XF::readFields(CFRecord& record)
int XF::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"xf")
{
if (ifnt.value())
{
CP_XML_ATTR(L"fontId" , ifnt.getValue());
}
if (ifmt.value())
{
CP_XML_ATTR(L"numFmtIs" , *ifmt.value());
}
if(fStyle)
{
CP_XML_ATTR(L"borderId" , style.border_x_id);
CP_XML_ATTR(L"fillId" , style.fill_x_id);
}
else
{
CP_XML_ATTR(L"xfId" , *ixfParent.value() );
CP_XML_ATTR(L"borderId" , cell.border_x_id);
CP_XML_ATTR(L"fillId" , cell.fill_x_id);
}
}
}
return 0;
}
......
......@@ -113,6 +113,7 @@ void BiffString::load(CFRecord& record, const size_t cch, const bool is_wide)
if(is_wide)
{
//todoooo wchar_t = 4 !!!!
std::wstring int_str(record.getCurData<wchar_t>(), cch);
str_ = int_str.c_str();
}
......
......@@ -6,6 +6,8 @@
#include <boost/shared_ptr.hpp>
#include <Auxiliary/BetterVariantT.h>
#include <Logging/Log.h>
//#include <Logic/Biff_structures/BitMarkedStructs.h>
class Document;
......
#include "BorderFillInfo.h"
#include <boost/functional/hash/hash.hpp>
#include <simple_xml_writer.h>
namespace XLS
{
int FillInfo::serialize(std::wostream & stream)
{
std::size_t hash_value(FillInfo const & val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.icvFore);
boost::hash_combine(seed, val.icvBack);
boost::hash_combine(seed, val.fls);
return seed;
}
std::size_t hash_value(BorderInfo const & val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.dgBottom);
boost::hash_combine(seed, val.dgDiag);
boost::hash_combine(seed, val.dgLeft);
boost::hash_combine(seed, val.dgRight);
boost::hash_combine(seed, val.dgTop);
boost::hash_combine(seed, val.grbitDiag);
boost::hash_combine(seed, val.icvBottom);
boost::hash_combine(seed, val.icvDiag);
boost::hash_combine(seed, val.icvLeft);
boost::hash_combine(seed, val.icvRight);
boost::hash_combine(seed, val.icvTop);
return seed;
}
bool FillInfo::operator == (const FillInfo & rVal) const
{
const bool res =
fls == rVal.fls &&
icvBack == rVal.icvBack &&
icvFore == rVal.icvFore;
return res;
}
bool FillInfo::operator != (const FillInfo & rVal) const
{
return !(this->operator ==(rVal));
}
static std::wstring PatternType [] =
{
L"none",
L"solid",
L"mediumGray",
L"darkGray",
L"lightGray",
L"darkHorizontal",
L"darkVertical",
L"darkDown",
L"darkUp",
L"darkGrid",
L"darkTrellis",
L"lightHorizontal",
L"lightVertical",
L"lightDown",
L"lightUp",
L"lightGrid",
L"lightTrellis",
L"gray125",
L"gray0625"
};
int FillInfo::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"fill")
{
CP_XML_NODE(L"patternFill")
{
CP_XML_ATTR(L"patternType", PatternType[fls]);
if (fls > 0)
{
CP_XML_NODE(L"fgColor")
{
//if (icvFore < 65 )
CP_XML_ATTR(L"indexed", icvFore);
}
CP_XML_NODE(L"bgColor")
{
//if (icvBack < 65 )
CP_XML_ATTR(L"indexed", icvBack);
}
}
}
return 0;
}
}
return 0;
}
bool BorderInfo::operator == (const BorderInfo & rVal) const
{
const bool res =
dgBottom == rVal.dgBottom &&
dgDiag == rVal.dgDiag &&
dgLeft == rVal.dgLeft &&
dgRight == rVal.dgRight &&
dgTop == rVal.dgTop &&
grbitDiag == rVal.grbitDiag &&
icvBottom == rVal.icvBottom &&
icvDiag == rVal.icvDiag &&
icvLeft == rVal.icvLeft &&
icvRight == rVal.icvRight &&
icvTop == rVal.icvTop;
return res;
}
int BorderInfo::serialize(std::wostream & stream)
bool BorderInfo::operator != (const BorderInfo & rVal) const
{
return !(this->operator ==(rVal));
}
static std::wstring border_type[]=
{
L"none",
L"thin",
L"medium",
L"dashed",
L"dotted",
L"thick",
L"double",
L"hair",
L"mediumDashed",
L"dashDot",
L"mediumDashDot",
L"dashDotDot",
L"mediumDashDotDot",
L"slantDashDot"
};
void serialize1(std::wostream & _stream, unsigned char type, unsigned color, const std::wstring & name)
{
if (type < 1 || type > 13) return;
CP_XML_WRITER(_stream)
{
CP_XML_NODE(name)
{
CP_XML_ATTR(L"style", border_type[type]);
if (color > 0)
{
CP_XML_NODE(L"color")
{
CP_XML_ATTR(L"indexed", color);
}
}
}
}
}
int BorderInfo::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"border")
{
if (grbitDiag == 2 || grbitDiag == 3)
CP_XML_ATTR(L"diagonalUp", true);
if (grbitDiag == 1 || grbitDiag == 3)
CP_XML_ATTR(L"diagonalDown", true);
serialize1(CP_XML_STREAM(), dgLeft , icvLeft , L"left");
serialize1(CP_XML_STREAM(), dgRight , icvRight , L"right");
serialize1(CP_XML_STREAM(), dgTop , icvTop , L"top");
serialize1(CP_XML_STREAM(), dgBottom, icvBottom , L"bottom");
serialize1(CP_XML_STREAM(), dgDiag , icvDiag , L"diagonal");
}
}
return 0;
}
}
}
\ No newline at end of file
......@@ -25,6 +25,11 @@ struct FillInfo
(icvBack < right.icvBack));
}
bool operator == (const FillInfo & rVal) const;
bool operator != (const FillInfo & rVal) const;
friend std::size_t hash_value(FillInfo const & val);
int serialize(std::wostream & stream);
};
......@@ -42,6 +47,19 @@ struct BorderInfo
unsigned char icvBottom;
unsigned char icvDiag;
BorderInfo(){}
BorderInfo( const unsigned char dgLeft_set, const unsigned char dgRight_set, const unsigned char dgTop_set,
const unsigned char dgBottom_set, const unsigned char dgDiag_set, const unsigned char grbitDiag_set,
const unsigned char icvLeft_set, const unsigned char icvRight_set, const unsigned char icvTop_set,
const unsigned char icvBottom_set, const unsigned char icvDiag_set )
: dgLeft(dgLeft_set), dgRight(dgRight_set), dgTop(dgTop_set), dgBottom(dgBottom_set),
dgDiag(dgDiag_set), grbitDiag(grbitDiag_set),
icvLeft(icvLeft_set), icvRight(icvRight_set), icvTop(icvTop_set), icvBottom(icvBottom_set),
icvDiag(icvDiag_set)
{
}
bool operator < (const BorderInfo& right) const
{
return dgLeft < right.dgLeft || dgLeft == right.dgLeft &&
......@@ -57,9 +75,15 @@ struct BorderInfo
(icvDiag < right.icvDiag))))))))));
}
bool operator == (const BorderInfo & rVal) const;
bool operator != (const BorderInfo & rVal) const;
friend std::size_t hash_value(BorderInfo const & val);
int serialize(std::wostream & stream);
};
} // namespace XLS
......@@ -18,7 +18,6 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
private:
unsigned char istyBuiltIn;
unsigned char iLevel;
};
......
......@@ -2,6 +2,8 @@
#include "CellXF.h"
#include <Binary/CFRecord.h>
#include <simple_xml_writer.h>
namespace XLS
{;
......@@ -195,6 +197,7 @@ void CellXF::load(CFRecord& record)
int CellXF::serialize(std::wostream & stream)
{
return 0;
}
......
......@@ -21,7 +21,6 @@ public:
int serialize(std::wostream & stream);
private:
unsigned char alc;
bool fWrap;
unsigned char alcV;
......@@ -46,7 +45,6 @@ private:
size_t border_x_id;
size_t fill_x_id;
private:
size_t& cell_xf_current_id_;
size_t& style_xf_current_id_;
};
......
......@@ -2,6 +2,8 @@
#include "StyleXF.h"
#include <Binary/CFRecord.h>
#include <simple_xml_writer.h>
namespace XLS
{;
......@@ -17,73 +19,6 @@ BiffStructurePtr StyleXF::clone()
return BiffStructurePtr(new StyleXF(*this));
}
//void StyleXF::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"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"fls", fill.fls);
//
// xml_tag->setAttribute(L"icvFore", fill.icvFore);
// xml_tag->setAttribute(L"icvBack", fill.icvBack);
//
// xml_tag->setAttribute(L"xf_current_id", cell_xf_current_id_ + style_xf_current_id_);
// xml_tag->setAttribute(L"style_xf_current_id", style_xf_current_id_++);
//
// xml_tag->setAttribute(L"border_x_id", border_x_id);
// xml_tag->setAttribute(L"fill_x_id", fill_x_id);
//}
//
//
//void StyleXF::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");
//
// 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");
// fill.fls = getStructAttribute(xml_tag, L"fls");
//
// fill.icvFore = getStructAttribute(xml_tag, L"icvFore");
// fill.icvBack = getStructAttribute(xml_tag, L"icvBack");
//}
//
//
void StyleXF::store(CFRecord& record)
{
unsigned int flags = 0;
......
......@@ -20,7 +20,6 @@ public:
int serialize(std::wostream & stream);
private:
unsigned char alc;
bool fWrap;
......@@ -37,7 +36,6 @@ private:
size_t border_x_id;
size_t fill_x_id;
private:
size_t& cell_xf_current_id_;
size_t& style_xf_current_id_;
};
......
......@@ -19,7 +19,6 @@ public:
virtual void load(CFRecord& record);
virtual void store(CFRecord& record);
private:
unsigned short cprops;
std::vector<XFProp> xfPropArray;
};
......
......@@ -90,10 +90,21 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
return true;
}
int FORMATTING::serialize(std::wostream & stream)
int FORMATTING::serialize1(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
if (m_Formats.size() > 0)
{
CP_XML_NODE(L"numFmts")
{
CP_XML_ATTR(L"count", m_Formats.size());
for (long i = 0 ; i < m_Formats.size(); i++)
{
m_Formats[i]->serialize(CP_XML_STREAM());
}
}
}
if (m_Fonts.size() > 0)
{
CP_XML_NODE(L"fonts")
......@@ -105,6 +116,14 @@ int FORMATTING::serialize(std::wostream & stream)
}
}
}
}
return 0;
}
int FORMATTING::serialize2(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
if (m_XFS)
{
m_XFS->serialize(stream);
......@@ -115,16 +134,6 @@ int FORMATTING::serialize(std::wostream & stream)
}
}
//cpdoccore::oox::xlsx_serialize(_Wostream, numFmts_);
//cpdoccore::oox::xlsx_serialize(_Wostream, fonts_);
//cpdoccore::oox::xlsx_serialize(_Wostream, fills_);
//cpdoccore::oox::xlsx_serialize(_Wostream, borders_);
//
//xlsx_serialize_xf(_Wostream, cellStyleXfs_, L"cellStyleXfs");
//xlsx_serialize_xf(_Wostream, cellXfs_, L"cellXfs");
//cellStyles_.xlsx_serialize(_Wostream);
return 0;
}
......
......@@ -18,7 +18,8 @@ public:
virtual const bool loadContent(BinProcessor& proc);
int serialize(std::wostream & stream);
int serialize1(std::wostream & stream);
int serialize2(std::wostream & stream);
static const ElementType type = typeFORMATTING;
......
......@@ -3,21 +3,12 @@
#include <Logic/Biff_records/Style.h>
#include <Logic/Biff_records/StyleExt.h>
#include <simple_xml_writer.h>
namespace XLS
{;
STYLES::STYLES()
{
}
STYLES::~STYLES()
{
}
class Parenthesis_STYLES_1: public ABNFParenthesis
class Parenthesis_STYLES_1 : public CompositeObject //: public ABNFParenthesis
{
BASE_OBJECT_DEFINE_CLASS_NAME(Parenthesis_STYLES_1)
public:
......@@ -28,13 +19,24 @@ public:
const bool loadContent(BinProcessor& proc)
{
if(!proc.mandatory<Style>())
if(proc.mandatory<Style>())
{
return false;
m_Style = elements_.back();
elements_.pop_back();
}else return false;
if (proc.optional<StyleExt>())
{
m_StyleEx = elements_.back();
elements_.pop_back();
}
proc.optional<StyleExt>();
return true;
};
BaseObjectPtr m_StyleEx;
BaseObjectPtr m_Style;
};
BaseObjectPtr STYLES::clone()
......@@ -46,8 +48,75 @@ BaseObjectPtr STYLES::clone()
// STYLES = 1*(Style [StyleExt])
const bool STYLES::loadContent(BinProcessor& proc)
{
return proc.repeated<Parenthesis_STYLES_1>(1, 0);
styles_count = proc.repeated<Parenthesis_STYLES_1>(1, 0);
return styles_count > 0 ? true : false;
}
int STYLES::serialize(std::wostream & stream)
{
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"cellStyles")
{
CP_XML_ATTR(L"count", styles_count);
for (std::list<XLS::BaseObjectPtr>::iterator it = elements_.begin(); it != elements_.end(); it++)
{
Parenthesis_STYLES_1 * style_1 = dynamic_cast<Parenthesis_STYLES_1*>(it->get());
if (style_1)
{
CP_XML_NODE(L"cellStyle")
{
XLS::Style * style = dynamic_cast<Style*> (style_1->m_Style.get());
XLS::StyleExt * styleExt = dynamic_cast<StyleExt*>(style_1->m_StyleEx.get());
if (styleExt)
{
CP_XML_ATTR(L"name", styleExt->stName.value());
if ((styleExt->fBuiltIn.value()) && (*styleExt->fBuiltIn.value()))
{
CP_XML_ATTR(L"builtinId", styleExt->builtInData.istyBuiltIn);
if (styleExt->builtInData.iLevel > 0 && styleExt->builtInData.iLevel < 255)
{
CP_XML_ATTR(L"iLevel", styleExt->builtInData.iLevel);
}
}
for (long i = 0; i < styleExt->xfProps.xfPropArray.size(); i++)
{
}
}
else
{
CP_XML_ATTR(L"name", style->user.value());
if ((style->fBuiltIn.value()) && (*style->fBuiltIn.value()))
{
CP_XML_ATTR(L"builtinId", style->builtInData.istyBuiltIn);
if (style->builtInData.iLevel > 0 && style->builtInData.iLevel < 255)
{
CP_XML_ATTR(L"iLevel", style->builtInData.iLevel);
}
}
}
if (style->ixfe.value())
{
int xfId = *style->ixfe.value() - 1;
if (xfId < 0) xfId = 0;
CP_XML_ATTR(L"xfId", xfId);
}
}
}
}
}
}
return 0;
}
} // namespace XLS
......@@ -7,12 +7,12 @@ namespace XLS
// Logical representation of STYLES union of records
class STYLES: public CompositeObject
class STYLES : public CompositeObject
{
BASE_OBJECT_DEFINE_CLASS_NAME(STYLES)
public:
STYLES();
~STYLES();
STYLES(){styles_count = 0;}
~STYLES(){}
BaseObjectPtr clone();
......@@ -20,6 +20,10 @@ public:
static const ElementType type = typeSTYLES;
int serialize(std::wostream & stream);
int styles_count;
};
} // namespace XLS
......
......@@ -82,10 +82,6 @@ int XFS::serialize(std::wostream & stream)
m_cell_xfs[i]->serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"cellStyles")
{
CP_XML_ATTR(L"count", 0);
}
}
return 0;
}
......
......@@ -17,11 +17,12 @@ GlobalWorkbookInfo::GlobalWorkbookInfo(const unsigned short code_page)
const size_t GlobalWorkbookInfo::RegisterBorderId(const BorderInfo& border)
{
std::map<BorderInfo, size_t>::const_iterator it_find = border_x_ids.find(border);
boost::unordered_map<BorderInfo, int>::const_iterator it_find = border_x_ids.find(border);
if(border_x_ids.end() == it_find)
{
size_t id = border_x_ids.size();
return border_x_ids[border] = id;
int id = border_x_ids.size();
border_x_ids[border] = id;
return id;
}
else
{
......@@ -36,11 +37,12 @@ const size_t GlobalWorkbookInfo::RegisterFillId(const FillInfo& fill)
return 0;
}
std::map<FillInfo, size_t>::const_iterator it_find = fill_x_ids.find(fill);
boost::unordered_map<FillInfo, int>::const_iterator it_find = fill_x_ids.find(fill);
if(fill_x_ids.end() == it_find)
{
size_t id = fill_x_ids.size();
return fill_x_ids[fill] = id;
int id = fill_x_ids.size();
fill_x_ids[fill] = id;
return id;
}
else
{
......
#pragma once
#include <map>
#include <boost/unordered_map.hpp>
#include <vector>
#include "../Crypt/Decryptor.h"
#include "Biff_structures/BorderFillInfo.h"
namespace XLS
{;
......@@ -25,8 +24,9 @@ public:
std::vector<std::wstring> xti_parsed;
std::vector<std::wstring> AddinUdfs;
std::map<BorderInfo, size_t> border_x_ids;
std::map<FillInfo, size_t> fill_x_ids;
boost::unordered_map<BorderInfo, int> border_x_ids;
boost::unordered_map<FillInfo, int> fill_x_ids;
unsigned int last_AXES_id;
const static unsigned int initial_AXES_id = 0;
};
......
......@@ -25,6 +25,8 @@
#include <simple_xml_writer.h>
#include <vector>
XlsConverter::XlsConverter(const std::wstring & path, const ProgressCallback* CallBack)
{
output_document = NULL;
......@@ -148,7 +150,7 @@ void XlsConverter::convert(XLS::BaseObject *xls_unknown)
switch (type)
{
case XLS::typeAnyObject:
default:
{
for (std::list<XLS::BaseObjectPtr>::iterator it = xls_unknown->elements_.begin(); it != xls_unknown->elements_.end(); it++)
......@@ -194,13 +196,23 @@ void XlsConverter::convert(XLS::GlobalsSubstream* global)
convert((XLS::THEME*)global->m_Theme.get());
}
template<class T>
struct map_data_compare : public std::binary_function<typename T::value_type,typename T::mapped_type,bool>
{
public:
bool operator() (typename T::value_type &pair,typename T::mapped_type i)
{
return pair.second == i;
}
};
typedef boost::unordered_map<XLS::FillInfo, int> mapFillInfo;
typedef boost::unordered_map<XLS::BorderInfo, int> mapBorderInfo;
void XlsConverter::convert(XLS::FORMATTING* formating)
{
if (formating == NULL) return;
typedef std::map<XLS::FillInfo, size_t> mapFillInfo;
typedef std::map<XLS::BorderInfo, size_t> mapBorderInfo;
std::wstringstream strm;
CP_XML_WRITER(strm)
......@@ -209,36 +221,42 @@ void XlsConverter::convert(XLS::FORMATTING* formating)
{
CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
formating->serialize1(CP_XML_STREAM()); // styles
CP_XML_NODE(L"fills")
{
CP_XML_ATTR(L"count", xls_global_info->fill_x_ids.size());
for (long i = 0 ; i < xls_global_info->fill_x_ids.size() ; i++)
{
mapFillInfo::iterator it =
std::find_if( xls_global_info->fill_x_ids.begin(), xls_global_info->fill_x_ids.end(), std::bind2nd(map_data_compare<mapFillInfo>(), i) );
std::vector<XLS::FillInfo> fills_out;
fills_out.resize(xls_global_info->fill_x_ids.size());
if (it != xls_global_info->fill_x_ids.end())
for (mapFillInfo::iterator it = xls_global_info->fill_x_ids.begin(); it != xls_global_info->fill_x_ids.end(); it++)
{
it->first.serialize(CP_XML_STREAM());
fills_out[it->second] = it->first;
}
CP_XML_ATTR(L"count", fills_out.size());
for (int i = 0 ;i < fills_out.size(); i++)
{
fills_out[i].serialize(CP_XML_STREAM());
}
}
CP_XML_NODE(L"borders")
{
CP_XML_ATTR(L"count", xls_global_info->border_x_ids.size());
for (long i = 0 ; i < xls_global_info->border_x_ids.size() ; i++)
{
mapBorderInfo::iterator it =
std::find_if( xls_global_info->border_x_ids.begin(), xls_global_info->border_x_ids.end(), std::bind2nd(map_data_compare<mapBorderInfo>(), i) );
std::vector<XLS::BorderInfo> borders_out;
borders_out.resize(xls_global_info->border_x_ids.size());
if (it != xls_global_info->fill_x_ids.end())
for (mapBorderInfo::iterator it = xls_global_info->border_x_ids.begin(); it != xls_global_info->border_x_ids.end(); it++)
{
it->first.serialize(CP_XML_STREAM());
borders_out[it->second] = it->first;
}
CP_XML_ATTR(L"count", borders_out.size());
for (int i = 0 ;i < borders_out.size(); i++)
{
borders_out[i].serialize(CP_XML_STREAM());
}
}
formating->serialize(CP_XML_STREAM());
formating->serialize2(CP_XML_STREAM());
}
}
......
#include "xlsx_alignment.h"
#include <ostream>
#include <boost/functional.hpp>
#include <boost/functional/hash/hash.hpp>
#include "simple_xml_writer.h"
namespace oox {
bool xlsx_alignment::operator == (const xlsx_alignment & rVal) const
{
const bool res =
horizontal == rVal.horizontal &&
indent == rVal.indent &&
justifyLastLine.get_value_or(false) == rVal.justifyLastLine.get_value_or(false) &&
readingOrder == rVal.readingOrder &&
relativeIndent == rVal.relativeIndent &&
shrinkToFit.get_value_or(false) == rVal.shrinkToFit.get_value_or(false) &&
textRotation.get_value_or(0) == rVal.textRotation.get_value_or(0) &&
vertical == rVal.vertical &&
wrapText.get_value_or(false) == rVal.wrapText.get_value_or(false);
return res;
}
bool xlsx_alignment::operator != (const xlsx_alignment & rVal) const
{
return !(this->operator ==(rVal));
}
std::size_t hash_value(xlsx_alignment const & val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.horizontal.get_value_or(L""));
boost::hash_combine(seed, val.indent.get_value_or(0));
boost::hash_combine(seed, val.justifyLastLine.get_value_or(false));
boost::hash_combine(seed, val.readingOrder.get_value_or(0));
boost::hash_combine(seed, val.relativeIndent.get_value_or(0));
boost::hash_combine(seed, val.shrinkToFit.get_value_or(false));
boost::hash_combine(seed, val.textRotation.get_value_or(0));
boost::hash_combine(seed, val.vertical.get_value_or(L""));
boost::hash_combine(seed, val.wrapText.get_value_or(false));
return seed;
}
bool is_default(const xlsx_alignment & rVal)
{
const xlsx_alignment defaultAlignment;
return rVal == defaultAlignment;
}
xlsx_alignment OdfProperties2XlsxAlignment()
{
xlsx_alignment alignment;
//if (parProp && parProp->fo_text_align_)
//{
// switch(parProp->fo_text_align_->get_type())
// {
// default:
// case odf_types::text_align::Start:
// case odf_types::text_align::Left:
// alignment.horizontal = L"left";
// break;
// case odf_types::text_align::Right:
// case odf_types::text_align::End:
// alignment.horizontal = L"right";
// break;
// case odf_types::text_align::Center:
// alignment.horizontal = L"center";
// break;
// case odf_types::text_align::Justify:
// alignment.horizontal = L"justify";
// break;
// }
//}
//// TODO : indent
//if (parProp && parProp->fo_text_align_last_ &&
// parProp->fo_text_align_last_->get_type() == odf_types::text_align::Justify)
//{
// alignment.justifyLastLine = true;
//}
//if (textProp && textProp->style_text_rotation_angle_)
//{
// alignment.textRotation = textProp->style_text_rotation_angle_.get();
//}
//if (cellProp && cellProp->common_rotation_angle_attlist_.style_rotation_angle_)
//{
// alignment.textRotation = cellProp->common_rotation_angle_attlist_.style_rotation_angle_.get();
//}
//_CP_OPT(odf_types::vertical_align) v_align;
//
//if (parProp && parProp->style_vertical_align_)
// v_align = parProp->style_vertical_align_;
//else if (cellProp && cellProp->style_vertical_align_)
// v_align = cellProp->style_vertical_align_;
//
//if (v_align)
//{
// switch(v_align->get_type())
// {
// case odf_types::vertical_align::Top:
// alignment.vertical = L"top";
// break;
// default:
// case odf_types::vertical_align::Auto:
// case odf_types::vertical_align::Middle:
// alignment.vertical = L"center";
// break;
// case odf_types::vertical_align::Baseline:
// case odf_types::vertical_align::Bottom:
// alignment.vertical = L"bottom";
// break;
// case odf_types::vertical_align::Justify:
// alignment.vertical = L"justify";
// break;
// }
//}
//
//if (cellProp &&
// cellProp->fo_wrap_option_ &&
// cellProp->fo_wrap_option_->get_type() == odf_types::wrap_option::Wrap
// )
//{
// alignment.wrapText = true;
//}
return alignment;
}
void xlsx_serialize(std::wostream & _Wostream, const xlsx_alignment & alignment)
{
if (is_default(alignment))
return;
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"alignment")
{
if (alignment.horizontal)
CP_XML_ATTR(L"horizontal", alignment.horizontal.get());
if (alignment.indent)
CP_XML_ATTR(L"indent", alignment.indent.get());
if (alignment.justifyLastLine)
CP_XML_ATTR(L"justifyLastLine", alignment.justifyLastLine.get());
if (alignment.readingOrder)
CP_XML_ATTR(L"readingOrder", alignment.readingOrder.get());
if (alignment.relativeIndent)
CP_XML_ATTR(L"relativeIndent", alignment.relativeIndent.get());
if (alignment.shrinkToFit)
CP_XML_ATTR(L"shrinkToFit", alignment.shrinkToFit.get());
if (alignment.textRotation)
CP_XML_ATTR(L"textRotation", alignment.textRotation.get());
if (alignment.vertical)
CP_XML_ATTR(L"vertical", alignment.vertical.get());
if (alignment.wrapText)
CP_XML_ATTR(L"wrapText", alignment.wrapText.get());
}
}
}
}
#pragma once
#include <iosfwd>
#include <string>
#include "common.h"
namespace oox {
/// \struct xlsx_alignment
struct xlsx_alignment
{
_CP_OPT(std::wstring) horizontal;
_CP_OPT(int) indent;
_CP_OPT(bool) justifyLastLine;
_CP_OPT(int) readingOrder;
_CP_OPT(int) relativeIndent;
_CP_OPT(bool) shrinkToFit;
_CP_OPT(unsigned int) textRotation;
_CP_OPT(std::wstring) vertical;
_CP_OPT(bool) wrapText;
bool operator == (const xlsx_alignment & rVal) const;
bool operator != (const xlsx_alignment & rVal) const;
friend void xlsx_serialize(std::wostream & _Wostream, const xlsx_alignment & alignment);
friend bool is_default(const xlsx_alignment & rVal);
friend std::size_t hash_value(xlsx_alignment const & val);
};
xlsx_alignment OdfProperties2XlsxAlignment();
}
#include "xlsx_border.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <boost/functional/hash/hash.hpp>
#include "simple_xml_writer.h"
template <class T>
std::size_t hash_value(typename boost::optional<T>::Type const & val)
{
if (val)
{
boost::hash<T>(*val);
}
else
return 0;
}
namespace oox {
bool xlsx_border::operator == (const xlsx_border & rVal) const
{
const bool res =
diagonalUp.get_value_or(false) == rVal.diagonalUp.get_value_or(false) &&
diagonalDown.get_value_or(false) == rVal.diagonalDown.get_value_or(false) &&
outline.get_value_or(true) == rVal.outline.get_value_or(true) &&
left.get_value_or(xlsx_border_edge(L"none")) == rVal.left.get_value_or(xlsx_border_edge(L"none")) &&
right.get_value_or(xlsx_border_edge(L"none")) == rVal.right.get_value_or(xlsx_border_edge(L"none")) &&
top.get_value_or(xlsx_border_edge(L"none")) == rVal.top.get_value_or(xlsx_border_edge(L"none")) &&
bottom.get_value_or(xlsx_border_edge(L"none")) == rVal.bottom.get_value_or(xlsx_border_edge(L"none")) &&
diagonal.get_value_or(xlsx_border_edge(L"none")) == rVal.diagonal.get_value_or(xlsx_border_edge(L"none")) &&
vertical.get_value_or(xlsx_border_edge(L"none")) == rVal.vertical.get_value_or(xlsx_border_edge(L"none")) &&
horizontal.get_value_or(xlsx_border_edge(L"none")) == rVal.horizontal.get_value_or(xlsx_border_edge(L"none"));
return res;
}
bool xlsx_border::operator != (const xlsx_border & rVal) const
{
return !(this->operator ==(rVal));
}
bool xlsx_border_edge::operator == (const xlsx_border_edge & rVal) const
{
const bool res =
style.get_value_or(L"none") == rVal.style.get_value_or(L"none") &&
//abs(width.get_value_or(0)/100 - rVal.width.get_value_or(0)/100)<10 &&
color == rVal.color;
return res;
}
bool xlsx_border_edge::operator != (const xlsx_border_edge & rVal) const
{
return !(this->operator ==(rVal));
}
std::size_t hash_value(xlsx_border_edge const& val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.style.get_value_or(L""));
boost::hash_combine(seed, val.color.get_value_or(xlsx_color()));
return seed;
}
std::size_t hash_value(const _CP_OPT(xlsx_border_edge) & val)
{
std::size_t seed = 0;
if (val)
{
boost::hash_combine(seed, val->style.get_value_or(L""));
boost::hash_combine(seed, val->color.get_value_or(xlsx_color()));
}
return seed;
}
void xlsx_serialize(std::wostream & _Wostream, const _CP_OPT(xlsx_border_edge) & borderEdge, const std::wstring & name)
{
if (borderEdge)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(name)
{
if (borderEdge->style)
CP_XML_ATTR(L"style", borderEdge->style.get());
if (borderEdge->color)
xlsx_serialize(CP_XML_STREAM(), borderEdge->color.get());
}
}
}
}
void xlsx_serialize(std::wostream & _Wostream, const xlsx_border & border)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"border")
{
if (border.diagonalUp)
CP_XML_ATTR(L"diagonalUp", border.diagonalUp.get());
if (border.diagonalDown)
CP_XML_ATTR(L"diagonalDown", border.diagonalDown.get());
if (border.outline && border.outline.get() == false)
CP_XML_ATTR(L"outline", border.outline.get());
xlsx_serialize(CP_XML_STREAM(), border.left, L"left");
xlsx_serialize(CP_XML_STREAM(), border.right, L"right");
xlsx_serialize(CP_XML_STREAM(), border.top, L"top");
xlsx_serialize(CP_XML_STREAM(), border.bottom, L"bottom");
xlsx_serialize(CP_XML_STREAM(), border.diagonal, L"diagonal");
xlsx_serialize(CP_XML_STREAM(), border.vertical, L"vertical");
xlsx_serialize(CP_XML_STREAM(), border.horizontal, L"horizontal");
}
}
}
std::size_t hash_value(xlsx_border const& val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.diagonalUp.get_value_or(false));
boost::hash_combine(seed, val.diagonalDown.get_value_or(false));
boost::hash_combine(seed, val.outline.get_value_or(false));
boost::hash_combine(seed, val.left);
boost::hash_combine(seed, val.right);
boost::hash_combine(seed, val.top);
boost::hash_combine(seed, val.bottom);
boost::hash_combine(seed, val.diagonal);
boost::hash_combine(seed, val.vertical);
boost::hash_combine(seed, val.horizontal);
return seed;
}
bool is_default(const _CP_OPT(xlsx_border_edge) & borderEdge)
{
if (!borderEdge) return true;
if (is_default(borderEdge.get())) return true;
return false;
}
bool is_default(xlsx_border_edge * borderEdge)
{
if (!borderEdge) return true;
if (!borderEdge->style) return true;
if (borderEdge->style.get() == L"none") return true;
return false;
}
bool is_default(xlsx_border_edge const& borderEdge)
{
if (!borderEdge.style) return true;
if (borderEdge.style.get() == L"none") return true;
return false;
}
bool is_default(xlsx_border const& border)
{
if (border.diagonalUp.get_value_or(false) == false &&
border.diagonalDown.get_value_or(false) == false &&
border.outline.get_value_or(true) == true &&
is_default(border.left) &&
is_default(border.right) &&
is_default(border.top) &&
is_default(border.bottom) &&
is_default(border.diagonal) &&
is_default(border.vertical) &&
is_default(border.horizontal)
)
return true;
else
return false;
}
}
#pragma once
#include <iosfwd>
#include <string>
#include <vector>
#include "xlsx_color.h"
#include "common.h"
namespace oox {
struct xlsx_border_edge
{
xlsx_border_edge()
{}
xlsx_border_edge(std::wstring _style, xlsx_color _color = xlsx_color()) : style(_style), color(_color)
{}
_CP_OPT(std::wstring) style; // attribute
_CP_OPT(xlsx_color) color; // element
_CP_OPT(int) width; //
bool operator == (const xlsx_border_edge & rVal) const;
bool operator != (const xlsx_border_edge & rVal) const;
};
struct xlsx_border
{
_CP_OPT(bool) diagonalUp;
_CP_OPT(bool) diagonalDown;
_CP_OPT(bool) outline; // default true
_CP_OPT(xlsx_border_edge) left;
_CP_OPT(xlsx_border_edge) right;
_CP_OPT(xlsx_border_edge) top;
_CP_OPT(xlsx_border_edge) bottom;
_CP_OPT(xlsx_border_edge) diagonal;
_CP_OPT(xlsx_border_edge) vertical;
_CP_OPT(xlsx_border_edge) horizontal;
std::size_t index;
bool operator == (const xlsx_border & rVal) const;
bool operator != (const xlsx_border & rVal) const;
};
std::size_t hash_value(const _CP_OPT(xlsx_border_edge) & val);
std::size_t hash_value(xlsx_border_edge const& val);
std::size_t hash_value(xlsx_border const& val);
bool is_default(xlsx_border_edge * borderEdge);
bool is_default(xlsx_border_edge const& borderEdge);
bool is_default(const _CP_OPT(xlsx_border_edge) & borderEdge);
bool is_default(xlsx_border const& border);
void xlsx_serialize(std::wostream & _Wostream, xlsx_border const & border);
}
#include "xlsx_borders.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <boost/unordered_set.hpp>
#include "simple_xml_writer.h"
#include "xlsx_border.h"
namespace oox {
namespace {
// TODO
std::wstring convert_border_style(/*const odf_types::border_style& borderStyle*/)
{
std::wstring retVal = L"none";
//if (borderStyle.initialized())
// {
// if (borderStyle.get_style() == odf_types::border_style::none || borderStyle.is_none())
// retVal = L"none";
// else if (borderStyle.get_style() == odf_types::border_style::double_)
// retVal = L"double";
// else if (borderStyle.get_style() == odf_types::border_style::dotted)
// retVal = L"dotted";
// else if (borderStyle.get_style() == odf_types::border_style::dashed)
// retVal = L"dashed";
// else
// retVal = L"thin";
// }
return retVal;
}
void process_border(xlsx_border_edge & borderEdge/*, const _CP_OPT(border_style) & borderStyle*/)
{
// if (borderStyle)
// {
// xlsx_color color;
// color.rgb = borderStyle->get_color().get_hex_value();
// borderEdge.color = color;
// borderEdge.style = convert_border_style(*borderStyle);
//borderEdge.width = boost::lexical_cast<int>(borderStyle->get_length().get_value_unit(odf_types::length::emu));
// }
}
bool check_border(const _CP_OPT(std::wstring) & odfBorderStyle)
{
if (odfBorderStyle)
{
//odf_types::border_style borderStyle(*odfBorderStyle);
//if (convert_border_style(borderStyle) != L"none")
// return true;
}
return false;
}
}
class xlsx_borders::Impl
{
public:
Impl()
{
xlsx_border border;
border.left = xlsx_border_edge();
border.right = xlsx_border_edge();
border.top = xlsx_border_edge();
border.bottom = xlsx_border_edge();
border.index = 0;
borders_.insert(border);
//borders_.push_back(border);
}
size_t size() const
{
return borders_.size();
}
size_t borderId()
{
bool is_default;
return borderId(is_default);
}
size_t borderId( bool & is_default_val)
{
xlsx_border border;
border.left = xlsx_border_edge();
border.right = xlsx_border_edge();
border.top = xlsx_border_edge();
border.bottom = xlsx_border_edge();
// if (cellProp)
// {
// const common_border_attlist & odfBordersAttr = cellProp->common_border_attlist_;
//
//process_border(*border.left, odfBordersAttr.fo_border_);
// process_border(*border.right, odfBordersAttr.fo_border_);
// process_border(*border.top, odfBordersAttr.fo_border_);
// process_border(*border.bottom, odfBordersAttr.fo_border_);
// process_border(*border.left, odfBordersAttr.fo_border_left_);
// process_border(*border.right, odfBordersAttr.fo_border_right_);
// process_border(*border.top, odfBordersAttr.fo_border_top_);
// process_border(*border.bottom, odfBordersAttr.fo_border_bottom_);
// if (check_border(cellProp->style_diagonal_bl_tr_))
// {
// border.diagonal = xlsx_border_edge();
// _CP_OPT(border_style) borderStyle(*cellProp->style_diagonal_bl_tr_);
// process_border(*border.diagonal, borderStyle);
// border.diagonalUp = true;
// }
// if (check_border(cellProp->style_diagonal_tl_br_))
// {
// if (!border.diagonal)
// border.diagonal = xlsx_border_edge();
// _CP_OPT(border_style) borderStyle (*cellProp->style_diagonal_tl_br_);
// process_border(*border.diagonal, borderStyle);
// border.diagonalDown = true;
// }
// }
if (is_default(border))
{
is_default_val = true;
return 0;
}
else
{
is_default_val = false;
xlsx_borders_array::const_iterator i = borders_.find(border);
if (i != borders_.end())
{
return i->index;
}
else
{
border.index = borders_.size();
borders_.insert(border);
//borders_.push_back(border);
return border.index;
}
}
}
struct compare_
{
template <class T>
bool operator() (T const & x1, T const & x2)
{
return x1.index < x2.index;
}
};
void xlsx_serialize(std::wostream & _Wostream)
{
std::vector<xlsx_border> inst_array;
BOOST_FOREACH(const xlsx_border & inst, borders_)
{
inst_array.push_back(inst);
}
std::sort(inst_array.begin(), inst_array.end(), compare_());
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"borders")
{
CP_XML_ATTR(L"count", inst_array.size());
BOOST_FOREACH( xlsx_border & border, inst_array)
{
oox::xlsx_serialize(CP_XML_STREAM(), border);
}
}
}
}
private:
typedef boost::unordered_set<xlsx_border, boost::hash<xlsx_border> > xlsx_borders_array;
xlsx_borders_array borders_;
};
size_t xlsx_borders::size() const
{
return impl_->size();
}
size_t xlsx_borders::borderId()
{
return impl_->borderId();
}
size_t xlsx_borders::borderId(bool & is_default)
{
return impl_->borderId(is_default);
}
void xlsx_borders::xlsx_serialize(std::wostream & _Wostream)
{
return impl_->xlsx_serialize(_Wostream);
}
xlsx_borders::xlsx_borders(): impl_(new Impl())
{
}
xlsx_borders::~xlsx_borders()
{
}
void xlsx_serialize(std::wostream & _Wostream, xlsx_borders & borders)
{
return borders.xlsx_serialize(_Wostream);
}
}
#pragma once
#include <iosfwd>
#include <boost/scoped_ptr.hpp>
namespace oox {
class xlsx_borders
{
public:
xlsx_borders();
~xlsx_borders();
size_t size() const;
size_t borderId();
size_t borderId(bool & is_default);
void xlsx_serialize(std::wostream & _Wostream);
private:
class Impl;
boost::scoped_ptr<Impl> impl_;
};
void xlsx_serialize(std::wostream & _Wostream, xlsx_borders & borders);
}
#include "xlsx_cell_format.h"
#include <boost/foreach.hpp>
namespace oox {
xlsx_cell_format::xlsx_cell_format() : cell_type_(XlsxCellType::null)
{}
XlsxCellType::type xlsx_cell_format::get_cell_type() const
{
return cell_type_;
}
void xlsx_cell_format::set_cell_type(XlsxCellType::type type)
{
cell_type_ = type;
}
int xlsx_cell_format::get_num_format() const
{
return num_format_;
}
void xlsx_cell_format::set_num_format(int numFmt)
{
num_format_ = numFmt;
}
namespace {
int odf2buildin_map[] = {0,0,0,0,0,0,0,0};
//{
// {L"", 0},
// {L"float", 0},
// {L"currency", 0},
// {L"percentage", 10},
// {L"date", 15},
// {L"time", 21},
// {L"boolean", 0},
// {L"string", 49}
//};
//
}
int odf_string_to_build_in(const int odf_type_value)
{
return odf2buildin_map[odf_type_value];
}
}
#pragma once
namespace oox {
struct XlsxCellType
{
enum type { null, b, n, e, s, str, inlineStr };
};
int odf_string_to_build_in(const int value_type);
class xlsx_cell_format
{
public:
xlsx_cell_format();
public:
XlsxCellType::type get_cell_type() const;
void set_cell_type(XlsxCellType::type type);
int get_num_format() const;
void set_num_format(int numFmt);
private:
XlsxCellType::type cell_type_;
int num_format_;
};
}
#include "xlsx_cell_style.h"
#include "simple_xml_writer.h"
namespace oox {
void xlsx_serialize(std::wostream & _Wostream, const xlsx_cell_style & cell_style)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"cellStyle")
{
if (cell_style.name)
CP_XML_ATTR(L"name", cell_style.name.get());
if (cell_style.xfId)
CP_XML_ATTR(L"xfId", cell_style.xfId.get());
if (cell_style.builtinId)
CP_XML_ATTR(L"builtinId", cell_style.builtinId.get());
}
}
//_Wostream << L"<cellStyle ";
//if (cell_style.name)
// _Wostream << L"name=\"" << cell_style.name.get() << L"\" ";
//if (cell_style.xfId)
// _Wostream << L"xfId=\"" << cell_style.xfId.get() << L"\" ";
//if (cell_style.builtinId)
// _Wostream << L"builtinId=\"" << cell_style.builtinId.get() << L"\" ";
//_Wostream << L"/>";
}
}
#pragma once
#include <iosfwd>
#include <string>
#include "common.h"
namespace oox {
struct xlsx_cell_style
{
_CP_OPT(std::wstring) name;
_CP_OPT(unsigned int) xfId;
_CP_OPT(unsigned int) builtinId;
};
void xlsx_serialize(std::wostream & _Wostream, const xlsx_cell_style & cell_style);
}
#include <vector>
#include <boost/foreach.hpp>
#include "simple_xml_writer.h"
#include "xlsx_cell_styles.h"
#include "xlsx_cell_style.h"
namespace oox {
class xlsx_cell_styles::Impl
{
public:
std::vector<xlsx_cell_style> cell_styles_;
};
xlsx_cell_styles::xlsx_cell_styles() : impl_(new xlsx_cell_styles::Impl())
{
xlsx_cell_style default_style;
default_style.xfId = 0;
default_style.builtinId = 0;
default_style.name = L"Default";
impl_->cell_styles_.push_back(default_style);
}
xlsx_cell_styles::~xlsx_cell_styles()
{}
void xlsx_cell_styles::xlsx_serialize(std::wostream & _Wostream) const
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"cellStyles")
{
CP_XML_ATTR(L"count", impl_->cell_styles_.size());
BOOST_FOREACH(const xlsx_cell_style & s, impl_->cell_styles_)
{
oox::xlsx_serialize(CP_XML_STREAM(), s);
}
}
}
//_Wostream << L"<cellStyles count=\"" << impl_->cell_styles_.size() << L"\">";
//
//BOOST_FOREACH(const xlsx_cell_style & s, impl_->cell_styles_)
//{
// ::cpdoccore::oox::xlsx_serialize(_Wostream, s);
//}
//_Wostream << L"</cellStyles>";
}
}
#pragma once
#include <boost/scoped_ptr.hpp>
namespace oox {
class xlsx_cell_styles
{
public:
xlsx_cell_styles();
~xlsx_cell_styles();
public:
void xlsx_serialize(std::wostream & _Wostream) const;
private:
class Impl;
boost::scoped_ptr<Impl> impl_;
};
}
#include <sstream>
#include <boost/foreach.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/functional/hash/hash.hpp>
#include "xlsx_font.h"
namespace oox {
void xlsx_serialize(std::wostream & _Wostream, const xlsx_color & color)
{
return xlsx_serialize(_Wostream, color, L"color");
}
void xlsx_serialize(std::wostream & _Wostream, const xlsx_color & color, const std::wstring & nodeName)
{
std::wstringstream strm;
if (color.autoVal)
strm << L"auto=\"" << (bool)(*color.autoVal) << L"\" ";
if (color.indexed)
strm << L"indexed=\"" << (*color.indexed) << L"\" ";
if (color.rgb)
{
std::wstring rgb = *color.rgb;
boost::algorithm::to_upper(rgb);
strm << L"rgb=\"" << rgb << L"\" ";
}
if (color.theme)
strm << L"theme=\"" << (*color.theme) << L"\" ";
if (color.tint)
strm << L"tint=\"" << (*color.tint) << L"\" ";
if (!strm.str().empty())
{
_Wostream << L"<" << nodeName <<L" ";
_Wostream << strm.str();
_Wostream << L"/>";
}
}
bool xlsx_color::operator == (const xlsx_color & rVal) const
{
const bool res =
autoVal == rVal.autoVal &&
indexed == rVal.indexed &&
rgb == rVal.rgb &&
theme == rVal.theme &&
tint == rVal.tint;
return res;
}
bool xlsx_color::operator != (const xlsx_color & rVal) const
{
return !(this->operator ==(rVal));
}
std::size_t hash_value(xlsx_color const & val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.autoVal.get_value_or(false));
boost::hash_combine(seed, val.indexed.get_value_or(0));
boost::hash_combine(seed, val.rgb.get_value_or(L""));
boost::hash_combine(seed, val.theme.get_value_or(0));
boost::hash_combine(seed, val.tint.get_value_or(0.0));
return seed;
}
}
\ No newline at end of file
#pragma once
#include <iosfwd>
#include <string>
#include <vector>
#include "common.h"
namespace oox {
struct xlsx_color
{
_CP_OPT(bool) autoVal;
_CP_OPT(unsigned int) indexed;
_CP_OPT(std::wstring) rgb;
_CP_OPT(unsigned int) theme;
_CP_OPT(double) tint;
bool operator == (const xlsx_color & rVal) const;
bool operator != (const xlsx_color & rVal) const;
friend void xlsx_serialize(std::wostream & _Wostream, const xlsx_color & color);
friend void xlsx_serialize(std::wostream & _Wostream, const xlsx_color & color, const std::wstring & nodeName);
friend std::size_t hash_value(xlsx_color const & val);
};
}
\ No newline at end of file
......@@ -5,7 +5,6 @@
#include "xlsx_textcontext.h"
#include "xlsx_tablecontext.h"
#include "xlsx_styles.h"
#include "xlsx_output_xml.h"
......@@ -122,7 +121,6 @@ private:
//size_t default_style_;
mediaitems mediaitems_;
xlsx_style_manager xlsx_style_;
//xlsx_defined_names xlsx_defined_names_;
xlsx_table_context xlsx_table_context_;
xlsx_text_context xlsx_text_context_;
......
#include "xlsx_fill.h"
#include "simple_xml_writer.h"
#include <boost/foreach.hpp>
#include <boost/functional/hash/hash.hpp>
namespace oox {
bool xlsx_patternFill::operator == (const xlsx_patternFill & rVal) const
{
return fgColor == rVal.fgColor &&
bgColor == rVal.bgColor &&
patternType == rVal.patternType;
}
bool xlsx_patternFill::operator != (const xlsx_patternFill & rVal) const
{
return !(this->operator ==(rVal));
}
void xlsx_serialize(std::wostream & _Wostream, const xlsx_patternFill & patternFill)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"patternFill")
{
CP_XML_ATTR(L"patternType", patternFill.patternType.get());
if (patternFill.fgColor)
xlsx_serialize(CP_XML_STREAM(), patternFill.fgColor.get(), L"fgColor");
if (patternFill.bgColor)
xlsx_serialize(CP_XML_STREAM(), patternFill.bgColor.get(), L"bgColor");
}
}
}
std::size_t hash_value(xlsx_patternFill const & val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.patternType.get_value_or(L""));
boost::hash_combine(seed, val.fgColor.get_value_or(xlsx_color()));
boost::hash_combine(seed, val.bgColor.get_value_or(xlsx_color()));
return seed;
}
void xlsx_serialize(std::wostream & _Wostream, const xlsx_gradientFill & gradientFill)
{
// TODO
}
std::size_t hash_value(xlsx_gradientFill const & val)
{
std::size_t seed = 0;
return seed;
}
bool xlsx_gradientFill::operator == (const xlsx_gradientFill & rVal) const
{
return true;
}
bool xlsx_gradientFill::operator != (const xlsx_gradientFill & rVal) const
{
return !(this->operator ==(rVal));
}
void xlsx_serialize(std::wostream & _Wostream, const xlsx_fill & fill)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"fill")
{
if (fill.patternFill)
xlsx_serialize(CP_XML_STREAM(), fill.patternFill.get());
if (fill.gradientFill)
xlsx_serialize(CP_XML_STREAM(), fill.gradientFill.get());
}
}
//_Wostream << L"<fill>";
//if (fill.patternFill)
// xlsx_serialize(_Wostream, fill.patternFill.get());
//if (fill.gradientFill)
// xlsx_serialize(_Wostream, fill.gradientFill.get());
//
//_Wostream << L"</fill>";
}
std::size_t hash_value(xlsx_fill const & val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.patternFill.get_value_or(xlsx_patternFill()));
boost::hash_combine(seed, val.gradientFill.get_value_or(xlsx_gradientFill()));
return seed;
}
bool xlsx_fill::operator == (const xlsx_fill & rVal) const
{
return patternFill == rVal.patternFill &&
gradientFill == rVal.gradientFill;
}
bool xlsx_fill::operator != (const xlsx_fill & rVal) const
{
return !(this->operator ==(rVal));
}
}
#pragma once
#include <string>
#include "xlsx_color.h"
#include "common.h"
namespace oox {
struct xlsx_patternFill
{
_CP_OPT(xlsx_color) fgColor;
_CP_OPT(xlsx_color) bgColor;
_CP_OPT(std::wstring) patternType;
bool operator == (const xlsx_patternFill & rVal) const;
bool operator != (const xlsx_patternFill & rVal) const;
friend std::size_t hash_value(xlsx_patternFill const & val);
};
struct xlsx_gradientFill
{
bool operator == (const xlsx_gradientFill & rVal) const;
bool operator != (const xlsx_gradientFill & rVal) const;
friend std::size_t hash_value(xlsx_gradientFill const & val);
};
struct xlsx_fill
{
_CP_OPT(xlsx_patternFill) patternFill;
_CP_OPT(xlsx_gradientFill) gradientFill;
std::size_t index;
bool bDefault;
bool operator == (const xlsx_fill & rVal) const;
bool operator != (const xlsx_fill & rVal) const;
friend std::size_t hash_value(xlsx_fill const & val);
};
void xlsx_serialize(std::wostream & _Wostream, const xlsx_gradientFill & gradientFill);
void xlsx_serialize(std::wostream & _Wostream, const xlsx_patternFill & patternFill);
void xlsx_serialize(std::wostream & _Wostream, const xlsx_fill & fill);
}
#include "xlsx_fill.h"
#include "xlsx_fills.h"
#include "simple_xml_writer.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <boost/unordered_set.hpp>
namespace oox {
class xlsx_fills::Impl
{
public:
typedef boost::unordered_set<xlsx_fill, boost::hash<xlsx_fill> > xlsx_fill_array;
// typedef std::vector<xlsx_fill> xlsx_fill_array;
xlsx_fill_array fills_;
};
xlsx_fills::xlsx_fills(): impl_( new xlsx_fills::Impl() )
{
{
xlsx_patternFill patternFill;
patternFill.patternType = L"none";
xlsx_fill fill;
fill.patternFill = patternFill;
fill.index = 0;
fill.bDefault = true;
impl_->fills_.insert(fill);
}
{
xlsx_patternFill patternFill;
patternFill.patternType = L"gray125";
xlsx_fill fill;
fill.patternFill = patternFill;
fill.index = 1;
fill.bDefault = false;
impl_->fills_.insert(fill);
}
}
xlsx_fills::~xlsx_fills()
{
}
size_t xlsx_fills::size() const
{
return impl_->fills_.size();
}
size_t xlsx_fills::fillId( bool default_set)
{
bool is_default;
return fillId(default_set, is_default);
}
size_t xlsx_fills::fillId(bool default_set, bool & is_default)
{
is_default = true;
//if (cellProp)
//{
// if (_CP_OPT(odf_types::background_color) bgClr = cellProp->common_background_color_attlist_.fo_background_color_)
// {
// if (bgClr->get_type() != odf_types::background_color::Transparent)
// {
// xlsx_color color;
// // alfa + rgb
// color.rgb = L"ff" + bgClr->get_color().get_hex_value();
// xlsx_patternFill patternFill;
// patternFill.bgColor = color;
// patternFill.fgColor = color;
// patternFill.patternType = L"solid";
//
// xlsx_fill fill;
// fill.patternFill = patternFill;
//fill.bDefault = default_set;
// Impl::xlsx_fill_array::const_iterator i = impl_->fills_.find(fill);
//
//if (i != impl_->fills_.end())
// {
// //const unsigned int dbgId = i - impl_->fills_.begin();
// const std::size_t dbgId = i->index;
// if (default_set && i->bDefault != default_set)
// {
// fill.index = i->index;
// impl_->fills_.insert(i,fill);
//
// is_default = default_set;
// return fill.index;
// }
// is_default = i->bDefault;
// return dbgId;
//
// }
// else
// {
// fill.index = impl_->fills_.size();
// impl_->fills_.insert(fill);
//
// is_default = default_set;
// return fill.index;
// }
// }
// }
//}
// TODO
return 0;
}
namespace
{
struct compare_xlsx_fills
{
bool operator() (xlsx_fill const & x1, xlsx_fill const & x2)
{
return x1.index < x2.index;
}
};
}
void xlsx_fills::xlsx_serialize(std::wostream & _Wostream) const
{
std::vector<xlsx_fill> inst_array;
BOOST_FOREACH(const xlsx_fill & inst, impl_->fills_)
{
inst_array.push_back(inst);
}
std::sort(inst_array.begin(), inst_array.end(), compare_xlsx_fills());
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"fills")
{
CP_XML_ATTR(L"count", inst_array.size());
BOOST_FOREACH(const xlsx_fill & f, inst_array)
{
oox::xlsx_serialize(CP_XML_STREAM(), f);
}
}
}
//_Wostream << L"<fills count=\"" << inst_array.size() << L"\" >";
//BOOST_FOREACH(const xlsx_fill & f, inst_array)
//{
// ::cpdoccore::oox::xlsx_serialize(_Wostream, f);
//}
//_Wostream << L"</fills>";
}
void xlsx_serialize(std::wostream & _Wostream, const xlsx_fills & fills)
{
fills.xlsx_serialize(_Wostream);
}
}
#pragma once
#include <string>
#include "xlsx_fill.h"
#include <iosfwd>
#include <boost/scoped_ptr.hpp>
namespace oox {
class xlsx_fills
{
public:
xlsx_fills();
~xlsx_fills();
public:
size_t size() const;
size_t fillId(bool default_set);
size_t fillId(bool default_set,bool & is_default);
void xlsx_serialize(std::wostream & _Wostream) const;
private:
class Impl;
boost::scoped_ptr<Impl> impl_;
};
void xlsx_serialize(std::wostream & _Wostream, const xlsx_fills & fills);
}
#include "xlsx_font.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <boost/functional/hash/hash.hpp>
#include "simple_xml_writer.h"
namespace oox {
namespace {
std::wostream & operator << (std::wostream & _Wostream, const xlsx_vertAlign & vertAlign)
{
switch(vertAlign)
{
default:
case vertAlignBaseline:
_Wostream << L"baseline";
break;
case vertAlignSubscript:
_Wostream << L"subscript";
break;
case vertAlignSuperscript:
_Wostream << L"superscript";
break;
}
return _Wostream;
}
std::wostream & operator << (std::wostream & _Wostream, const XlsxUnderline & u)
{
switch(u)
{
default:
case XUNDERLINE_NONE:
_Wostream << L"none";
break;
case XUNDERLINE_SINGLE:
_Wostream << L"single";
break;
case XUNDERLINE_DOUBLE:
_Wostream << L"double";
break;
case XUNDERLINE_SINGLE_ACCOUNTING:
_Wostream << L"singleAccounting";
break;
case XUNDERLINE_DOUBLE_ACCOUNTING:
_Wostream << L"doubleAccounting";
break;
}
return _Wostream;
}
}
void xlsx_serialize(std::wostream & _Wostream, const xlsx_font & font)
{
CP_XML_WRITER(_Wostream)
{
CP_XML_NODE(L"font")
{
if (font.bold)
{
CP_XML_NODE(L"b")
{
CP_XML_ATTR(L"val", (int)(*font.bold));
}
}
if (font.charset)
{
CP_XML_NODE(L"charset")
{
CP_XML_ATTR(L"val", *font.charset);
}
}
if (font.color)
xlsx_serialize(CP_XML_STREAM(), *font.color);
if (font.condense)
{
CP_XML_NODE(L"condense")
{
CP_XML_ATTR(L"val", (int)(*font.condense));
}
}
if (font.extend)
{
CP_XML_NODE(L"extend")
{
CP_XML_ATTR(L"val", (int)(*font.extend));
}
}
if (font.family)
{
CP_XML_NODE(L"family")
{
CP_XML_ATTR(L"val", (int)(*font.family));
}
}
if (font.i)
{
CP_XML_NODE(L"i")
{
CP_XML_ATTR(L"val", (int)(*font.i));
}
}
if (font.name)
{
CP_XML_NODE(L"name")
{
CP_XML_ATTR(L"val", *font.name);
}
}
if (font.outline)
{
CP_XML_NODE(L"outline")
{
CP_XML_ATTR(L"val", (int)(*font.outline));
}
}
if (font.scheme)
{
CP_XML_NODE(L"scheme")
{
CP_XML_ATTR(L"val", *font.scheme);
}
}
if (font.shadow)
{
CP_XML_NODE(L"shadow")
{
CP_XML_ATTR(L"val", (int)(*font.shadow));
}
}
if (font.strike)
{
CP_XML_NODE(L"strike")
{
CP_XML_ATTR(L"val", (int)(*font.strike));
}
}
if (font.sz)
{
CP_XML_NODE(L"sz")
{
CP_XML_ATTR(L"val", *font.sz);
}
}
if (font.u)
{
CP_XML_NODE(L"u")
{
CP_XML_ATTR(L"val", *font.u);
}
}
if (font.vertAlign)
{
CP_XML_NODE(L"vertAlign")
{
CP_XML_ATTR(L"val", *font.vertAlign);
}
}
}
}
/*
_Wostream << L"<font>";
if (font.bold)
_Wostream << L"<b val=\"" << (int)(*font.bold) << "\" />";
if (font.charset)
_Wostream << L"<charset val=\"" << *font.charset << "\" />";
if (font.color)
xlsx_serialize(_Wostream, *font.color);
if (font.condense)
_Wostream << L"<condense val=\"" << (int)(*font.condense) << "\" />";
if (font.extend)
_Wostream << L"<extend val=\"" << (int)(*font.extend) << "\" />";
if (font.family)
_Wostream << L"<family val=\"" << (int)(*font.family) << "\" />";
if (font.i)
_Wostream << L"<i val=\"" << (int)(*font.i) << "\" />";
if (font.name)
_Wostream << L"<name val=\"" << *font.name << "\" />";
if (font.outline)
_Wostream << L"<outline val=\"" << (int)(*font.outline) << "\" />";
if (font.scheme)
_Wostream << L"<scheme val=\"" << *font.scheme << "\" />";
if (font.shadow)
_Wostream << L"<shadow val=\"" << (int)(*font.shadow) << "\" />";
if (font.strike)
_Wostream << L"<strike val=\"" << (int)(*font.strike) << "\" />";
if (font.sz)
_Wostream << L"<sz val=\"" << *font.sz << "\" />";
if (font.u)
_Wostream << L"<u val=\"" << *font.u << "\" />";
if (font.vertAlign)
_Wostream << L"<vertAlign val=\"" << *font.vertAlign << "\" />";
_Wostream << L"</font>";
*/
}
bool xlsx_font::operator == (const xlsx_font & rVal) const
{
const bool res =
bold.get_value_or(false) == rVal.bold.get_value_or(false) &&
charset == rVal.charset &&
color == rVal.color &&
condense.get_value_or(false) == rVal.condense.get_value_or(false) &&
extend.get_value_or(false) == rVal.extend.get_value_or(false) &&
family == rVal.family &&
i.get_value_or(false) == rVal.i.get_value_or(false) &&
name == rVal.name &&
outline.get_value_or(false) == rVal.outline.get_value_or(false) &&
scheme == rVal.scheme &&
shadow.get_value_or(false) == rVal.shadow.get_value_or(false) &&
strike.get_value_or(false) == rVal.strike.get_value_or(false) &&
sz == rVal.sz &&
u.get_value_or(XUNDERLINE_NONE) == rVal.u.get_value_or(XUNDERLINE_NONE) &&
vertAlign == rVal.vertAlign;
return res;
}
bool xlsx_font::operator != (const xlsx_font & rVal) const
{
return !(this->operator ==(rVal));
}
std::size_t hash_value(xlsx_font const & val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.bold.get_value_or(false));
boost::hash_combine(seed, val.charset.get_value_or(0));
boost::hash_combine(seed, val.color.get_value_or(xlsx_color()));
boost::hash_combine(seed, val.condense.get_value_or(false));
boost::hash_combine(seed, val.extend.get_value_or(false));
boost::hash_combine(seed, val.family.get_value_or(XFAMILY_EMPTY));
boost::hash_combine(seed, val.i.get_value_or(false));
boost::hash_combine(seed, val.name.get_value_or(L""));
boost::hash_combine(seed, val.outline.get_value_or(false));
boost::hash_combine(seed, val.scheme.get_value_or(L""));
boost::hash_combine(seed, val.shadow.get_value_or(false));
boost::hash_combine(seed, val.strike.get_value_or(false));
boost::hash_combine(seed, val.sz.get_value_or(0));
boost::hash_combine(seed, val.u.get_value_or(XUNDERLINE_NONE));
boost::hash_combine(seed, val.vertAlign.get_value_or(vertAlignBaseline));
return seed;
}
}
#pragma once
#include <iosfwd>
#include <string>
#include <vector>
#include "xlsx_color.h"
#include "common.h"
namespace oox {
enum xlsx_vertAlign
{
vertAlignBaseline,
vertAlignSubscript,
vertAlignSuperscript
};
enum XlsxFontFamily
{
XFAMILY_EMPTY = -1,
XFAMILY_NOTAPPLICABLE = 0,
XFAMILY_ROMAN = 1,
XFAMILY_SWISS = 2,
XFAMILY_MODERN = 3,
XFAMILY_SCRIPT = 4,
XFAMILY_DECORATIVE = 5
};
enum XlsxUnderline
{
XUNDERLINE_NONE,
XUNDERLINE_SINGLE,
XUNDERLINE_DOUBLE,
XUNDERLINE_SINGLE_ACCOUNTING,
XUNDERLINE_DOUBLE_ACCOUNTING
};
enum XlsxFontCharset
{
XCHARSET_EMPTY = -1,
XCHARSET_CHARSET_ANSI = 0,
XCHARSET_DEFAULT = 1,
XCHARSET_SYMBOL = 2,
XCHARSET_MAC = 77,
XCHARSET_SHIFTJIS = 128,
XCHARSET_HANGEUL = 129,
XCHARSET_JOHAB = 130,
XCHARSET_GB2312 = 134,
XCHARSET_CHINESEBIG5 = 136,
XCHARSET_GREEK = 161,
XCHARSET_TURKISH = 162,
XCHARSET_VIETNAMESE = 163,
XCHARSET_HEBREW = 177,
XCHARSET_ARABIC = 178,
XCHARSET_BALTIC = 186,
XCHARSET_RUSSIAN = 204,
XCHARSET_THAI = 222,
XCHARSET_EASTEUROPE = 238,
XCHARSET_OEM = 255
};
struct xlsx_font
{
_CP_OPT(bool) bold;
_CP_OPT(unsigned int) charset;
_CP_OPT(xlsx_color) color;
_CP_OPT(bool) condense;
_CP_OPT(bool) extend;
_CP_OPT(XlsxFontFamily) family;
_CP_OPT(bool) i; ///< italic
_CP_OPT(std::wstring) name;
_CP_OPT(bool) outline;
_CP_OPT(std::wstring) scheme;
_CP_OPT(bool) shadow;
_CP_OPT(bool) strike;
_CP_OPT(double) sz;
_CP_OPT(XlsxUnderline) u;
_CP_OPT(xlsx_vertAlign) vertAlign;
mutable std::size_t index;
bool operator == (const xlsx_font & rVal) const;
bool operator != (const xlsx_font & rVal) const;
friend std::size_t hash_value(xlsx_font const & val);
};
void xlsx_serialize(std::wostream & _Wostream, const xlsx_font & font);
}
#include "xlsx_font.h"
#include "xlsx_fonts.h"
#include <boost/foreach.hpp>
#include <boost/functional.hpp>
#include <boost/unordered_set.hpp>
namespace oox {
namespace
{
const double kDefaultFontSize = 10.0;
}
namespace
{
XlsxFontCharset GetXlsxFontCharset()
{
// TODO
return XCHARSET_EMPTY;
}
XlsxFontFamily GetXlsxFontFamily()
{
// TODO
return XFAMILY_EMPTY;
}
xlsx_font OdfFont2XlsxFont()
{
xlsx_font font;
return font;
}
} // namespace
class xlsx_fonts::Impl
{
public:
Impl()
{
}
size_t size() const;
size_t fontId();
//const xlsx_font & getFont(size_t id) const;
void xlsx_serialize(std::wostream & _Wostream) const;
private:
/*int getIndex(const odf_reader::text_format_properties_content * textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp) const;*/
private:
typedef boost::unordered_set<xlsx_font, boost::hash<xlsx_font> > fonts_array_t;
fonts_array_t fonts_;
};
namespace
{
struct compare_xlsx_fonts
{
bool operator() (xlsx_font const & x1, xlsx_font const & x2)
{
return x1.index < x2.index;
}
};
}
void xlsx_fonts::Impl::xlsx_serialize(std::wostream & _Wostream) const
{
std::vector<xlsx_font> fonts;
BOOST_FOREACH(const xlsx_font & fnt, fonts_)
{
fonts.push_back(fnt);
}
std::sort(fonts.begin(), fonts.end(), compare_xlsx_fonts());
_Wostream << L"<fonts count=\"" << fonts.size() << "\">";
for (size_t i = 0; i < fonts.size(); ++i)
oox::xlsx_serialize(_Wostream, fonts[i]);
_Wostream << L"</fonts>";
}
size_t xlsx_fonts::Impl::fontId()
{
xlsx_font fnt = OdfFont2XlsxFont();
fonts_array_t::const_iterator i = fonts_.find(fnt);
if (i != fonts_.end())
return i->index;
else
{
fnt.index = fonts_.size();
fonts_.insert(fnt);
//fonts_.push_back(OdfFont2XlsxFont(textProp, parProp, cellProp));
return fnt.index;
}
}
//const xlsx_font & xlsx_fonts::Impl::getFont(size_t id) const
//{
// return fonts_.at(id);
//}
/*
int xlsx_fonts::Impl::getIndex(const odf_reader::text_format_properties_content * textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp) const
{
const xlsx_font newFont = OdfFont2XlsxFont(textProp, parProp, cellProp);
for (size_t i = 0; i < fonts_.size(); ++i)
{
if (fonts_[i] == newFont)
return static_cast<int>(i);
}
return -1;
}
*/
size_t xlsx_fonts::Impl::size() const { return fonts_.size(); }
void xlsx_serialize(std::wostream & _Wostream, const xlsx_fonts & fonts)
{
fonts.xlsx_serialize(_Wostream);
}
////////////////////////////////////////////////////////////////////////////////////////////////
xlsx_fonts::xlsx_fonts(): impl_(new xlsx_fonts::Impl())
{
}
xlsx_fonts::~xlsx_fonts()
{
}
size_t xlsx_fonts::size() const
{
return impl_->size();
}
void xlsx_fonts::xlsx_serialize(std::wostream & _Wostream) const
{
return impl_->xlsx_serialize(_Wostream);
}
size_t xlsx_fonts::fontId()
{
return impl_->fontId();
}
//const xlsx_font & xlsx_fonts::getFont(size_t id) const
//{
// return impl_->getFont(id);
//}
}
#pragma once
#include <iosfwd>
#include <boost/scoped_ptr.hpp>
namespace oox {
struct xlsx_font;
class xlsx_fonts
{
public:
xlsx_fonts();
~xlsx_fonts();
public:
size_t size() const;
size_t fontId(/*const odf_reader::text_format_properties_content * textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp*/);
const xlsx_font & getFont(size_t id) const;
void xlsx_serialize(std::wostream & _Wostream) const;
private:
class Impl;
boost::scoped_ptr<Impl> impl_;
};
void xlsx_serialize(std::wostream & _Wostream, xlsx_fonts const & fonts);
}
#include <vector>
#include "xlsx_numFmts.h"
namespace oox {
struct xlsx_num_fmts::Impl
{
std::vector<std::wstring> formats_;
static size_t transform_id(size_t id)
{
return id + 164;
}
size_t num_format_id(const std::wstring & format_code);
};
size_t xlsx_num_fmts::Impl::num_format_id(const std::wstring & format_code)
{
for (size_t i = 0; i < formats_.size(); ++i)
{
if (formats_[i] == format_code)
return transform_id(i);
}
formats_.push_back(format_code);
return transform_id(formats_.size() - 1);
}
xlsx_num_fmts::xlsx_num_fmts() : impl_(new xlsx_num_fmts::Impl())
{
}
xlsx_num_fmts::~xlsx_num_fmts()
{}
size_t xlsx_num_fmts::num_format_id(const std::wstring & format_code)
{
return impl_->num_format_id(format_code);
}
void xlsx_num_fmts::xlsx_serialize(std::wostream & _Wostream) const
{
_Wostream << L"<numFmts count=\"" << impl_->formats_.size() << L"\">";
for (size_t i = 0; i < impl_->formats_.size(); ++i)
{
_Wostream << L"<numFmt formatCode=\"" << impl_->formats_[i] <<
L"\" numFmtId=\"" << impl_->transform_id(i) << "\" />";
}
_Wostream << L"</numFmts>";
}
void xlsx_serialize(std::wostream & _Wostream, const xlsx_num_fmts & numFmts)
{
return numFmts.xlsx_serialize(_Wostream);
}
}
#pragma once
#include <string>
#include <iosfwd>
#include <boost/noncopyable.hpp>
#include <boost/scoped_ptr.hpp>
namespace oox {
class xlsx_num_fmts
{
public:
xlsx_num_fmts();
~xlsx_num_fmts();
public:
size_t num_format_id(const std::wstring & format_code);
void xlsx_serialize(std::wostream & _Wostream) const;
private:
struct Impl;
boost::scoped_ptr<Impl> impl_;
};
void xlsx_serialize(std::wostream & _Wostream, const xlsx_num_fmts & numFmts);
}
#include <boost/foreach.hpp>
#include "xlsx_styles.h"
#include "xlsx_fonts.h"
#include "xlsx_borders.h"
#include "xlsx_fills.h"
#include "xlsx_cell_format.h"
#include "xlsx_cell_styles.h"
#include "xlsx_numFmts.h"
#include "xlsx_xf.h"
#include <boost/unordered_set.hpp>
#include <boost/functional.hpp>
namespace oox {
class xlsx_style_manager::Impl
{
public:
//typedef std::vector<xlsx_xf> xlsx_xf_array;
typedef boost::unordered_set<xlsx_xf, boost::hash<xlsx_xf> > xlsx_xf_array;
public:
Impl();
size_t size() const;
size_t xfId( const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set, bool & is_visible);
void xlsx_serialize(std::wostream & _Wostream);
void xlsx_serialize_xf(std::wostream & _Wostream, const xlsx_xf_array & xfArray, const std::wstring & nodeName);
private:
xlsx_fonts fonts_;
xlsx_borders borders_;
xlsx_fills fills_;
xlsx_xf_array cellXfs_;
xlsx_cell_styles cellStyles_;
xlsx_xf_array cellStyleXfs_;
xlsx_num_fmts numFmts_;
private:
size_t next_index_;
void insert(xlsx_xf const & xf)
{
xf.index = next_index_++;
cellXfs_.insert(xf);
}
};
xlsx_style_manager::xlsx_style_manager() : impl_(new xlsx_style_manager::Impl() )
{}
size_t xlsx_style_manager::size() const
{
return impl_->size();
}
size_t xlsx_style_manager::xfId(/*const odf_reader::text_format_properties_content * textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,*/
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set)
{
bool is_visible;
return impl_->xfId(/*textProp, parProp, cellProp,*/ xlxsCellFormat, num_format, default_set, is_visible);
}
size_t xlsx_style_manager::xfId(/*const odf_reader::text_format_properties_content * textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,*/
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set, bool & is_visible)
{
return impl_->xfId(/*textProp, parProp, cellProp, */xlxsCellFormat, num_format, default_set,is_visible);
}
void xlsx_style_manager::xlsx_serialize(std::wostream & _Wostream)
{
return impl_->xlsx_serialize(_Wostream);
}
xlsx_style_manager::~xlsx_style_manager()
{
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
xlsx_style_manager::Impl::Impl() : next_index_(0)
{
//{
// xlsx_xf xfRecord;
// xfRecord.xfId = 0;
// xfRecord.borderId = 0;
// xfRecord.numFmtId = 0;
// xfRecord.fillId = 0;
// xfRecord.fontId = 0;
// insert(xfRecord);
// //cellXfs_.insert(xfRecord);
// //cellXfs_.push_back(xfRecord); // default
//}
{
xlsx_xf xfRecord;
xfRecord.applyNumberForm = true;
xfRecord.numFmtId = 0;
cellStyleXfs_.insert(xfRecord);
//cellStyleXfs_.push_back(xfRecord);
}
}
size_t xlsx_style_manager::Impl::size() const
{
return cellXfs_.size();
}
size_t xlsx_style_manager::Impl::xfId(/*const odf_reader::text_format_properties_content * textProp,
const odf_reader::paragraph_format_properties * parProp,
const odf_reader::style_table_cell_properties_attlist * cellProp,*/
const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set, bool & is_visible )
{
//bool is_visible_set = is_visible;
// const size_t fontId = fonts_.fontId(textProp, parProp, cellProp);
// is_visible = false;
//
//bool default_border = false;
// const size_t borderId = borders_.borderId(cellProp, default_border);
// bool default_fill = false;
// const size_t fillId = fills_.fillId(textProp, parProp, cellProp, default_set,default_fill);
//
// if (!default_border || !default_fill || is_visible_set/* || (fillId >2 && default_set!=default_fill)*/)
// is_visible = true;
// xlsx_alignment alignment = OdfProperties2XlsxAlignment(textProp, parProp, cellProp);
const unsigned int id = next_index_;//static_cast<unsigned int>(cellXfs_.size());
// xlsx_xf xfRecord;
// const bool dbgApplyAlignment = !is_default(alignment);
// xfRecord.applyAlignment = dbgApplyAlignment;
//
// xfRecord.applyBorder = true;
// xfRecord.borderId = borderId;
// xfRecord.applyFill = true; // TODO
// xfRecord.fillId = fillId;
//
// xfRecord.applyFont = true;
// xfRecord.fontId = fontId;
//
// xfRecord.applyProtection = false; // TODO
// if (!num_format.empty())
// {
// xfRecord.applyNumberForm = true;
// xfRecord.numFmtId = numFmts_.num_format_id(num_format);
// }
// else
// if (xlxsCellFormat &&
// xlxsCellFormat->get_cell_type() != XlsxCellType::null)
// {
// xfRecord.applyNumberForm = true;
// xfRecord.numFmtId = xlxsCellFormat->get_num_format();
// }
// xfRecord.xfId = 0;
// xfRecord.alignment = alignment;
// //xlsx_xf_array::const_iterator i = std::find(cellXfs_.begin(), cellXfs_.end(), xfRecord);
// xlsx_xf_array::const_iterator i = cellXfs_.find(xfRecord);
// if (i != cellXfs_.end())
// {
// const std::size_t dbgId = i->index;
// //const unsigned int dbgId = i - cellXfs_.begin();
// return dbgId;
// }
// else
// {
// insert(xfRecord);
// //cellXfs_.push_back(xfRecord);
// }
return id;
}
void xlsx_style_manager::Impl::xlsx_serialize(std::wostream & _Wostream)
{
_Wostream << L"<styleSheet xmlns=\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\">";
oox::xlsx_serialize(_Wostream, numFmts_);
oox::xlsx_serialize(_Wostream, fonts_);
oox::xlsx_serialize(_Wostream, fills_);
oox::xlsx_serialize(_Wostream, borders_);
xlsx_serialize_xf(_Wostream, cellStyleXfs_, L"cellStyleXfs");
xlsx_serialize_xf(_Wostream, cellXfs_, L"cellXfs");
cellStyles_.xlsx_serialize(_Wostream);
_Wostream << L"</styleSheet>";
}
namespace
{
struct compare_xlsx_xf
{
bool operator() (xlsx_xf const & x1, xlsx_xf const & x2)
{
return x1.index < x2.index;
}
};
}
void xlsx_style_manager::Impl::xlsx_serialize_xf(std::wostream & _Wostream, const xlsx_xf_array & xfArray, const std::wstring & nodeName)
{
std::vector<xlsx_xf> xfs_;
BOOST_FOREACH(const xlsx_xf & xfRecord, xfArray)
{
xfs_.push_back(xfRecord);
}
std::sort(xfs_.begin(), xfs_.end(), compare_xlsx_xf());
_Wostream << L"<" << nodeName << L" count=\"" << xfs_.size() << L"\">";
BOOST_FOREACH(const xlsx_xf & xfRecord, xfs_)
{
oox::xlsx_serialize(_Wostream, xfRecord);
}
_Wostream << L"</" << nodeName << L">";
}
}
#pragma once
#include <iosfwd>
#include <string>
#include <boost/scoped_ptr.hpp>
namespace oox {
class xlsx_cell_format;
/// \class class xlsx_style_manager
class xlsx_style_manager
{
public:
xlsx_style_manager();
size_t size() const;
size_t xfId( const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set,bool & is_visible);
size_t xfId(const xlsx_cell_format * xlxsCellFormat,
const std::wstring &num_format, bool default_set);
void xlsx_serialize(std::wostream & _Wostream);
~xlsx_style_manager();
private:
class Impl;
boost::scoped_ptr<Impl> impl_;
};
}
#include "xlsx_xf.h"
#include <ostream>
#include <boost/functional/hash/hash.hpp>
namespace oox {
void xlsx_serialize(std::wostream & _Wostream, const xlsx_xf & xf)
{
_Wostream << L"<xf ";
if (xf.applyAlignment)
_Wostream << L"applyAlignment=\"" << xf.applyAlignment.get() << L"\" ";
if (xf.applyFill)
_Wostream << L"applyFill=\"" << xf.applyFill.get() << L"\" ";
if (xf.applyFont)
_Wostream << L"applyFont=\"" << xf.applyFont.get() << L"\" ";
if (xf.applyNumberForm)
_Wostream << L"applyNumberFormat=\"" << xf.applyNumberForm.get() << L"\" ";
if (xf.applyProtection)
_Wostream << L"applyProtection=\"" << xf.applyProtection.get() << L"\" ";
if (xf.borderId)
_Wostream << L"borderId=\"" << xf.borderId.get() << L"\" ";
if (xf.fillId)
_Wostream << L"fillId=\"" << xf.fillId.get() << L"\" ";
if (xf.fontId)
_Wostream << L"fontId=\"" << xf.fontId.get() << L"\" ";
if (xf.numFmtId)
_Wostream << L"numFmtId=\"" << xf.numFmtId.get() << L"\" ";
if (xf.pivotButton)
_Wostream << L"pivotButton=\"" << xf.pivotButton.get() << L"\" ";
if (xf.quotePrefix)
_Wostream << L"quotePrefix=\"" << xf.quotePrefix.get() << L"\" ";
if (xf.xfId)
_Wostream << L"xfId=\"" << xf.xfId.get() << L"\" ";
_Wostream << L">";
if (xf.alignment)
xlsx_serialize(_Wostream, xf.alignment.get());
if (xf.protection)
xlsx_serialize(_Wostream, xf.protection.get());
_Wostream << L"</xf>";
}
bool xlsx_xf::operator == (const xlsx_xf & rVal) const
{
const bool res =
applyAlignment.get_value_or(false) == rVal.applyAlignment.get_value_or(false) &&
applyBorder.get_value_or(false) == rVal.applyBorder.get_value_or(false) &&
applyFill.get_value_or(false) == rVal.applyFill.get_value_or(false) &&
applyFont.get_value_or(false) == rVal.applyFont.get_value_or(false) &&
applyNumberForm.get_value_or(false) == rVal.applyNumberForm.get_value_or(false) &&
applyProtection.get_value_or(false) == rVal.applyProtection.get_value_or(false) &&
borderId == rVal.borderId &&
fillId == rVal.fillId &&
fontId == rVal.fontId &&
numFmtId == rVal.numFmtId &&
pivotButton.get_value_or(false) == rVal.pivotButton.get_value_or(false) &&
quotePrefix.get_value_or(false) == rVal.quotePrefix.get_value_or(false) &&
//xfId == rVal.xfId &&
alignment == rVal.alignment &&
protection == rVal.protection;
return res;
}
bool xlsx_xf::operator != (const xlsx_xf & rVal) const
{
return !(this->operator ==(rVal));
}
std::size_t hash_value(xlsx_xf const & val)
{
std::size_t seed = 0;
boost::hash_combine(seed, val.applyAlignment.get_value_or(false));
boost::hash_combine(seed, val.applyBorder.get_value_or(false));
boost::hash_combine(seed, val.applyFill.get_value_or(false));
boost::hash_combine(seed, val.applyFont.get_value_or(false));
boost::hash_combine(seed, val.applyNumberForm.get_value_or(false));
boost::hash_combine(seed, val.applyProtection.get_value_or(false));
boost::hash_combine(seed, val.borderId.get_value_or(0));
boost::hash_combine(seed, val.fillId.get_value_or(0));
boost::hash_combine(seed, val.fontId.get_value_or(0));
boost::hash_combine(seed, val.numFmtId.get_value_or(0));
boost::hash_combine(seed, val.pivotButton.get_value_or(false));
boost::hash_combine(seed, val.quotePrefix.get_value_or(false));
boost::hash_combine(seed, val.xfId.get_value_or(0));
boost::hash_combine(seed, val.alignment.get_value_or(xlsx_alignment()));
boost::hash_combine(seed, val.protection.get_value_or(xlsx_protection()));
return seed;
}
}
#pragma once
#include <iosfwd>
#include <string>
#include <boost/scoped_ptr.hpp>
#include "xlsx_alignment.h"
#include "xlsx_protection.h"
namespace oox {
struct xlsx_xf;
typedef boost::scoped_ptr<xlsx_xf> xlsx_xf_ptr;
struct xlsx_xf
{
_CP_OPT(bool) applyAlignment;
_CP_OPT(bool) applyBorder;
_CP_OPT(bool) applyFill;
_CP_OPT(bool) applyFont;
_CP_OPT(bool) applyNumberForm;
_CP_OPT(bool) applyProtection;
_CP_OPT(unsigned int) borderId;
_CP_OPT(unsigned int) fillId;
_CP_OPT(unsigned int) fontId;
_CP_OPT(unsigned int) numFmtId;
_CP_OPT(bool) pivotButton;
_CP_OPT(bool) quotePrefix;
_CP_OPT(unsigned int) xfId;
_CP_OPT(xlsx_alignment) alignment;
_CP_OPT(xlsx_protection) protection;
mutable std::size_t index;
bool operator == (const xlsx_xf & rVal) const;
bool operator != (const xlsx_xf & rVal) const;
friend std::size_t hash_value(xlsx_xf const & val);
};
void xlsx_serialize(std::wostream & _Wostream, const xlsx_xf & xf);
}
......@@ -82,12 +82,11 @@
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
......@@ -103,12 +102,16 @@
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\XlsFormat"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
Optimization="0"
AdditionalIncludeDirectories="..\XlsFormat; ..\Common"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
......@@ -143,11 +146,12 @@
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
......@@ -163,16 +167,12 @@
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\XlsFormat; ..\Common"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AdditionalIncludeDirectories="..\XlsFormat"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
......@@ -5029,7 +5029,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5038,7 +5038,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5073,7 +5073,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5082,7 +5082,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5125,7 +5125,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5134,7 +5134,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5193,7 +5193,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5202,7 +5202,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5245,7 +5245,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5254,7 +5254,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5297,7 +5297,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5306,7 +5306,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5357,7 +5357,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5366,7 +5366,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5401,7 +5401,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5410,7 +5410,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5461,7 +5461,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5470,7 +5470,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5513,7 +5513,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5522,7 +5522,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5565,7 +5565,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5574,7 +5574,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5609,7 +5609,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5618,7 +5618,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5661,7 +5661,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5670,7 +5670,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5713,7 +5713,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5722,7 +5722,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5757,7 +5757,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5766,7 +5766,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5809,7 +5809,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5818,7 +5818,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5885,7 +5885,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5894,7 +5894,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5929,7 +5929,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5938,7 +5938,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5973,7 +5973,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -5982,7 +5982,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6025,7 +6025,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6034,7 +6034,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6085,7 +6085,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6094,7 +6094,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6153,7 +6153,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6162,7 +6162,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6197,7 +6197,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6206,7 +6206,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6257,7 +6257,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6266,7 +6266,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6301,7 +6301,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6310,7 +6310,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6361,7 +6361,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6370,7 +6370,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6405,7 +6405,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6414,7 +6414,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6609,7 +6609,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6618,7 +6618,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6733,7 +6733,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6742,7 +6742,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6817,7 +6817,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -6826,7 +6826,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7045,7 +7045,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7054,7 +7054,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7089,7 +7089,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7098,7 +7098,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7149,7 +7149,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7158,7 +7158,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7232,7 +7232,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7241,7 +7241,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7276,7 +7276,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
......@@ -7285,7 +7285,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
......
......@@ -82,12 +82,11 @@
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
......@@ -103,12 +102,16 @@
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories="..\XlsFormat"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
Optimization="0"
AdditionalIncludeDirectories="..\XlsFormat; ..\Common"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
......@@ -143,11 +146,12 @@
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"
IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="4"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
......@@ -163,16 +167,12 @@
/>
<Tool
Name="VCMIDLTool"
TargetEnvironment="3"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\XlsFormat; ..\Common"
PreprocessorDefinitions="WIN32;_DEBUG;_LIB"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
AdditionalIncludeDirectories="..\XlsFormat"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
......@@ -284,135 +284,27 @@
>
</File>
<File
RelativePath="..\common\simple_xml_writer.h"
>
</File>
<File
RelativePath="..\..\..\Common\DocxFormat\Source\XML\stringcommon.cpp"
>
</File>
<File
RelativePath="..\common\utils.cpp"
>
</File>
<File
RelativePath="..\common\utils.h"
>
</File>
</Filter>
<Filter
Name="styles"
>
<File
RelativePath="..\XlsXlsxConverter\xlsx_alignment.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_alignment.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_border.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_border.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_borders.cpp"
RelativePath="..\..\..\Common\3dParty\pole\pole.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_borders.h"
RelativePath="..\..\..\Common\3dParty\pole\pole.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_cell_format.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_cell_format.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_cell_style.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_cell_style.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_cell_styles.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_cell_styles.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_color.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_color.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_fill.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_fill.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_fills.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_fills.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_font.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_font.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_fonts.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_fonts.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_numFmts.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_numFmts.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_protection.cpp"
RelativePath="..\common\simple_xml_writer.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_protection.h"
RelativePath="..\..\..\Common\DocxFormat\Source\XML\stringcommon.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_xf.cpp"
RelativePath="..\common\utils.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_xf.h"
RelativePath="..\common\utils.h"
>
</File>
</Filter>
......@@ -495,14 +387,6 @@
RelativePath="..\XlsXlsxConverter\xlsx_sharedstrings.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_styles.cpp"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_styles.h"
>
</File>
<File
RelativePath="..\XlsXlsxConverter\xlsx_tablecontext.cpp"
>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment