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

XlsFormat - правка багов по результатам тестирования

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68495 954022d7-b5bf-4e40-9824-e11837661b57
parent fb2f2c0f
......@@ -664,7 +664,8 @@ const std::wstring make3dRef(const unsigned short ixti, const std::wstring cell_
{
return sheets_prefix;
}
return sheets_prefix + L'!' + cell_ref;
else if (!sheets_prefix.empty()) sheets_prefix += L"!";
return sheets_prefix + cell_ref;
}
......
......@@ -32,6 +32,8 @@ void Format::readFields(CFRecord& record)
}
int Format::serialize(std::wostream & stream)
{
if (ifmt < 164) return 0;
CP_XML_WRITER(stream)
{
CP_XML_NODE(L"numFmt")
......@@ -40,7 +42,7 @@ int Format::serialize(std::wostream & stream)
CP_XML_ATTR(L"formatCode", stFormat.value());
}
}
return 0;
return 1;
}
} // namespace XLS
......
......@@ -26,8 +26,8 @@ public:
int serialize(std::wostream & stream);
//-----------------------------
BIFF_WORD cmcs;
BiffStructurePtrVector rgref;
_UINT16 cmcs;
BiffStructurePtrVector rgref;
};
......
......@@ -25,10 +25,6 @@ public:
//-----------------------------
XLUnicodeString string;
public:
//BO_ATTRIB_MARKUP_BEGIN
//BO_ATTRIB_MARKUP_ATTRIB(string)
//BO_ATTRIB_MARKUP_END
};
......
......@@ -117,8 +117,11 @@ int TxO::serialize (std::wostream & _stream)
serialize_rPr(CP_XML_STREAM(), Fmt, namespace_);
CP_XML_NODE(namespace_ + L"t")
{
//CP_XML_ATTR(L"xml:space", L"preserve");
{
if (preserve_enabled)
{
CP_XML_ATTR(L"xml:space", L"preserve");
}
if (run->formatRun.ich > str_.length())
{
......
......@@ -19,8 +19,9 @@ class TxO: public BiffRecordContinued
public:
TxO(MsoDrawingPtr mso_drawing) : mso_drawing_(mso_drawing), fmla(false)
{
cbRuns = 0;
sp_enabled = false;
cbRuns = 0;
sp_enabled = false;
preserve_enabled = false;
}
~TxO();
......@@ -58,6 +59,10 @@ public:
MsoDrawingPtr mso_drawing_;
//---------------------------------------------
bool preserve_enabled;
};
} // namespace XLS
......
......@@ -44,7 +44,7 @@ void NoteSh::load(CFRecord& record)
record >> idObj >> stAuthor;
record.skipNunBytes(1); // unused
ref = CellRef(row, col, false, false).toString();
ref = CellRef(row, col, true, true).toString();
}
......
......@@ -555,22 +555,22 @@ void LineStyleBooleanProperties::load(XLS::CFRecord& record)
{
OfficeArtFOPTE::load(record);
fNoLineDrawDash = GETBIT(op, 0);
fLineFillShape = GETBIT(op, 1);
fHitTestLine = GETBIT(op, 2);
fLine = GETBIT(op, 3);
fArrowheadsOK = GETBIT(op, 4);
fInsetPenOK = GETBIT(op, 5);
fInsetPen = GETBIT(op, 6);
fLineOpaqueBackColor = GETBIT(op, 9);
fUsefNoLineDrawDash = GETBIT(op, 16);
fUsefLineFillShape = GETBIT(op, 17);
fUsefHitTestLine = GETBIT(op, 18);
fUsefLine = GETBIT(op, 19);
fUsefArrowheadsOK = GETBIT(op, 20);
fUsefInsetPenOK = GETBIT(op, 21);
fUsefInsetPen = GETBIT(op, 22);
fUsefLineOpaqueBackColor = GETBIT(op, 25);
fNoLineDrawDash = GETBIT(op, 0);
fLineFillShape = GETBIT(op, 1);
fHitTestLine = GETBIT(op, 2);
fLine = GETBIT(op, 3);
fArrowheadsOK = GETBIT(op, 4);
fInsetPenOK = GETBIT(op, 5);
fInsetPen = GETBIT(op, 6);
fLineOpaqueBackColor = GETBIT(op, 9);
fUsefNoLineDrawDash = GETBIT(op, 16);
fUsefLineFillShape = GETBIT(op, 17);
fUsefHitTestLine = GETBIT(op, 18);
fUsefLine = GETBIT(op, 19);
fUsefArrowheadsOK = GETBIT(op, 20);
fUsefInsetPenOK = GETBIT(op, 21);
fUsefInsetPen = GETBIT(op, 22);
fUsefLineOpaqueBackColor= GETBIT(op, 25);
}
void ShadowStyleBooleanProperties::load(XLS::CFRecord& record)
......@@ -614,7 +614,20 @@ void IHlink::load(XLS::CFRecord& record)
void pihlShape::ReadComplexData(XLS::CFRecord& record)
{
record >> IHlink_complex;
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
//---------------------------------------------------------------------------------------------
MSOPOINT::MSOPOINT()
......@@ -826,12 +839,7 @@ ADJH::ADJH()
ADJH::ADJH(unsigned short cbElement_)
{
cbElement = 4;
if (cbElement_ == 0xfff0)
{
cbElement = 2;
}
cbElement = cbElement_;
}
XLS::BiffStructurePtr ADJH::clone()
......@@ -857,29 +865,104 @@ void ADJH::load(XLS::CFRecord& record)
fahxRange = GETBIT(flag, 21);
fahyRange = GETBIT(flag, 20);
fahPolarPin = GETBIT(flag, 19);
record >> apX >> apY >> xRange >> yRange;
record >> xMin >> xMax >> yMin >> yMax;
cbElement -= 4;
if (cbElement == 4)
{
_UINT16 x, y;
record >> x >> y;
apX = x;
apY = y;
cbElement -= 4;
}
else
{
record >> apX >> apY;
cbElement -= 8;
}
if (cbElement < 1) return;
if (fahxRange) record >> xRange;
if (fahyRange) record >> yRange;
if (fahxMin) record >> xMin;
if (fahxMax) record >> xMax;
if (fahyMin) record >> yMin;
if (fahyMax) record >> yMax;
}
//---------------------------------------------------------------------------------------------
void PVertices::ReadComplexData(XLS::CFRecord& record)
{
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
void PSegmentInfo::ReadComplexData(XLS::CFRecord& record)
{
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
void pGuides::ReadComplexData(XLS::CFRecord& record)
{
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
void pAdjustHandles::ReadComplexData(XLS::CFRecord& record)
{
int pos = record.getRdPtr();
record >> complex;
int pos2 = record.getRdPtr() - pos;
if (pos2 > 0 && pos2 < op)
{
record.skipNunBytes(op - pos2);
}
if (pos2 > 0 && pos2 > op)
{
record.RollRdPtrBack( pos2 - op);
}
}
}
......@@ -728,7 +728,7 @@ class pihlShape : public OfficeArtFOPTE
void ReadComplexData(XLS::CFRecord& record);
IHlink IHlink_complex;
IHlink complex;
};
......
......@@ -26,10 +26,13 @@ public:
const CellRef getLocation() const;
BaseObjectPtr m_Formula;
BaseObjectPtr m_TableFormula;
BaseObjectPtr m_ArrayFormula;
BaseObjectPtr m_SharedFormula;
BaseObjectPtr m_Formula;
BaseObjectPtr m_TableFormula;
BaseObjectPtr m_ArrayFormula;
BaseObjectPtr m_SharedFormula;
BaseObjectPtr m_Cash;
std::vector<BaseObjectPtr> m_arContinue;
CellRef location;
......
......@@ -65,7 +65,6 @@ const bool FORMULA::loadContent(BinProcessor& proc)
if(!m_ArrayFormula && !m_TableFormula)
{
//proc.optional<ShrFmla>(); // replaced with below:
ShrFmla shr_formula(location);
if(proc.optional(shr_formula))
{
......@@ -88,7 +87,16 @@ const bool FORMULA::loadContent(BinProcessor& proc)
if(proc.optional<String>())
{
proc.repeated<Continue>(0, 0);
m_Cash = elements_.back();
elements_.pop_back();
int count = proc.repeated<Continue>(0, 0);
while(count > 0)
{
m_arContinue.insert(m_arContinue.begin(), elements_.back());
elements_.pop_back();
count--;
}
}
return true;
......@@ -101,68 +109,90 @@ const CellRef FORMULA::getLocation() const
int FORMULA::serialize(std::wostream & stream)
{
Formula *formula = dynamic_cast<Formula *>(m_Formula.get());
ShrFmla *shared = dynamic_cast<ShrFmla *>(m_SharedFormula.get());
if (formula == NULL) return 0;
Formula *formula = dynamic_cast<Formula *> (m_Formula.get());
ShrFmla *shared = dynamic_cast<ShrFmla *> (m_SharedFormula.get());
Array *array_ = dynamic_cast<Array *> (m_ArrayFormula.get());
Table *table = dynamic_cast<Table *> (m_TableFormula.get());
if (formula == NULL && shared == NULL && array_ == NULL && table == NULL) return 0;
CP_XML_WRITER(stream)
{
std::wstring ref = formula->cell.getLocation().toString();
std::wstring formula_str;
std::wstring formula_cash;
CP_XML_NODE(L"c")
{
CP_XML_ATTR(L"r", ref);
if ((formula->cell.ixfe.value()) && (formula->cell.ixfe > m_global_info->cellStyleXfs_count))
if (formula)
{
CP_XML_ATTR(L"s", formula->cell.ixfe - m_global_info->cellStyleXfs_count);
switch (formula->val.getType())
{
case 0: CP_XML_ATTR(L"t", L"str"); break;
case 1: CP_XML_ATTR(L"t", L"b"); break;
case 2: CP_XML_ATTR(L"t", L"e"); break;
}
if ((formula->cell.ixfe.value()) && (formula->cell.ixfe > m_global_info->cellStyleXfs_count))
{
CP_XML_ATTR(L"s", formula->cell.ixfe - m_global_info->cellStyleXfs_count);
}
}
switch (formula->val.getType())
{
case 0: CP_XML_ATTR(L"t", L"str"); break;
case 1: CP_XML_ATTR(L"t", L"b"); break;
case 2: CP_XML_ATTR(L"t", L"e"); break;
}
const std::wstring & f_ = formula->formula.getAssembledFormula();
if (!f_.empty())
{
CP_XML_NODE(L"f")
CP_XML_NODE(L"f")
{
if (formula)
{
CP_XML_STREAM() << xml::utils::replace_text_to_xml(f_);
formula_str = formula->formula.getAssembledFormula();
formula_cash = formula->val.getValue();
}
}
else if (shared)
{
const std::wstring & f_ = shared->formula.getAssembledFormula();
CP_XML_NODE(L"f")
if ((shared) || ((formula) && (formula->fShrFmla && m_sharedIndex >= 0)))
{
std::wstring shared_ref = shared->ref_.toString();
CP_XML_ATTR(L"ref", shared_ref);
if (shared)
{
formula_str = shared->formula.getAssembledFormula();
CP_XML_ATTR(L"ref", shared->ref_.toString());
}
CP_XML_ATTR(L"t", L"shared");
CP_XML_ATTR(L"si", m_sharedIndex);
}
if (array_)
{
CP_XML_ATTR(L"ref", array_->ref_.toString());
CP_XML_ATTR(L"t", L"array");
formula_str = array_->formula.getAssembledFormula();
//aca="true" ca="true"
}
CP_XML_STREAM() << xml::utils::replace_text_to_xml(f_);
if (!formula_str.empty())
{
CP_XML_STREAM() << xml::utils::replace_text_to_xml(formula_str);
}
}
else if (formula->fShrFmla && m_sharedIndex >= 0)
if (formula_cash.empty())
{
CP_XML_NODE(L"f")
if (m_Cash)
{
CP_XML_ATTR(L"t", L"shared");
CP_XML_ATTR(L"si", m_sharedIndex);
String * str = dynamic_cast<String*>(m_Cash.get());
if (str)
formula_cash =str->string.value();
}
}
std::wstring str_val = formula->val.getValue();
if (!str_val.empty())
if (!formula_cash.empty())
{
CP_XML_NODE(L"v")
{
CP_XML_STREAM() << str_val;
CP_XML_STREAM() << formula_cash;
}
}
}
}
}
return 0;
}
......
......@@ -227,7 +227,11 @@ const bool WorksheetSubstream::loadContent(BinProcessor& proc)
count = proc.repeated<MergeCells>(0, 0);
while(count > 0)
{
m_arMergeCells.insert(m_arMergeCells.begin(), elements_.back());
MergeCells* m = dynamic_cast<MergeCells*>(elements_.back().get());
if ((m) && (m->rgref.size() > 0))
{
m_arMergeCells.insert(m_arMergeCells.begin(), elements_.back());
}
elements_.pop_back();
count--;
}
......
......@@ -251,7 +251,7 @@ namespace oox
//case msosptPlaque : return L"plaque";
//case msosptCan : return L"can";
//case msosptDonut : return L"donut";
//case msosptStraightConnector1 : return L"straightConnector1";
case msosptStraightConnector1 : return L"straightConnector1";
//case msosptBentConnector2 : return L"bentConnector2";
//case msosptBentConnector3 : return L"bentConnector3";
//case msosptBentConnector4 : return L"bentConnector4";
......
......@@ -781,12 +781,11 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
sp = dynamic_cast<ODRAW::OfficeArtSpContainer*>(group_objects.back().spgr->child_records[group_objects.back().ind++].get());
}
convert(sp, true);
}
convert(text_obj);
convert(chart);
}
if (type_object == 0x19)
{
text_obj->preserve_enabled = true;
for (int i = 0 ; i < sheet->m_arNote.size(); i++)
{
XLS::Note* note = dynamic_cast<XLS::Note*>(sheet->m_arNote[i].get());
......@@ -797,6 +796,8 @@ void XlsConverter::convert(XLS::OBJECTS* objects, XLS::WorksheetSubstream * shee
}
}
}
convert(text_obj);
convert(chart);
xlsx_context->get_drawing_context().end_drawing();
}
......@@ -865,6 +866,7 @@ void XlsConverter::convert(ODRAW::OfficeArtRecord * art)
art->serialize(strm);
xlsx_context->get_drawing_context().set_child_anchor(ch->_x, ch->_y, ch->_cx, ch->_cy);
xlsx_context->get_drawing_context().set_sheet_anchor(strm.str());
}break;
}
......@@ -1342,7 +1344,7 @@ void XlsConverter::convert_group_shape(std::vector<ODRAW::OfficeArtFOPTEPtr> & p
case 0x380:
{
ODRAW::anyString *str = dynamic_cast<ODRAW::anyString*>(props[i].get());
xlsx_context->get_drawing_context().set_name(str->string_);
xlsx_context->get_drawing_context().set_name(str->string_);
}break;
case 0x381:
{
......@@ -1357,17 +1359,17 @@ void XlsConverter::convert_group_shape(std::vector<ODRAW::OfficeArtFOPTEPtr> & p
std::wstring sTarget;
bool bExternal = false;
if (pihlShape->IHlink_complex.hyperlink.hlstmfHasMoniker)
if (pihlShape->complex.hyperlink.hlstmfHasMoniker)
{
sTarget = GetTargetMoniker(pihlShape->IHlink_complex.hyperlink.oleMoniker.data.get());
sTarget = GetTargetMoniker(pihlShape->complex.hyperlink.oleMoniker.data.get());
bExternal = true;
}
else if (pihlShape->IHlink_complex.hyperlink.hlstmfHasLocationStr)
else if (pihlShape->complex.hyperlink.hlstmfHasLocationStr)
{
sTarget = pihlShape->IHlink_complex.hyperlink.location.value();
sTarget = pihlShape->complex.hyperlink.location.value();
}
std::wstring sDisplay = pihlShape->IHlink_complex.hyperlink.displayName;
std::wstring sDisplay = pihlShape->complex.hyperlink.displayName;
if (sDisplay.empty()) sDisplay = sTarget;
xlsx_context->get_drawing_context().set_hyperlink( sTarget, sDisplay, bExternal);
......
......@@ -11,6 +11,19 @@
#include "oox_rels.h"
struct sort_
{
inline bool operator() (const oox::_xlsx_comment& c1, const oox::_xlsx_comment& c2)
{
if (c1.row_ < c2.row_) return true;
if (c1.row_ > c2.row_) return false;
if (c1.col_ < c2.col_) return true;
return false;
}
};
namespace oox {
unsigned int hex_string_to_int(std::wstring str)
......@@ -21,14 +34,17 @@ namespace oox {
ss >> x;
return x;
}
class xlsx_comments::Impl
{
public:
void serialize(std::wostream & strm) const
void serialize(std::wostream & strm)
{
CP_XML_WRITER(strm)
//std::sort(xlsx_comment_.begin(), xlsx_comment_.end(), sort_());
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"comments")
{
......@@ -77,33 +93,34 @@ public:
CP_XML_ATTR(L"xmlns:v", L"urn:schemas-microsoft-com:vml");
CP_XML_ATTR(L"xmlns:o", L"urn:schemas-microsoft-com:office:office");
CP_XML_ATTR(L"xmlns:x", L"urn:schemas-microsoft-com:office:excel");
CP_XML_NODE(L"v:shapetype")
{
CP_XML_ATTR(L"id" , L"_x0000_t202");
CP_XML_ATTR(L"coordsize", L"21600,21600");
CP_XML_ATTR(L"o:spt" , L"202");
CP_XML_ATTR(L"path" , L"m,l,21600r21600,l21600,xe");
CP_XML_NODE(L"v:stroke")
{
CP_XML_ATTR(L"joinstyle", L"miter");
}
CP_XML_NODE(L"v:path")
{
CP_XML_ATTR(L"gradientshapeok", L"t");
CP_XML_ATTR(L"o:connecttype", L"rect");
}
}
int count = 0;
BOOST_FOREACH(_xlsx_comment const & c, xlsx_comment_)
{
CP_XML_NODE(L"v:shapetype")
{
CP_XML_ATTR(L"id" , L"shapetype_202");
CP_XML_ATTR(L"coordsize", L"21600,21600");
CP_XML_ATTR(L"o:spt" , L"202");
CP_XML_ATTR(L"path" , L"m,l,21600l21600,21600l21600,xe");
CP_XML_NODE(L"v:stroke")
{
CP_XML_ATTR(L"joinstyle", L"miter");
}
CP_XML_NODE(L"v:path")
{
CP_XML_ATTR(L"gradientshapeok", L"t");
CP_XML_ATTR(L"o:connecttype", L"rect");
}
}
CP_XML_NODE(L"v:shape")
{
CP_XML_ATTR(L"fillcolor", std::wstring(L"#") + c.fill_);
CP_XML_ATTR(L"id", L"shape_0");
CP_XML_ATTR(L"id", L"shape_" + boost::lexical_cast<std::wstring>(count++));
std::wstring style = std::wstring(L"position:absolute;");
......@@ -111,11 +128,13 @@ public:
style += std::wstring(L"margin-top:") + boost::lexical_cast<std::wstring>(c.top_) + std::wstring(L"pt;");
style += std::wstring(L"width:") + boost::lexical_cast<std::wstring>(c.width_) + std::wstring(L"pt;");
style += std::wstring(L"height:") + boost::lexical_cast<std::wstring>(c.height_) + std::wstring(L"pt;");
style += std::wstring(L"z-index:") + boost::lexical_cast<std::wstring>(count) + std::wstring(L";");
if (c.visibly_ == false) style += std::wstring(L"visibility:hidden;");
CP_XML_ATTR(L"style",style);
CP_XML_ATTR(L"type", L"shapetype_202");
CP_XML_ATTR(L"type", L"_x0000_t202");
//if (odf_reader::GetProperty(c.graphicProperties_,L"opacity",dVal))
//{
// CP_XML_ATTR(L"opacity",boost::lexical_cast<std::wstring>((int)(100.-dVal.get())) + L"%");
......@@ -133,9 +152,8 @@ public:
}
CP_XML_NODE(L"v:fill")
{
CP_XML_ATTR(L"detectmouseclick", L"t");
CP_XML_ATTR(L"color" , std::wstring(L"#") + c.fill_);
CP_XML_ATTR(L"color2" , std::wstring(L"#") + c.fill_);
//CP_XML_ATTR(L"color2" , std::wstring(L"#") + c.fill_);
CP_XML_ATTR(L"type" , L"solid");
//if (odf_reader::GetProperty(c.graphicProperties_,L"opacity",dVal))
//{
......@@ -152,11 +170,11 @@ public:
//{
// CP_XML_ATTR(L"opacity",(100.-dVal.get())/100.);
//}
CP_XML_ATTR(L"endcap" , L"flat");
CP_XML_ATTR(L"joinstyle" , L"round");
CP_XML_ATTR(L"startarrow" , L"block");
CP_XML_ATTR(L"v:startarrowwidth", L"medium");
CP_XML_ATTR(L"startarrowlength" , L"medium");
//CP_XML_ATTR(L"endcap" , L"flat");
//CP_XML_ATTR(L"joinstyle" , L"round");
//CP_XML_ATTR(L"startarrow" , L"block");
//CP_XML_ATTR(L"v:startarrowwidth", L"medium");
//CP_XML_ATTR(L"startarrowlength" , L"medium");
}
CP_XML_NODE(L"x:ClientData")
{
......
......@@ -217,6 +217,12 @@ _color xlsx_drawing_context::CorrectSysColor(int nColorCode, _drawing_state_ptr
if ( nAdditionalFlags & 0x20 ) // invert color
color.SetRGB(0xff - color.GetR(), 0xff - color.GetG(), 0xff - color.GetB());
//if (color.sRGB.empty())
//{
// color.nRGB = shemeDefaultColor[nColorIndex];
// color.index = -1;
// color.sRGB = STR::toRGB(color.nRGB);
//}
return color;
}
......@@ -454,13 +460,13 @@ void xlsx_drawing_context::end_drawing(_drawing_state_ptr & drawing_state)
}
if ( drawing_state->type == external_items::typeComment )
{
context_.get_comments_context().set_fill_color(drawing_state->fill.color.sRGB);
context_.get_comments_context().set_line_color(drawing_state->line.fill.color.sRGB);
//context_.get_comments_context().set_fill_color(drawing_state->fill.color.sRGB);
//context_.get_comments_context().set_line_color(drawing_state->line.fill.color.sRGB);
context_.get_comments_context().add_content(drawing_state->text.content);
context_.get_comments_context().set_size( drawing_state->child_anchor.cx / 12700,
drawing_state->child_anchor.cy / 12700,
context_.get_comments_context().set_size( drawing_state->child_anchor.cx / 12700 +2,
drawing_state->child_anchor.cy / 12700 +2,
drawing_state->child_anchor.x / 12700,
drawing_state->child_anchor.y / 12700); //in pt (1 pt = 12700 emu)
context_.get_comments_context().end_comment();
......@@ -738,7 +744,10 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
CP_XML_STREAM() << customGeom;
}
}
serialize_fill(CP_XML_STREAM(), drawing_state);
if (!is_lined_shape(drawing_state))
{
serialize_fill(CP_XML_STREAM(), drawing_state);
}
serialize_line(CP_XML_STREAM(), drawing_state);
}
serialize_text(CP_XML_STREAM(), drawing_state);
......@@ -748,6 +757,22 @@ void xlsx_drawing_context::serialize_shape(_drawing_state_ptr & drawing_state)
drawing_state->shape = strm.str();
}
bool xlsx_drawing_context::is_lined_shape (_drawing_state_ptr & drawing_state)
{
if (drawing_state->shape_id == msosptStraightConnector1 ||
drawing_state->shape_id == msosptLine ||
drawing_state->shape_id == msosptBentConnector2 ||
drawing_state->shape_id == msosptBentConnector3 ||
drawing_state->shape_id == msosptBentConnector4 ||
drawing_state->shape_id == msosptBentConnector5 ||
drawing_state->shape_id == msosptCurvedConnector2 ||
drawing_state->shape_id == msosptCurvedConnector3 ||
drawing_state->shape_id == msosptCurvedConnector4 ||
drawing_state->shape_id == msosptCurvedConnector5 )return true;
return false;
}
std::wstring xlsx_drawing_context::convert_custom_shape(_drawing_state_ptr & drawing_state)
{
NSCustomShapesConvert::CCustomShape * shape = NSCustomShapesConvert::CCustomShape::CreateByType(drawing_state->shape_id);
......@@ -1056,7 +1081,9 @@ void xlsx_drawing_context::serialize_gradient_fill(std::wostream & stream, _draw
}
CP_XML_NODE(L"a:lin")
{
CP_XML_ATTR(L"ang", (int)( 90 - fill.angle) * 60000);
int val = 90 - fill.angle;
if (val < 0) val = 0;
CP_XML_ATTR(L"ang", val * 60000);
CP_XML_ATTR(L"scaled", 1);
}
}
......@@ -1490,15 +1517,25 @@ void xlsx_drawing_context::set_line_color (int index, int type)
{
if (current_drawing_states == NULL) return;
//drawing_state.back().line.color.index = index;
//drawing_state.back().line.color.sRGB = L"";
current_drawing_states->back()->line.fill.color.nRGB = shemeDefaultColor[index];
current_drawing_states->back()->line.fill.color.index = -1;
current_drawing_states->back()->line.fill.color.sRGB = STR::toRGB(shemeDefaultColor[index]);
_color color;
if (type == 3)
{
color = CorrectSysColor(index, current_drawing_states->back());
}
else
{
if (index < 64)
{
color.nRGB = shemeDefaultColor[index];
color.sRGB = STR::toRGB(color.nRGB);
}
color.index = -1;
}
if (type == 1)
current_drawing_states->back()->line.fill.color.bScheme = true;
if (color.sRGB.empty())
return;
current_drawing_states->back()->line.fill.color = color;
}
void xlsx_drawing_context::set_fill_angle (double val)
{
......@@ -1545,9 +1582,11 @@ void xlsx_drawing_context::set_fill_color (int index, int type, bool background)
}
color.index = -1;
}
if (color.sRGB.empty())
return;
if (background) current_drawing_states->back()->fill.color2 = color;
else current_drawing_states->back()->fill.color = color;
else current_drawing_states->back()->fill.color = color;
}
void xlsx_drawing_context::set_fill_opacity (double val, bool background)
{
......
......@@ -324,6 +324,7 @@ public:
void serialize_fill (std::wostream & stream);
void serialize (std::wostream & stream);
//-----------------------------------------------------------------------------------
bool is_lined_shape (_drawing_state_ptr & drawing_state);
void end_drawing();
void end_group();
private:
......
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