Compare commits

..

3 Commits

Author SHA1 Message Date
d2c092fe62 pivot 2017-04-21 15:05:23 +03:00
a336917338 OdfFormatWriter - image bullet presentation list style 2017-04-21 14:12:50 +03:00
8925ddeee5 big integer from buffer bug 2017-04-21 10:24:17 +03:00
28 changed files with 1472 additions and 378 deletions

View File

@ -67,30 +67,41 @@ public:
odf_type_name =L"ooxml-snip2DiagRect";
modifiers = L"0 16667";
enhanced_path = L"M ?f9 ?f2 L ?f13 ?f2 ?f1 ?f12 ?f1 ?f11 ?f10 ?f3 ?f12 ?f3 ?f0 ?f14 ?f0 ?f9 Z N";
text_areas = L"?f17 ?f17 ?f18 ?f19";
view_box = L"0 0 21600 21600";
enhanced_path = L"M ?f3 0 L ?f7 0 ?f14 ?f6 ?f14 ?f5 ?f4 ?f17 ?f6 ?f17 0 ?f8 0 ?f3 Z N";
text_areas = L"?f11 ?f11 ?f12 ?f13";
view_box = L"0 0 0 0";
add(L"f0", L"left");
add(L"f1", L"right");
add(L"f2", L"top");
add(L"f3", L"bottom");
add(L"f4", L"?f3 - ?f2");
add(L"f5", L"?f1 - ?f0");
add(L"f6", L"min(?f5, ?f4)");
add(L"f7", L"$0");
add(L"f8", L"$1");
add(L"f9", L"?f6 * ?f7 / 100000");
add(L"f10", L"?f1 - ?f9");
add(L"f11", L"?f3 - ?f9");
add(L"f12", L"?f6 * ?f8 / 100000");
add(L"f13", L"?f1 - ?f12");
add(L"f14", L"?f3 - ?f12");
add(L"f15", L"?f9 - ?f12");
add(L"f16", L"if(?f15, ?f9, ?f12)");
add(L"f17", L"?f16 / 2");
add(L"f18", L"?f1 - ?f17");
add(L"f19", L"?f3 - ?f17");
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
add(L"f1", L"if(0-$1 ,0,if(50000-$1 ,$1 ,50000))");
add(L"f2", L"min(logwidth,logheight)");
add(L"f3", L"?f2 *?f0 /100000");
add(L"f4", L"logwidth+0-?f3 ");
add(L"f5", L"logheight+0-?f3 ");
add(L"f6", L"?f2 *?f1 /100000");
add(L"f7", L"logwidth+0-?f6 ");
add(L"f8", L"logheight+0-?f6 ");
add(L"f9", L"?f3 +0-?f6 ");
add(L"f10", L"if(?f9 ,?f3 ,?f6 )");
add(L"f11", L"?f10 *1/2");
add(L"f12", L"logwidth+0-?f11 ");
add(L"f13", L"logheight+0-?f11 ");
add(L"f14", L"logwidth");
add(L"f15", L"logheight/2");
add(L"f16", L"logwidth/2");
add(L"f17", L"logheight");
_handle h;
h.position = L"?f3 0";
h.x_maximum= L"50000";
h.x_minimum= L"0";
handles.push_back(h);
h.position = L"?f7 0";
h.x_maximum= L"50000";
h.x_minimum= L"0";
handles.push_back(h);
}
};
class oox_shape_snip2SameRect : public oox_shape

View File

@ -289,7 +289,14 @@ office_element_ptr odf_conversion_context::start_tabs()
create_element(L"style", L"tab-stops", temporary_.elm, this,true);
return temporary_.elm;
}
std::wstring odf_conversion_context::add_image(const std::wstring & image_file_name)
{
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage, odf_ref_name);
return odf_ref_name;
}
void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, _CP_OPT(int) leader)
{
if (!temporary_.elm) return;

View File

@ -95,7 +95,7 @@ public:
virtual void start_text_context() = 0;
virtual void end_text_context() = 0;
virtual void start_image(const std::wstring & image_file_name) = 0;
std::wstring add_image(const std::wstring & image_file_name);
virtual odf_style_context * styles_context();

View File

@ -125,7 +125,7 @@ public:
void start_frame ();
void end_frame ();
void start_image (std::wstring file_path);
void start_image (std::wstring odf_file_path);
void end_image ();
bool change_text_box_2_wordart ();

View File

@ -560,8 +560,8 @@ void odf_lists_styles_context::set_bullet_image_size(double size)
if(!props) return;
props->fo_width_ = length(length(size,length::pt).get_value_unit(length::cm),length::cm);
props->fo_height_ = length(length(size,length::pt).get_value_unit(length::cm),length::cm);
props->fo_width_ = length(length(size, length::pt).get_value_unit(length::cm), length::cm);
props->fo_height_ = length(length(size, length::pt).get_value_unit(length::cm), length::cm);
}
void odf_lists_styles_context::set_bullet_image (std::wstring ref)
{
@ -574,9 +574,9 @@ void odf_lists_styles_context::set_bullet_image (std::wstring ref)
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.href_ = ref;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.type_= xlink_type::Simple;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.show_ = xlink_show::Embed;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.type_ = xlink_type::Simple;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.show_ = xlink_show::Embed;
style_image_->text_list_level_style_image_attr_.common_xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
}
void odf_lists_styles_context::set_start_number(int val)
{

View File

@ -147,14 +147,7 @@ void odp_conversion_context::end_drawings()
{
current_slide().drawing_context()->clear();
}
void odp_conversion_context::start_image(const std::wstring & image_file_name)
{
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage,odf_ref_name);
current_slide().drawing_context()->start_image(odf_ref_name);
}
void odp_conversion_context::start_comment(int oox_comm_id)
{
office_element_ptr comm_elm;

View File

@ -72,8 +72,6 @@ public:
void start_drawings();
void end_drawings();
virtual void start_image(const std::wstring & image_file_name);
void start_comment (int oox_comment_id);
void end_comment ();
void start_comment_content ();

View File

@ -527,14 +527,7 @@ void ods_conversion_context::end_drawings()
{
current_table().drawing_context()->clear();
}
void ods_conversion_context::start_image(const std::wstring & image_file_name)
{
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name,_mediaitems::typeImage,odf_ref_name);
current_table().drawing_context()->start_image(odf_ref_name);
}
double ods_conversion_context::convert_symbol_width(double val)
{
//width = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;

View File

@ -101,8 +101,6 @@ public:
void start_drawings();
void end_drawings();
virtual void start_image(const std::wstring & image_file_name);
double convert_symbol_width(double val);
void add_defined_range (const std::wstring & name, const std::wstring & cell_range, int sheet_id, bool printable = false);

View File

@ -915,14 +915,6 @@ void odt_conversion_context::end_change (int id, int type)
// return (text_changes_state_.current_types.back() == 2);
//}
//--------------------------------------------------------------------------------------------------------
void odt_conversion_context::start_image(const std::wstring & image_file_name)
{
std::wstring odf_ref_name ;
mediaitems()->add_or_find(image_file_name, _mediaitems::typeImage,odf_ref_name);
drawing_context()->start_image(odf_ref_name);
}
void odt_conversion_context::start_drop_cap(style_paragraph_properties *paragraph_properties)
{

View File

@ -82,8 +82,7 @@ public:
void start_drawings ();
void end_drawings ();
virtual void start_image(const std::wstring & image_file_name);
void add_text_content (const std::wstring & text);
void add_text_content (const std::wstring & text);
void start_paragraph (bool styled = false);
void end_paragraph ();

View File

@ -223,8 +223,10 @@ void OoxConverter::convert(PPTX::Logic::Pic *oox_picture)
pathImage = oox_picture->blipFill.blip->link->get();
}
}
std::wstring odf_ref = odf_context()->add_image(pathImage);
odf_context()->drawing_context()->start_drawing();
odf_context()->start_image(pathImage);
odf_context()->drawing_context()->start_image(odf_ref);
{
double Width = 0, Height = 0;
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
@ -1120,18 +1122,19 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
if (bullet.is<PPTX::Logic::BuNone>())return;
int odf_list_type = 13; // 1, 2, 3 ...
if (bullet.is<PPTX::Logic::BuAutoNum>())
{
const PPTX::Logic::BuAutoNum & buAutoNum = bullet.as<PPTX::Logic::BuAutoNum>();
int type = 13;
int pptx_type = buAutoNum.type.GetBYTECode();
if ( pptx_type < 3) type = 46;
if (pptx_type > 2 && pptx_type < 6) type = 60;
if (pptx_type > 28 && pptx_type < 32) type = 47;
if (pptx_type > 31 && pptx_type < 35) type = 61;
if ( pptx_type < 3) odf_list_type = 46;
if (pptx_type > 2 && pptx_type < 6) odf_list_type = 60;
if (pptx_type > 28 && pptx_type < 32) odf_list_type = 47;
if (pptx_type > 31 && pptx_type < 35) odf_list_type = 61;
odf_context()->styles_context()->lists_styles().start_style_level(level, type);
odf_context()->styles_context()->lists_styles().start_style_level(level, odf_list_type);
if (buAutoNum.startAt.IsInit())
{
@ -1142,18 +1145,34 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
}
if (bullet.is<PPTX::Logic::BuChar>())
{
odf_list_type = 5;
const PPTX::Logic::BuChar & buChar = bullet.as<PPTX::Logic::BuChar>();
odf_context()->styles_context()->lists_styles().start_style_level(level, 5 );
odf_context()->styles_context()->lists_styles().start_style_level(level, odf_list_type);
odf_context()->styles_context()->lists_styles().set_bullet_char(buChar.Char);
}
if (bullet.is<PPTX::Logic::BuBlip>())
{
odf_list_type = 1000;
const PPTX::Logic::BuBlip & buBlip = bullet.as<PPTX::Logic::BuBlip>();
odf_context()->styles_context()->lists_styles().start_style_level(level, 1000 );
odf_context()->styles_context()->lists_styles().set_bullet_image(odf_context()->mediaitems()->items().back().odf_ref);
std::wstring pathImage;
std::wstring sID;
if (buBlip.blip.embed.IsInit())
{
sID = buBlip.blip.embed->get();
pathImage = find_link_by_id(sID, 1);
}
else if (buBlip.blip.link.IsInit())
{
pathImage = buBlip.blip.link->get();
}
std::wstring odf_ref = odf_context()->add_image(pathImage);
odf_context()->styles_context()->lists_styles().start_style_level(level, odf_list_type );
odf_context()->styles_context()->lists_styles().set_bullet_image(odf_ref);
}
//odf_writer::style_list_level_label_alignment * aligment_props = odf_context()->styles_context()->lists_styles().get_list_level_alignment_properties();
@ -1164,8 +1183,8 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
if (oox_para_props->indent.IsInit())
{
level_props->text_space_before_ = odf_types::length(- oox_para_props->indent.get() / 12700., odf_types::length::pt);
level_props->text_min_label_width_ = odf_types::length(1, odf_types::length::pt);
level_props->text_min_label_width_ = odf_types::length(- oox_para_props->indent.get() / 12700., odf_types::length::pt);
level_props->text_space_before_ = odf_types::length(1, odf_types::length::pt);
}else
{
@ -1192,26 +1211,68 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
text_properties->content_.fo_color_ = odf_types::color(hexColor);
}
}
if (oox_para_props->buSize.is<PPTX::Logic::BuSzTx>())
{
const PPTX::Logic::BuSzTx & buSzTx = oox_para_props->buSize.as<PPTX::Logic::BuSzTx>();
}
else if (oox_para_props->buSize.is<PPTX::Logic::BuSzPct>())
{
const PPTX::Logic::BuSzPct & buSzPct = oox_para_props->buSize.as<PPTX::Logic::BuSzPct>();
if (buSzPct.val.IsInit())
text_properties->content_.fo_font_size_ = odf_types::percent(*buSzPct.val / 1000.);
}
else
text_properties->content_.fo_font_size_ = odf_types::percent(100.);
//-----------------------------------
if (oox_para_props->buSize.is<PPTX::Logic::BuSzPts>())
{
const PPTX::Logic::BuSzPts & buSzPts = oox_para_props->buSize.as<PPTX::Logic::BuSzPts>();
if (buSzPts.val.IsInit())
text_properties->content_.fo_font_size_ = odf_types::length(*buSzPts.val, odf_types::length::pt);
{
if (text_properties)
text_properties->content_.fo_font_size_ = odf_types::length(*buSzPts.val, odf_types::length::pt);
else if (odf_list_type == 1000)
odf_context()->styles_context()->lists_styles().set_bullet_image_size(*buSzPts.val);
}
}
else if (oox_para_props->buTypeface.is<PPTX::Logic::BuFontTx>())
else
{
double size_pt = oox_para_props->defRPr.IsInit() ? (oox_para_props->defRPr->sz.IsInit() ? *oox_para_props->defRPr->sz /100. : 0) : 0;
if (size_pt < 0.001 && odf_list_type == 1000)
{
odf_writer::style_text_properties * text_props = odf_context()->styles_context()->last_state(odf_types::style_family::Paragraph)->get_text_properties();
if (text_props && text_props->content_.fo_font_size_)
{
size_pt = text_props->content_.fo_font_size_->get_length().get_value_unit(odf_types::length::pt);
}
if (size_pt < 0.001)
{
odf_writer::odf_style_state_ptr style_state;
odf_context()->styles_context()->find_odf_default_style_state(odf_types::style_family::Text, style_state);
if (style_state)
text_props = style_state->get_text_properties();
if (text_props && text_props->content_.fo_font_size_)
{
size_pt = text_props->content_.fo_font_size_->get_length().get_value_unit(odf_types::length::pt);
}
}
}
if (oox_para_props->buSize.is<PPTX::Logic::BuSzTx>())
{
//equal tet size
}
if (oox_para_props->buSize.is<PPTX::Logic::BuSzPct>())
{
const PPTX::Logic::BuSzPct & buSzPct = oox_para_props->buSize.as<PPTX::Logic::BuSzPct>();
if (buSzPct.val.IsInit())
{
if (text_properties)
text_properties->content_.fo_font_size_ = odf_types::percent(*buSzPct.val / 1000.);
size_pt *= *buSzPct.val / 100000.;
}
}
if (text_properties && !text_properties->content_.fo_font_size_)
text_properties->content_.fo_font_size_ = odf_types::percent(100.);
else if (odf_list_type == 1000)
{
odf_context()->styles_context()->lists_styles().set_bullet_image_size(size_pt);
}
}
//----------------
if (oox_para_props->buTypeface.is<PPTX::Logic::BuFontTx>())
{
const PPTX::Logic::BuFontTx & buFontTx = oox_para_props->buTypeface.as<PPTX::Logic::BuFontTx>();
}
@ -1221,7 +1282,8 @@ void OoxConverter::convert_list_level(PPTX::Logic::TextParagraphPr *oox_para_pro
std::wstring font = textFont.typeface;
convert_font(theme, font);
if (!font.empty()) text_properties->content_.fo_font_family_ = font;
if (!font.empty() && text_properties)
text_properties->content_.fo_font_family_ = font;
}
odf_context()->styles_context()->lists_styles().end_style_level();
@ -1245,6 +1307,7 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
bool styled = false;
bool list_local = false;
bool list_present = false;
std::wstring list_style_name;
@ -1252,10 +1315,14 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
NSCommon::nullable<PPTX::Logic::TextParagraphPr> paraPr;
if (oox_paragraph->pPr.IsInit() && oox_paragraph->pPr->lvl.IsInit())
if (oox_paragraph->pPr.IsInit())
{
list_level = *oox_paragraph->pPr->lvl;
if (oox_paragraph->pPr->lvl.IsInit())
list_level = *oox_paragraph->pPr->lvl;
if (oox_paragraph->pPr->ParagraphBullet.is_init())
list_local = true;
}
if (oox_list_style && list_level >= 0 && list_level < 10)
{
if (oox_list_style->levels[list_level].IsInit())
@ -1312,11 +1379,18 @@ void OoxConverter::convert(PPTX::Logic::Paragraph *oox_paragraph, PPTX::Logic::T
if (odf_context()->text_context()->list_state_.started_list == false)
{
odf_context()->styles_context()->lists_styles().start_style();
convert_list_level(paraPr.GetPointer(), list_level - 1);
odf_context()->styles_context()->lists_styles().end_style();
list_style_name = odf_context()->styles_context()->lists_styles().get_style_name();
if (list_local)
{
odf_context()->styles_context()->lists_styles().start_style();
convert_list_level(oox_paragraph->pPr.GetPointer(), list_level - 1);
odf_context()->styles_context()->lists_styles().end_style();
list_style_name = odf_context()->styles_context()->lists_styles().get_style_name(); //last added
}
else
{
// !!!
}
odf_context()->text_context()->start_list(list_style_name);
}

View File

@ -3184,7 +3184,9 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
}
if (type_list == 2 || type_list == 3)
{
odt_context->styles_context()->lists_styles().set_bullet_image_size(size_bullet_number_marker);
}
if (oox_num_lvl->m_oLvlRestart.IsInit() && oox_num_lvl->m_oLvlRestart->m_oVal.IsInit() && type_list == 1)
{

View File

@ -1748,236 +1748,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFromTo* oox_from_to, oox_table_po
if (oox_from_to->m_oColOff.IsInit()) pos->col_off = oox_from_to->m_oColOff->GetValue();//pt
}
//void XlsxConverter::convert(OOX::Spreadsheet::CGroupShape* oox_group_shape)
//{
// if (!oox_group_shape)return;
// if (oox_group_shape->m_arrItems.size() < 1) return;
//
// ods_context->drawing_context()->start_group();
//
// if (oox_group_shape->m_oNvGroupSpPr.IsInit())
// {
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr.IsInit())
// {
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName.IsInit())
// ods_context->drawing_context()->set_group_name(*oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_sName);
// if (oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId.IsInit())
// ods_context->drawing_context()->set_group_z_order(oox_group_shape->m_oNvGroupSpPr->m_oCNvPr->m_oId->GetValue());
// }
// }
//
// OoxConverter::convert(oox_group_shape->m_oGroupSpPr.GetPointer());
//
// for (unsigned int i=0; i < oox_group_shape->m_arrItems.size(); i++)
// {
// switch(oox_group_shape->m_arrItems[i]->getType())
// {
// case OOX::et_x_Shape:
// {
// OOX::Spreadsheet::CShape* item = dynamic_cast<OOX::Spreadsheet::CShape*>(oox_group_shape->m_arrItems[i]);
// convert(item);
// }break;
// case OOX::et_x_ConnShape:
// {
// OOX::Spreadsheet::CConnShape* item = dynamic_cast<OOX::Spreadsheet::CConnShape*>(oox_group_shape->m_arrItems[i]);
// convert(item);
// }break;
// case OOX::et_x_GroupShape:
// {
// OOX::Spreadsheet::CGroupShape* item = dynamic_cast<OOX::Spreadsheet::CGroupShape*>(oox_group_shape->m_arrItems[i]);
// convert(item);
// }break;
// case OOX::et_x_Pic:
// {
// OOX::Spreadsheet::CPic* item = dynamic_cast<OOX::Spreadsheet::CPic*>(oox_group_shape->m_arrItems[i]);
// convert(item);
// }break;
// }
// }
// ods_context->drawing_context()->end_group();
//}
//
//void XlsxConverter::convert(OOX::Spreadsheet::CShape* oox_shape)
//{
// if (!oox_shape)return;
// if (!oox_shape->m_oSpPr.IsInit()) return;
//
// ods_context->drawing_context()->start_drawing();
//
// int type = -1;
// if (oox_shape->m_oSpPr->m_oCustGeom.IsInit())
// {
// type = 1000;//6???
// }
// if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
// {
// OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
// type =(geometry->m_oPrst.GetValue());
// }
//
// if ((oox_shape->m_oNvSpPr.IsInit()) && (oox_shape->m_oNvSpPr->m_oCNvSpPr.IsInit()))
// {
// if (oox_shape->m_oNvSpPr->m_oCNvSpPr->m_otxBox.GetValue() == 1)
// type = 2000; //textBox
// }
//
// if (type < 0)return;
///////////////////////////////////////////////////////////////////////////////////
// if (type == 2000) ods_context->drawing_context()->start_text_box();
// else ods_context->drawing_context()->start_shape(type);
//
// {
// OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
//
// if (oox_shape->m_oNvSpPr.IsInit())
// {
// OoxConverter::convert(oox_shape->m_oNvSpPr->m_oCNvPr.GetPointer()); //имя, описалово, номер ...
// convert(oox_shape->m_oNvSpPr->m_oCNvSpPr.GetPointer()); //заблокированности ... todooo
// }
// if (oox_shape->m_oShapeStyle.IsInit())
// {
// //доп эффекты
//
// }
// if (oox_shape->m_oTxBody.IsInit())
// {
// ods_context->start_text_context();
// OoxConverter::convert(oox_shape->m_oTxBody->m_oBodyPr.GetPointer());
//
// for (unsigned int i=0 ; i < oox_shape->m_oTxBody->m_arrItems.size();i++)
// {
// OoxConverter::convert(oox_shape->m_oTxBody->m_arrItems[i]);
// }
// ods_context->drawing_context()->set_text( ods_context->text_context());
// ods_context->end_text_context();
//
// }
// }
// if (type == 2000)ods_context->drawing_context()->end_text_box();
// else ods_context->drawing_context()->end_shape();
//
// ods_context->drawing_context()->end_drawing();
//
//}
//
//void XlsxConverter::convert(OOX::Spreadsheet::CConnShape* oox_shape)
//{
// if (!oox_shape)return;
// if (!oox_shape->m_oSpPr.IsInit()) return;
//
// ods_context->drawing_context()->start_drawing();
//
// int type = -1;
// if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypeCustom)
// {
// type = 1000;//?????
// }
// else if (oox_shape->m_oSpPr->m_eGeomType == OOX::Drawing::geomtypePreset)
// {
// if (oox_shape->m_oSpPr->m_oPrstGeom.IsInit())
// {
// OOX::Drawing::CPresetGeometry2D * geometry = oox_shape->m_oSpPr->m_oPrstGeom.GetPointer();
// type = (int)(geometry->m_oPrst.GetValue());
// }
// }
// if (type < 0)return;
////////////////////////////////////////////////////////////////////////////////
// ods_context->drawing_context()->start_shape(type);
// {
// OoxConverter::convert(oox_shape->m_oSpPr.GetPointer(), oox_shape->m_oShapeStyle.GetPointer());
//
// //частенько приплывает из стиля заполенение объекта .. а он то одномерный :)
// odf_context()->drawing_context()->start_area_properties();
// odf_context()->drawing_context()->set_no_fill();
// odf_context()->drawing_context()->end_area_properties();
//
// if (oox_shape->m_oNvConnSpPr.IsInit())
// {
// if (oox_shape->m_oNvConnSpPr->m_oCNvPr.IsInit())
// {
// OoxConverter::convert(oox_shape->m_oNvConnSpPr->m_oCNvPr.GetPointer());
// }
//
// if (oox_shape->m_oNvConnSpPr->m_oCNvConnSpPr.IsInit())
// {
// }
// }
// //avLst
// }
// ods_context->drawing_context()->end_shape();
// ods_context->drawing_context()->end_drawing();
//}
//
//
//void XlsxConverter::convert(OOX::Spreadsheet::CPic* oox_picture)
//{
// if (!oox_picture)return;
// if (!oox_picture->m_oBlipFill.IsInit()) return; // невeрная структура оох
//
// ods_context->drawing_context()->start_drawing();
//
// std::wstring pathImage;
// double Width=0, Height = 0;
//
// if (oox_picture->m_oBlipFill->m_oBlip.IsInit())
// {
// std::wstring sID = oox_picture->m_oBlipFill->m_oBlip->m_oEmbed.GetValue();
// pathImage = find_link_by_id(sID,1);
//
// if (pathImage.empty())
// {
// sID = oox_picture->m_oBlipFill->m_oBlip->m_oLink.GetValue();
// //???
// }
// _graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
// }
// ods_context->start_image(pathImage);
// {
// if (oox_picture->m_oBlipFill->m_oTile.IsInit())
// {
// ods_context->drawing_context()->set_image_style_repeat(2);
// }
// if (oox_picture->m_oBlipFill->m_oStretch.IsInit())
// {
// ods_context->drawing_context()->set_image_style_repeat(1);
// }
// if (oox_picture->m_oBlipFill->m_oSrcRect.IsInit() && Width >0 && Height >0)
// {
// ods_context->drawing_context()->set_image_client_rect_inch(
// oox_picture->m_oBlipFill->m_oSrcRect->m_oL.GetValue()/100. * Width / currentSystemDPI ,
// oox_picture->m_oBlipFill->m_oSrcRect->m_oT.GetValue()/100. * Height / currentSystemDPI ,
// oox_picture->m_oBlipFill->m_oSrcRect->m_oR.GetValue()/100. * Width / currentSystemDPI ,
// oox_picture->m_oBlipFill->m_oSrcRect->m_oB.GetValue()/100. * Height / currentSystemDPI );
// }
// if (oox_picture->m_oNvPicPr.IsInit())
// {
// OoxConverter::convert(oox_picture->m_oNvPicPr->m_oCNvPr.GetPointer());
//
// if (oox_picture->m_oNvPicPr->m_oCNvPicPr.IsInit())
// {
// if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks.IsInit())
// {
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoChangeAspect)
// //{
// //}
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoCrop))
// //{
// //}
// //if (oox_picture->m_oNvPicPr->m_oCNvPicPr->m_oPicLocks->m_oNoResize)
// //{
// //}
// }
// //m_oExtLst
// }
// }
//
// OoxConverter::convert(oox_picture->m_oSpPr.GetPointer(), oox_picture->m_oShapeStyle.GetPointer());
//
// }
// ods_context->drawing_context()->end_image();
// ods_context->drawing_context()->end_drawing();
//}
//
void XlsxConverter::convert(OOX::Spreadsheet::CConditionalFormatting *oox_cond_fmt)
{
if (!oox_cond_fmt)return;

View File

@ -55,18 +55,10 @@ public:
for (int i = 0; i < size; i++)
{
int val = 0;
char _c = data[i];
if (_c >= '0' && _c <= '9')
val = _c - '0';
else if (_c >= 'A' && _c <= 'F')
val = 10 + _c - 'A';
else if (_c >= 'a' && _c <= 'f')
val = 10 + _c - 'a';
CBigInteger tmp((int)data[i]);
CBigInteger tmp(val);
for (int j = size - 1 - i; j > 0; --j)
tmp *= 10;
tmp *= 256;
*this += tmp;
}

View File

@ -39,6 +39,10 @@ void main(void)
CBigInteger val3 = int1 * int2;
CBigInteger int3("66A1F302407647974D18D489855371B5", 16);
unsigned char buffer[16] = { 0x66, 0xA1, 0xF3, 0x02, 0x40, 0x76, 0x47, 0x97, 0x4D, 0x18, 0xD4, 0x89, 0x85, 0x53, 0x71, 0xB5 };
CBigInteger val4(buffer, 16);
std::string sValue = int3.ToString();
}

View File

@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual C# Express 2008
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "codegen", "codegen\codegen.csproj", "{B3AE10A0-6AB5-42EC-A83B-92012431B445}"
EndProject
Global

View File

@ -0,0 +1,484 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.IO;
using System.Collections;
using System.CodeDom;
using System.CodeDom.Compiler;
namespace codegen
{
public class GenMemberPivot
{
public string sName;
public string sNamespace;
public string sType;
public Type oSystemType;
public bool? bIsAttribute;
public string sDefAttribute;
public bool? bQualified;//нужно ли при записи в xml писать prefix
public int? nArrayRank;
public List<GenMemberPivot> aArrayTypes;
public bool? bIsArrayTypesHidden;
public GenMemberPivot(string _sName)
{
sName = _sName;
sNamespace = null;
sType = null;
oSystemType = null;
bIsAttribute = null;
sDefAttribute = null;
bQualified = null;
nArrayRank = null;
bIsArrayTypesHidden = null;
aArrayTypes = null;
}
public void merge(GenMemberPivot val)
{
if (!string.IsNullOrEmpty(val.sName))
sName = val.sName;
if (!string.IsNullOrEmpty(val.sNamespace))
sNamespace = val.sNamespace;
if (!string.IsNullOrEmpty(val.sType))
sType = val.sType;
if (null != val.oSystemType)
oSystemType = val.oSystemType;
if (val.bIsAttribute.HasValue)
bIsAttribute = val.bIsAttribute;
if (!string.IsNullOrEmpty(val.sDefAttribute))
sDefAttribute = val.sDefAttribute;
if (val.bQualified.HasValue)
bQualified = val.bQualified;
if (val.nArrayRank.HasValue)
nArrayRank = val.nArrayRank;
if (val.bIsArrayTypesHidden.HasValue)
bIsArrayTypesHidden = val.bIsArrayTypesHidden;
}
public void completeDefaults()
{
if (!bIsAttribute.HasValue)
bIsAttribute = false;
if (!bQualified.HasValue)
bQualified = true;
}
}
//[System.Xml.Serialization.XmlElementAttribute("c")]
//public CT_CalcCell[] c {
//bIsArray=true;aArrayTypes=[CT_CalcCell]
//[System.Xml.Serialization.XmlElementAttribute("b", typeof(CT_Boolean))]
//[System.Xml.Serialization.XmlElementAttribute("d", typeof(CT_DateTime))]
//[System.Xml.Serialization.XmlElementAttribute("e", typeof(CT_Error))]
//[System.Xml.Serialization.XmlElementAttribute("m", typeof(CT_Missing))]
//[System.Xml.Serialization.XmlElementAttribute("n", typeof(CT_Number))]
//[System.Xml.Serialization.XmlElementAttribute("s", typeof(CT_String))]
//public object[] Items {
//[System.Xml.Serialization.XmlArrayItemAttribute("author", IsNullable=false)]
//public string[] authors {
//[System.Xml.Serialization.XmlArrayItemAttribute("b", typeof(CT_Boolean), IsNullable=false)]
//[System.Xml.Serialization.XmlArrayItemAttribute("d", typeof(CT_DateTime), IsNullable=false)]
//[System.Xml.Serialization.XmlArrayItemAttribute("e", typeof(CT_Error), IsNullable=false)]
//[System.Xml.Serialization.XmlArrayItemAttribute("m", typeof(CT_Missing), IsNullable=false)]
//[System.Xml.Serialization.XmlArrayItemAttribute("n", typeof(CT_Number), IsNullable=false)]
//[System.Xml.Serialization.XmlArrayItemAttribute("s", typeof(CT_String), IsNullable=false)]
//[System.Xml.Serialization.XmlArrayItemAttribute("x", typeof(CT_Index), IsNullable=false)]
//public object[][] r {
//[System.Xml.Serialization.XmlElementAttribute("consolidation", typeof(CT_Consolidation))]
//[System.Xml.Serialization.XmlElementAttribute("extLst", typeof(CT_ExtensionList))]
//[System.Xml.Serialization.XmlElementAttribute("worksheetSource", typeof(CT_WorksheetSource))]
//public object Item
//{
public class GenClassPivot
{
public string sName;
public string sNamespace;
public bool bIsEnum;
public List<GenMemberPivot> aMembers = new List<GenMemberPivot>();
public string sRootName;
public GenClassPivot(string _sName, string _sNamespace)
{
sName = _sName;
sNamespace = _sNamespace;
bIsEnum = false;
sRootName = "";
}
public bool isRoot()
{
return !string.IsNullOrEmpty(this.sRootName);
}
}
class CodeGenPivot
{
Dictionary<string, GenClassPivot> m_mapGeneratedClasses = new Dictionary<string, GenClassPivot>();
int m_nItemsChoiceTypeCount = 0;
public void Start(string sDirIn, string sDirCppXmlOut, string sDirCppBinOut, string sDirJsBinOut, ValidationEventHandler oValidationEventHandler)
{
string sChartNamespace = "http://purl.oclc.org/ooxml/spreadsheetml/main";
string[] aFiles = Directory.GetFiles(sDirIn);
XmlSchemaSet schemaSet = new XmlSchemaSet();
schemaSet.ValidationEventHandler += oValidationEventHandler;
for (int i = 0; i < aFiles.Length; i++)
{
string sFile = aFiles[i];
if (".xsd" == Path.GetExtension(sFile))
schemaSet.Add(null, sFile);
}
schemaSet.Compile();
XmlSchema chartSchema = null;
XmlSchemas schemas = new XmlSchemas();
foreach (XmlSchema schema in schemaSet.Schemas())
{
if (schema.TargetNamespace == sChartNamespace)
{
chartSchema = schema;
schemas.Add(schema);
}
}
if (null != chartSchema)
{
CodeNamespace ns = new CodeNamespace();
XmlCodeExporter exporter = new XmlCodeExporter(ns);
CodeGenerationOptions generationOptions = CodeGenerationOptions.GenerateProperties;
XmlSchemaImporter importer = new XmlSchemaImporter(schemas, generationOptions, new ImportContext(new CodeIdentifiers(), false));
foreach (XmlSchemaElement element in chartSchema.Elements.Values)
{
XmlTypeMapping mapping = importer.ImportTypeMapping(element.QualifiedName);
exporter.ExportTypeMapping(mapping);
}
CodeGenerator.ValidateIdentifiers(ns);
////Microsoft.CSharp.CSharpCodeProvider oProvider;
//// output the C# code
//Microsoft.CSharp.CSharpCodeProvider codeProvider = new Microsoft.CSharp.CSharpCodeProvider();
//using (StringWriter writer = new StringWriter())
//{
// codeProvider.GenerateCodeFromNamespace(ns, writer, new CodeGeneratorOptions());
// string sCode = writer.GetStringBuilder().ToString();
//}
List<GenClassPivot> aGenClasses = PreProcess(ns, chartSchema);
aGenClasses = FilterClassesPivot(aGenClasses);
//(new CodegenCPP()).Process(sDirCppXmlOut, sDirCppBinOut, aGenClasses);
//(new CodegenJS()).Process(sDirJsBinOut, aGenClasses);
(new CodegenJSXml()).Process(sDirJsBinOut, aGenClasses);
}
}
List<GenClassPivot> FilterClassesPivot(List<GenClassPivot> aInput)
{
Queue<GenClassPivot> aTemp = new Queue<GenClassPivot>();
List<GenClassPivot> aRes = new List<GenClassPivot>();
string[] aTargetTypes = new string[] { "CT_PivotCacheDefinition", "CT_PivotCacheRecords", "CT_pivotTableDefinition" };
Dictionary<string, bool> mapTargetSubTypes = new Dictionary<string, bool>();
Dictionary<string, bool> namspaces = new Dictionary<string, bool>();
Dictionary<string, GenClassPivot> mapAllClasses = new Dictionary<string, GenClassPivot>();
for (int i = 0; i < aInput.Count; ++i)
{
GenClassPivot oGenClass = aInput[i];
if (0 == aTargetTypes.Length || -1 != Array.IndexOf(aTargetTypes, oGenClass.sName))
aTemp.Enqueue(oGenClass);
mapAllClasses[oGenClass.sName] = oGenClass;
}
while (aTemp.Count > 0)
{
GenClassPivot oGenClass = aTemp.Dequeue();
if (!mapTargetSubTypes.ContainsKey(oGenClass.sName))
{
mapTargetSubTypes.Add(oGenClass.sName, true);
aRes.Add(oGenClass);
for (int j = 0; j < oGenClass.aMembers.Count; ++j)
{
GenMemberPivot oGenMember = oGenClass.aMembers[j];
GenClassPivot oTempClass;
if (null != oGenMember.sType && mapAllClasses.TryGetValue(oGenMember.sType, out oTempClass))
{
namspaces[oTempClass.sNamespace] = true;
aTemp.Enqueue(oTempClass);
}
if (null != oGenMember.aArrayTypes)
{
for (int k = 0; k < oGenMember.aArrayTypes.Count; ++k)
{
GenMemberPivot oGenMemberArrayTypes = oGenMember.aArrayTypes[k];
if (null != oGenMemberArrayTypes.sType && mapAllClasses.TryGetValue(oGenMemberArrayTypes.sType, out oTempClass))
{
aTemp.Enqueue(oTempClass);
}
}
}
}
}
}
return aRes;
}
List<GenClassPivot> PreProcess(CodeNamespace code, XmlSchema schema)
{
List<GenClassPivot> aGenClasses = new List<GenClassPivot>();
for (int i = 0; i < code.Types.Count; ++i)
{
GenClassPivot oNewClass = PreProcessClass(aGenClasses, code.Types[i]);
if (null != oNewClass)
aGenClasses.Add(oNewClass);
}
return aGenClasses;
}
GenClassPivot PreProcessClass(List<GenClassPivot> aGenClasses, CodeTypeDeclaration type)
{
GenClassPivot oGenClass = null;
//получаем xml namespace
string sNamespace = null;
bool bIncludeInSchema = true;
string sRootName = "";
for (int i = 0; i < type.CustomAttributes.Count; i++)
{
CodeAttributeDeclaration attribute = type.CustomAttributes[i];
if (attribute.Name == "System.Xml.Serialization.XmlTypeAttribute")
{
foreach (CodeAttributeArgument argument in attribute.Arguments)
{
if (argument.Name == "Namespace")
sNamespace = ((CodePrimitiveExpression)argument.Value).Value.ToString();
else if (argument.Name == "IncludeInSchema")
bIncludeInSchema = Convert.ToBoolean(((CodePrimitiveExpression)argument.Value).Value);
//todo argument.Name == "TypeName"
}
}
else if (attribute.Name == "System.Xml.Serialization.XmlRootAttribute")
{
foreach (CodeAttributeArgument argument in attribute.Arguments)
{
if (argument.Name == "Namespace")
sNamespace = ((CodePrimitiveExpression)argument.Value).Value.ToString();
else if ("" == argument.Name)
sRootName = ((CodePrimitiveExpression)argument.Value).Value.ToString();
}
}
}
if (bIncludeInSchema)
{
oGenClass = new GenClassPivot(type.Name, sNamespace);
oGenClass.sRootName = sRootName;
int nItemsElementName = 0;
if (type.IsEnum)
{
oGenClass.bIsEnum = true;
for (int i = 0; i < type.Members.Count; ++i)
{
CodeTypeMember member = type.Members[i];
GenMemberPivot oGenMember = new GenMemberPivot(member.Name);
for (int j = 0; j < member.CustomAttributes.Count; j++)
{
CodeAttributeDeclaration attribute = member.CustomAttributes[j];
if (attribute.Name == "System.Xml.Serialization.XmlEnumAttribute")
ParseArguments(attribute.Arguments, oGenMember);
}
oGenClass.aMembers.Add(oGenMember);
}
}
else
{
for (int i = 0; i < type.Members.Count; ++i)
{
CodeTypeMember member = type.Members[i];
//CodeMemberField пропускаем
CodeMemberProperty codeMemberProperty = member as CodeMemberProperty;
if (codeMemberProperty != null)
{
GenMemberPivot oNewGenMember = PreProcessProperty(aGenClasses, codeMemberProperty, oGenClass, ref nItemsElementName);
if (null != oNewGenMember)
oGenClass.aMembers.Add(oNewGenMember);
}
}
}
}
return oGenClass;
}
GenMemberPivot PreProcessProperty(List<GenClassPivot> aGenClasses, CodeMemberProperty codeMemberProperty, GenClassPivot oGenClass, ref int nItemsElementName)
{
GenMemberPivot oGenMember = new GenMemberPivot(codeMemberProperty.Name);
bool bIgnore = false;
InitMemberType(oGenMember, codeMemberProperty.Type.BaseType);
if (null != codeMemberProperty.Type.ArrayElementType)
{
oGenMember.nArrayRank = codeMemberProperty.Type.ArrayElementType.ArrayRank;
}
bool bXmlElementAttribute = false;
List<GenMemberPivot> aTempMemebers = new List<GenMemberPivot>();
for (int i = 0; i < codeMemberProperty.CustomAttributes.Count; i++)
{
CodeAttributeDeclaration attribute = codeMemberProperty.CustomAttributes[i];
if (attribute.Name == "System.Xml.Serialization.XmlAttributeAttribute")
{
oGenMember.bQualified = false;
oGenMember.bIsAttribute = true;
ParseArguments(attribute.Arguments, oGenMember);
//todo могут быть повторы имен атрибутов и child nodes.
}
else if (attribute.Name == "System.ComponentModel.DefaultValueAttribute")
{
if (attribute.Arguments.Count > 0)
{
CodeExpression oCodeExpression = attribute.Arguments[attribute.Arguments.Count - 1].Value;
//todo other
if (oCodeExpression is CodePrimitiveExpression)
oGenMember.sDefAttribute = ((oCodeExpression as CodePrimitiveExpression)).Value.ToString();
else if (oCodeExpression is CodeFieldReferenceExpression)
oGenMember.sDefAttribute = ((oCodeExpression as CodeFieldReferenceExpression)).FieldName;
}
}
else if (attribute.Name == "System.Xml.Serialization.XmlIgnoreAttribute")
bIgnore = true;
else if (attribute.Name == "System.Xml.Serialization.XmlElementAttribute")
{
bXmlElementAttribute = true;
GenMemberPivot oTemp = new GenMemberPivot(null);
ParseArguments(attribute.Arguments, oTemp);
aTempMemebers.Add(oTemp);
}
else if (attribute.Name == "System.Xml.Serialization.XmlArrayItemAttribute")
{
GenMemberPivot oTemp = new GenMemberPivot(null);
ParseArguments(attribute.Arguments, oTemp);
aTempMemebers.Add(oTemp);
}
else if (attribute.Name == "System.Xml.Serialization.XmlArrayAttribute")
{
ParseArguments(attribute.Arguments, oGenMember);
}
//todo не всегда прописан
//else if (attribute.Name == "System.Xml.Serialization.XmlChoiceIdentifierAttribute")
//{
// if (attribute.Arguments.Count > 0)
// {
// CodePrimitiveExpression oPrimitiveExpression = attribute.Arguments[0].Value as CodePrimitiveExpression;
// oGenMember.sChoiceIdentifier = oPrimitiveExpression.Value.ToString();
// }
//}
}
if (bIgnore)
return null;
else
{
if (aTempMemebers.Count > 0)
{
if (1 == aTempMemebers.Count)
{
oGenMember.merge(aTempMemebers[0]);
}
else
{
oGenMember.aArrayTypes = aTempMemebers;
if (bXmlElementAttribute)
oGenMember.bIsArrayTypesHidden = true;
else
oGenMember.bIsArrayTypesHidden = false;
}
}
oGenMember.completeDefaults();
return oGenMember;
}
}
void ParseArguments(CodeAttributeArgumentCollection oArguments, GenMemberPivot oGenMember)
{
CodePrimitiveExpression oPrimitiveExpression = null;
CodeTypeOfExpression oTypeOfExpression = null;
string sNamespace = null;
bool? bForm = null;
foreach (CodeAttributeArgument argument in oArguments)
{
if ("" == argument.Name)
{
if (argument.Value is CodePrimitiveExpression)
oPrimitiveExpression = argument.Value as CodePrimitiveExpression;
else if (argument.Value is CodeTypeOfExpression)
oTypeOfExpression = argument.Value as CodeTypeOfExpression;
}
else if ("Namespace" == argument.Name)
sNamespace = ((CodePrimitiveExpression)argument.Value).Value.ToString();
else if ("Form" == argument.Name)
{
string sValue = ((CodeFieldReferenceExpression)argument.Value).FieldName;
if ("Qualified" == sValue)
bForm = true;
else if ("Unqualified" == sValue)
bForm = false;
}
}
if (null != oPrimitiveExpression)
oGenMember.sName = oPrimitiveExpression.Value.ToString();
if (null != oTypeOfExpression)
InitMemberType(oGenMember, oTypeOfExpression.Type.BaseType);
if (null != sNamespace)
oGenMember.sNamespace = sNamespace;
if (bForm.HasValue)
oGenMember.bQualified = bForm.Value;
}
void InitMemberType(GenMemberPivot oGenMember, string sBaseType)
{
if (-1 != sBaseType.IndexOf("System."))
{
oGenMember.oSystemType = Type.GetType(sBaseType);
if (null == oGenMember.oSystemType)
oGenMember.oSystemType = typeof(string);
}
else
oGenMember.sType = sBaseType;
}
}
}

View File

@ -51,7 +51,6 @@ namespace codegen
StringBuilder m_oDocxFromToBinaryCPP = new StringBuilder();
StringBuilder m_oDocxTypesH = new StringBuilder();
Dictionary<string, GenClass> m_mapProcessedClasses = new Dictionary<string, GenClass>();
Dictionary<string, string> m_mapNamespaceToPrefix = new Dictionary<string, string>() { { "http://purl.oclc.org/ooxml/drawingml/chart", "c:" }, { "http://purl.oclc.org/ooxml/drawingml/main", "a:" }, { "http://purl.oclc.org/ooxml/officeDocument/relationships", "r:" }, { "http://schemas.openxmlformats.org/markup-compatibility/2006", "mc:" }, { "http://schemas.microsoft.com/office/drawing/2007/8/2/chart", "c14:" } };
string gc_sNamespaceToXml = " xmlns:c=\\\"http://schemas.openxmlformats.org/drawingml/2006/chart\\\" xmlns:a=\\\"http://schemas.openxmlformats.org/drawingml/2006/main\\\" xmlns:r=\\\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\\\" xmlns:mc=\\\"http://schemas.openxmlformats.org/markup-compatibility/2006\\\" xmlns:c14=\\\"http://schemas.microsoft.com/office/drawing/2007/8/2/chart\\\"";
string gc_sTypePattern = "et_";
@ -573,7 +572,7 @@ namespace codegen
if (null != sMemberNamespace && oGenMember.bQualified)
{
string sShortNamespace;
if (m_mapNamespaceToPrefix.TryGetValue(sMemberNamespace, out sShortNamespace))
if (Utils.m_mapNamespaceToPrefix.TryGetValue(sMemberNamespace, out sShortNamespace))
sElemName = sShortNamespace + sElemName;
}

View File

@ -0,0 +1,731 @@
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
namespace codegen
{
class CodegenJSXml
{
Dictionary<string, GenClassPivot> m_mapProcessedClasses = new Dictionary<string, GenClassPivot>();
string gc_sEnumFromXmlPrefix = "FromXml_";
string gc_sEnumToXmlPrefix = "ToXml_";
string gc_sNamespaceToXml = " xmlns=\\\"http://schemas.openxmlformats.org/spreadsheetml/2006/main\\\" xmlns:r=\\\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\\\"";
public void Process(string sOutputDir, List<GenClassPivot> aGenClasses)
{
StringBuilder oJsSer = new StringBuilder();
List<GenClassPivot> aEnums = new List<GenClassPivot>();
List<GenClassPivot> aClasses = new List<GenClassPivot>();
for (int i = 0; i < aGenClasses.Count; ++i)
{
GenClassPivot oGenClass = aGenClasses[i];
if (oGenClass.bIsEnum)
aEnums.Add(oGenClass);
else
aClasses.Add(oGenClass);
m_mapProcessedClasses[oGenClass.sName] = oGenClass;
}
string sFileJs = "PivotTables.js";
oJsSer.AppendFormat("\"use strict\";\r\n");
oJsSer.AppendFormat(Utils.gc_sFilePrefix);
oJsSer.AppendFormat("function getBoolFromXml(val){{return \"0\"!==val && \"false\"!==val && \"off\"!==val;}}\r\n");
oJsSer.AppendFormat("function getXmlFromBool(val){{return val ? \"1\" : \"0\";}}\r\n");
//enums
ProcessEnums(oJsSer, aEnums);
//FromXml
for (int i = 0; i < aClasses.Count; ++i)
ProcessClass(oJsSer, aClasses[i]);
File.WriteAllText(Path.Combine(sOutputDir, sFileJs), oJsSer.ToString());
}
public void ProcessEnums(StringBuilder sb, List<GenClassPivot> aGenClasses)
{
for (int i = 0; i < aGenClasses.Count; ++i)
{
GenClassPivot oGenClass = aGenClasses[i];
for (int j = 0; j < oGenClass.aMembers.Count; ++j)
{
GenMemberPivot oGenMember = oGenClass.aMembers[j];
sb.AppendFormat("var {0} = {1};\r\n", Utils.GetEnumElemName(oGenClass.sName, oGenMember.sName), j);
}
sb.AppendFormat("\r\n");
}
for (int i = 0; i < aGenClasses.Count; ++i)
{
GenClassPivot oGenClass = aGenClasses[i];
sb.AppendFormat("function {0}{1}(val)\r\n{{\r\n", gc_sEnumFromXmlPrefix, oGenClass.sName);
sb.AppendFormat("var res = -1;\r\n");
for (int j = 0; j < oGenClass.aMembers.Count; ++j)
{
GenMemberPivot member = oGenClass.aMembers[j];
if (0 == j)
sb.AppendFormat("if(\"{0}\"===val)\r\nres={1};\r\n", member.sName, Utils.GetEnumElemName(oGenClass.sName, member.sName));
else
sb.AppendFormat("else if(\"{0}\"===val)\r\nres={1};\r\n", member.sName, Utils.GetEnumElemName(oGenClass.sName, member.sName));
}
sb.AppendFormat("return res;\r\n}}\r\n");
sb.AppendFormat("function {0}{1}(val)\r\n{{\r\n", gc_sEnumToXmlPrefix, oGenClass.sName);
sb.AppendFormat("var res = \"\";\r\n");
for (int j = 0; j < oGenClass.aMembers.Count; ++j)
{
GenMemberPivot member = oGenClass.aMembers[j];
if (0 == j)
sb.AppendFormat("if({0}===val)\r\nres=\"{1}\";\r\n", Utils.GetEnumElemName(oGenClass.sName, member.sName), member.sName);
else
sb.AppendFormat("else if({0}===val)\r\nres=\"{1}\";\r\n", Utils.GetEnumElemName(oGenClass.sName, member.sName), member.sName);
}
sb.AppendFormat("return res;\r\n}}\r\n");
sb.AppendFormat("\r\n");
}
}
public void ProcessClass(StringBuilder sb, GenClassPivot oGenClass)
{
List<GenMemberPivot> aAttributes = new List<GenMemberPivot>();
List<GenMemberPivot> aMembers = new List<GenMemberPivot>();
bool bNeedTextNode = false;
bool bNeedDoubleArray = false;
InfoFromMember(oGenClass, ref aAttributes, ref aMembers, ref bNeedTextNode, ref bNeedDoubleArray);
sb.AppendFormat("function {0}(){{\r\n", oGenClass.sName);
ProcessProperty(sb, aAttributes, aMembers, bNeedTextNode, bNeedDoubleArray);
sb.AppendFormat("}}\r\n", oGenClass.sName);
if (aAttributes.Count > 0)
{
sb.AppendFormat("{0}.prototype.readAttributes = function(attr, uq) {{\r\n", oGenClass.sName);
ProcessAttributesFromXml(sb, oGenClass, aAttributes);
sb.AppendFormat("}};\r\n", oGenClass.sName);
}
if (aMembers.Count > 0)
{
sb.AppendFormat("{0}.prototype.onStartNode = function(elem, attr, uq) {{\r\n", oGenClass.sName);
sb.AppendFormat("var newContext = this;\r\n");
int nCounter = 0;
if (oGenClass.isRoot() && ProcessRootFromXml(sb, oGenClass, "elem"))
{
nCounter++;
}
ProcessOnStartNodeFromXml(sb, oGenClass, aMembers, nCounter, "elem");
sb.AppendFormat("else {{\r\n");
sb.AppendFormat("newContext = null;\r\n");
sb.AppendFormat("}}\r\n");
sb.AppendFormat("return newContext;\r\n");
sb.AppendFormat("}};\r\n", oGenClass.sName);
if (bNeedTextNode)
{
sb.AppendFormat("{0}.prototype.onTextNode = function(text, uq) {{\r\n", oGenClass.sName);
ProcessOnTextNodeFromXml(sb, oGenClass, aMembers);
sb.AppendFormat("}};\r\n", oGenClass.sName);
}
if (bNeedDoubleArray)
{
sb.AppendFormat("{0}.prototype.onEndNode = function(prevContext, elem) {{\r\n", oGenClass.sName);
ProcessOnEndNodeFromXml(sb, oGenClass, aMembers);
sb.AppendFormat("}};\r\n", oGenClass.sName);
}
}
if (aAttributes.Count > 0 || aMembers.Count > 0)
{
if (oGenClass.isRoot())
{
sb.AppendFormat("{0}.prototype.toXml = function() {{\r\n", oGenClass.sName);
}
else
{
sb.AppendFormat("{0}.prototype.toXml = function(name) {{\r\n", oGenClass.sName);
}
sb.AppendFormat("var res = \"\";\r\n");
ProcessToXml(sb, oGenClass);
sb.AppendFormat("return res;\r\n");
sb.AppendFormat("}};\r\n");
}
}
public void InfoFromMember(GenClassPivot oGenClass, ref List<GenMemberPivot> aAttributes, ref List<GenMemberPivot> aMembers, ref bool bNeedTextNode, ref bool bNeedDoubleArray)
{
for (int i = 0; i < oGenClass.aMembers.Count; ++i)
{
GenMemberPivot oGenMember = oGenClass.aMembers[i];
if (true == oGenMember.bIsAttribute)
{
aAttributes.Add(oGenMember);
}
else
{
if (oGenMember.nArrayRank.HasValue && oGenMember.nArrayRank > 0)
{
bNeedDoubleArray = true;
}
if (null == oGenMember.aArrayTypes)
{
if (null != oGenMember.oSystemType)
{
bNeedTextNode = true;
}
else if (null != oGenMember.sType)
{
GenClassPivot oTemp;
if (m_mapProcessedClasses.TryGetValue(oGenMember.sType, out oTemp))
{
if (oTemp.bIsEnum)
{
bNeedTextNode = true;
}
}
}
}
aMembers.Add(oGenMember);
}
}
}
void ProcessProperty(StringBuilder sb, List<GenMemberPivot> aAttributes, List<GenMemberPivot> aMembers, bool bNeedTextNode, bool bNeedDoubleArray)
{
if (aAttributes.Count > 0)
{
sb.AppendFormat("//Attributes\r\n");
for (int i = 0; i < aAttributes.Count; ++i)
{
GenMemberPivot oGenMember = aAttributes[i];
if (!string.IsNullOrEmpty(oGenMember.sDefAttribute))
{
sb.AppendFormat("this.{0} = null;//{1}\r\n", oGenMember.sName, oGenMember.sDefAttribute.ToLower());
}
else
{
sb.AppendFormat("this.{0} = null;\r\n", oGenMember.sName);
}
}
}
if (aMembers.Count > 0)
{
sb.AppendFormat("//Members\r\n");
for (int i = 0; i < aMembers.Count; ++i)
{
GenMemberPivot oGenMember = aMembers[i];
if (oGenMember.nArrayRank.HasValue)
sb.AppendFormat("this.{0} = [];\r\n", oGenMember.sName);
else
{
if (null != oGenMember.aArrayTypes)
{
for (int j = 0; j < oGenMember.aArrayTypes.Count; ++j)
{
GenMemberPivot oTempMember = oGenMember.aArrayTypes[j];
if (!string.IsNullOrEmpty(oTempMember.sDefAttribute))
{
sb.AppendFormat("this.{0} = null;//{1}\r\n", oTempMember.sName, oTempMember.sDefAttribute.ToLower());
}
else
{
sb.AppendFormat("this.{0} = null;\r\n", oTempMember.sName);
}
}
}
else
{
if (!string.IsNullOrEmpty(oGenMember.sDefAttribute))
{
sb.AppendFormat("this.{0} = null;//{1}\r\n", oGenMember.sName, oGenMember.sDefAttribute.ToLower());
}
else
{
sb.AppendFormat("this.{0} = null;\r\n", oGenMember.sName);
}
}
}
}
}
if (bNeedTextNode || bNeedDoubleArray)
{
sb.AppendFormat("//internal\r\n");
if (bNeedTextNode)
sb.AppendFormat("this._curElem = null;\r\n");
if (bNeedDoubleArray)
sb.AppendFormat("this._curArray = null;\r\n");
}
}
bool ProcessRootFromXml(StringBuilder sb, GenClassPivot oGenClass, string sCodeName)
{
string sName = oGenClass.sRootName;
if (!string.IsNullOrEmpty(sName))
{
sb.AppendFormat("if(\"{0}\" === {1}){{\r\n", sName, sCodeName);
sb.AppendFormat("newContext.readAttributes(attr, uq);\r\n", sName, sCodeName);
sb.AppendFormat("}}\r\n", sName, sCodeName);
return true;
}
return false;
}
void ProcessOnStartNodeFromXml(StringBuilder sb, GenClassPivot oGenClass, List<GenMemberPivot> aMembers, int nCounter, string sCodeName)
{
for (int i = 0; i < aMembers.Count; ++i)
{
GenMemberPivot oGenMember = aMembers[i];
if (null != oGenMember.aArrayTypes)
{
if (false == oGenMember.bIsArrayTypesHidden)
{
if (0 != nCounter)
sb.AppendFormat("else ");
//todo rework
sb.AppendFormat("if(\"{0}\" === {1}){{\r\n", getNameWithPrefix(oGenClass, oGenMember), sCodeName);
if (oGenMember.nArrayRank > 0)
{
sb.AppendFormat("this._curArray = [];\r\n", getNameWithPrefix(oGenClass, oGenMember), sCodeName);
}
else
{
sb.AppendFormat("//todo check\r\n", getNameWithPrefix(oGenClass, oGenMember), sCodeName);
}
sb.AppendFormat("}}\r\n", getNameWithPrefix(oGenClass, oGenMember), sCodeName);
nCounter++;
}
for (int j = 0; j < oGenMember.aArrayTypes.Count; ++j)
{
nCounter = ProcessOnStartNodeFromXmlMember(sb, oGenClass, oGenMember.aArrayTypes[j], oGenMember, sCodeName, nCounter);
}
}
else
{
nCounter = ProcessOnStartNodeFromXmlMember(sb, oGenClass, oGenMember, null, sCodeName, nCounter);
}
}
}
int ProcessOnStartNodeFromXmlMember(StringBuilder sb, GenClassPivot oGenClass, GenMemberPivot oGenMember, GenMemberPivot oGenMemberContainer, string sCodeName, int nCounter)
{
if (0 != nCounter)
sb.AppendFormat("else ");
sb.AppendFormat("if(\"{0}\" === {1}){{\r\n", getNameWithPrefix(oGenClass, oGenMember), sCodeName);
if (null != oGenMember.oSystemType)
{
sb.AppendFormat("this._curElem = {0};\r\n", sCodeName);
}
else if (null != oGenMember.sType)
{
GenClassPivot oTemp;
if (m_mapProcessedClasses.TryGetValue(oGenMember.sType, out oTemp))
{
if (oTemp.bIsEnum)
{
sb.AppendFormat("this._curElem = {0};\r\n", sCodeName);
}
else
{
sb.AppendFormat("newContext = new {0}();\r\n", oGenMember.sType);
sb.AppendFormat("if(newContext.readAttributes){{\r\n");
sb.AppendFormat("newContext.readAttributes(attr, uq);\r\n", oGenMember.sType);
sb.AppendFormat("}}\r\n");
GenMemberPivot oTargetMember = null != oGenMemberContainer ? oGenMemberContainer : oGenMember;
if (oTargetMember.nArrayRank.HasValue)
{
if (oTargetMember.nArrayRank > 0)
{
sb.AppendFormat("this._curArray.push(newContext);\r\n");
}
else
{
sb.AppendFormat("this.{0}.push(newContext);\r\n", oTargetMember.sName);
}
}
else
{
//oGenMember not mistake
//right way to store oGenMemberContainer in one object, but we prefer separete types
sb.AppendFormat("this.{0} = newContext;\r\n", oGenMember.sName);
}
}
}
}
sb.AppendFormat("}}\r\n");
nCounter++;
return nCounter;
}
void ProcessOnTextNodeFromXml(StringBuilder sb, GenClassPivot oGenClass, List<GenMemberPivot> aMembers)
{
int nCounter = 0;
for (int i = 0; i < aMembers.Count; ++i)
{
GenMemberPivot oGenMember = aMembers[i];
nCounter = ProcessOnTextNodeFromXmlMember(sb, oGenClass, oGenMember, null, nCounter);
}
}
int ProcessOnTextNodeFromXmlMember(StringBuilder sb, GenClassPivot oGenClass, GenMemberPivot oGenMember, GenMemberPivot oGenMemberContainer, int nCounter)
{
if (0 != nCounter)
sb.AppendFormat("else ");
sb.AppendFormat("if(\"{0}\" === this._curElem){{\r\n", getNameWithPrefix(oGenClass, oGenMember));
if (null != oGenMember.oSystemType)
{
if (oGenMember.nArrayRank.HasValue)
{
if (oGenMember.nArrayRank > 0)
{
sb.AppendFormat("this._curArray.push({0});\r\n", ProcessJsTypeFromXml(oGenMember.oSystemType, "text"));
}
else
{
sb.AppendFormat("this.{0}.push({1});\r\n", oGenMember.sName, ProcessJsTypeFromXml(oGenMember.oSystemType, "text"));
}
}
else
sb.AppendFormat("this.{0} = {1};\r\n", oGenMember.sName, ProcessJsTypeFromXml(oGenMember.oSystemType, "text"));
}
else if (null != oGenMember.sType)
{
GenClassPivot oTemp;
if (m_mapProcessedClasses.TryGetValue(oGenMember.sType, out oTemp))
{
if (oTemp.bIsEnum)
{
sb.AppendFormat("var val = {0}(text);\r\n", gc_sEnumFromXmlPrefix + oTemp.sName);
sb.AppendFormat("if(-1 !== val){{\r\n");
if (oGenMember.nArrayRank.HasValue)
{
if (oGenMember.nArrayRank > 0)
{
sb.AppendFormat("this._curArray.push(val);\r\n");
}
else
{
sb.AppendFormat("this.{0}.push(val);\r\n", oGenMember.sName);
}
}
else
sb.AppendFormat("this.{0} = val;\r\n", oGenMember.sName);
sb.AppendFormat("}}\r\n");
}
}
}
sb.AppendFormat("}}\r\n");
nCounter++;
return nCounter;
}
void ProcessOnEndNodeFromXml(StringBuilder sb, GenClassPivot oGenClass, List<GenMemberPivot> aMembers)
{
int nCounter = 0;
for (int i = 0; i < aMembers.Count; ++i)
{
GenMemberPivot oGenMember = aMembers[i];
if (oGenMember.nArrayRank > 0)
{
if (0 != nCounter)
sb.AppendFormat("else ");
sb.AppendFormat("if(\"{0}\" === elem){{\r\n", getNameWithPrefix(oGenClass, oGenMember));
sb.AppendFormat("if(this._curArray && this._curArray.length > 0){{\r\n");
sb.AppendFormat("this.{0}.push(this._curArray);\r\n", oGenMember.sName);
sb.AppendFormat("this._curArray = null;\r\n");
sb.AppendFormat("}}\r\n");
sb.AppendFormat("}}\r\n");
nCounter++;
}
}
}
void ProcessAttributesFromXml(StringBuilder sb, GenClassPivot oGenClass, List<GenMemberPivot> aAttributes)
{
sb.AppendFormat("if(attr()){{\r\n");
sb.AppendFormat("var vals = attr();\r\n");
sb.AppendFormat("var val;\r\n");
for (int i = 0; i < aAttributes.Count; ++i)
{
GenMemberPivot oGenMember = aAttributes[i];
sb.AppendFormat("val = vals[\"{0}\"];\r\n", getNameWithPrefix(oGenClass, oGenMember));
sb.AppendFormat("if(undefined !== val){{\r\n");
if (null != oGenMember.oSystemType)
{
sb.AppendFormat("this.{0} = {1};\r\n", oGenMember.sName, ProcessJsTypeFromXml(oGenMember.oSystemType, "val"));
}
else if (null != oGenMember.sType)
{
GenClassPivot oTemp;
if (m_mapProcessedClasses.TryGetValue(oGenMember.sType, out oTemp))
{
if (oTemp.bIsEnum)
{
sb.AppendFormat("val = {0}(val);\r\n", gc_sEnumFromXmlPrefix + oTemp.sName);
sb.AppendFormat("if(-1 !== val){{\r\n");
sb.AppendFormat("this.{0} = val;\r\n", oGenMember.sName);
sb.AppendFormat("}}\r\n");
}
//else
// sb.AppendFormat("pNewElem->fromXML(oReader);\r\n");
}
}
sb.AppendFormat("}}\r\n");
}
sb.AppendFormat("}}\r\n");
}
string ProcessJsTypeFromXml(Type oType, string sVal)
{
string sRes;
//todo
switch (Type.GetTypeCode(oType))
{
case TypeCode.Boolean:
sRes = "getBoolFromXml(" + sVal + ")";
break;
case TypeCode.Byte:
case TypeCode.SByte:
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.UInt16:
case TypeCode.UInt32:
case TypeCode.UInt64:
case TypeCode.Single:
case TypeCode.Double:
sRes = sVal + " - 0";
break;
default: sRes = "uq(" + sVal + ")"; break;
}
return sRes;
}
void ProcessToXml(StringBuilder sb, GenClassPivot oGenClass)
{
List<GenMemberPivot> aAttributes = new List<GenMemberPivot>();
List<GenMemberPivot> aMembers = new List<GenMemberPivot>();
bool bNeedTextNode = false;
bool bNeedDoubleArray = false;
InfoFromMember(oGenClass, ref aAttributes, ref aMembers, ref bNeedTextNode, ref bNeedDoubleArray);
if (oGenClass.isRoot())
{
sb.AppendFormat("res += \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\";\r\n");
sb.AppendFormat("res += \"<{0}{1}\";\r\n", oGenClass.sRootName, gc_sNamespaceToXml);
}
else
{
sb.AppendFormat("res += \"<\";\r\n");
sb.AppendFormat("res += name;\r\n");
}
for (int i = 0; i < aAttributes.Count; ++i)
{
GenMemberPivot oGenMember = aAttributes[i];
ProcessMemberToXml(sb, oGenClass, oGenMember, "this." + oGenMember.sName, true);
}
if (aMembers.Count > 0)
{
sb.AppendFormat("res += \">\";\r\n");
for (int i = 0; i < aMembers.Count; ++i)
{
GenMemberPivot oGenMember = aMembers[i];
string sCodeElem;
if (oGenMember.nArrayRank > 0)
{
sb.AppendFormat("for(var i = 0; i < this.{0}.length; ++i){{\r\n", oGenMember.sName);
sb.AppendFormat("var elem = this.{0}[i];\r\n", oGenMember.sName);
sCodeElem = "elem";
}
else
{
sCodeElem = "this." + oGenMember.sName;
}
if (null != oGenMember.aArrayTypes)
{
if (false == oGenMember.bIsArrayTypesHidden)
{
sb.AppendFormat("res += \"<{0}>\";\r\n", getNameWithPrefix(oGenClass, oGenMember));
}
if (oGenMember.nArrayRank.HasValue)
{
sb.AppendFormat("for(var j = 0; j < {0}.length; ++j){{\r\n", sCodeElem);
sb.AppendFormat("var subelem = {0}[j];\r\n", sCodeElem);
for (int j = 0; j < oGenMember.aArrayTypes.Count; ++j)
{
GenMemberPivot oTempMember = oGenMember.aArrayTypes[j];
if (0 != j)
sb.AppendFormat("else ");
sb.AppendFormat("if(subelem instanceof {0}){{\r\n", oTempMember.sType);
sb.AppendFormat("res += subelem.toXml(\"{0}\");\r\n", getNameWithPrefix(oGenClass, oTempMember));
sb.AppendFormat("}}\r\n");
}
sb.AppendFormat("}}\r\n");
}
else
{
//right way to store oGenMemberContainer in one object, but we prefer separete types
for (int j = 0; j < oGenMember.aArrayTypes.Count; ++j)
{
GenMemberPivot oTempMember = oGenMember.aArrayTypes[j];
ProcessMemberToXml(sb, oGenClass, oTempMember, "this." + oTempMember.sName, true);
}
}
if (false == oGenMember.bIsArrayTypesHidden)
{
sb.AppendFormat("res += \"</{0}>\";\r\n", getNameWithPrefix(oGenClass, oGenMember));
}
}
else
{
if (oGenMember.nArrayRank.HasValue)
{
sb.AppendFormat("for(var i = 0; i < {0}.length; ++i){{\r\n", sCodeElem);
sb.AppendFormat("var elem = {0}[i];\r\n", sCodeElem);
ProcessMemberToXml(sb, oGenClass, oGenMember, "elem", false);
sb.AppendFormat("}}\r\n");
}
else
{
ProcessMemberToXml(sb, oGenClass, oGenMember, sCodeElem, true);
}
}
if (oGenMember.nArrayRank > 0)
{
sb.AppendFormat("}}\r\n");
}
}
if (oGenClass.isRoot())
{
sb.AppendFormat("res += \"</{0}>\";\r\n", oGenClass.sRootName);
}
else
{
sb.AppendFormat("res += \"</\";\r\n");
sb.AppendFormat("res += name;\r\n");
sb.AppendFormat("res += \">\";\r\n");
}
}
else
sb.AppendFormat("res += \"/>\";\r\n");
}
void ProcessMemberToXml(StringBuilder sb, GenClassPivot oGenClass, GenMemberPivot oGenMember, string sElemName, bool checkNull)
{
string sElemXmlName = getNameWithPrefix(oGenClass, oGenMember);
bool bIsAttribute = true == oGenMember.bIsAttribute;
if (checkNull)
{
sb.AppendFormat("if(null !== {0}){{\r\n", sElemName);
}
if (null != oGenMember.oSystemType)
{
if (bIsAttribute)
sb.AppendFormat("res += \" {0}=\\\"\";\r\n", sElemXmlName);
else
sb.AppendFormat("res += \"<{0}>\";\r\n", sElemXmlName);
sb.AppendFormat("res += {0};\r\n", ProcessJsTypeToXml(oGenMember.oSystemType, sElemName));
if (bIsAttribute)
sb.AppendFormat("res += \"\\\"\";\r\n");
else
sb.AppendFormat("res += \"</{0}>\";\r\n", sElemXmlName);
}
else if (null != oGenMember.sType)
{
GenClassPivot oGenClassMember = null;
m_mapProcessedClasses.TryGetValue(oGenMember.sType, out oGenClassMember);
if (null != oGenClassMember || m_mapProcessedClasses.TryGetValue(oGenMember.sType, out oGenClassMember))
{
if (oGenClassMember.bIsEnum)
{
if (bIsAttribute)
sb.AppendFormat("res += \" {0}=\\\"\";\r\n", sElemXmlName);
else
sb.AppendFormat("res += \"<{0}>\";\r\n", sElemXmlName);
sb.AppendFormat("res += {0}{1}({2});\r\n", gc_sEnumToXmlPrefix, oGenClassMember.sName, sElemName);
if (bIsAttribute)
sb.AppendFormat("res += \"\\\"\";\r\n");
else
sb.AppendFormat("res += \"</{0}>\";\r\n", sElemXmlName);
}
else
{
if (!bIsAttribute)
sb.AppendFormat("res += {0}.toXml(\"{1}\");\r\n", sElemName, sElemXmlName);
}
}
}
if (checkNull)
{
sb.AppendFormat("}}\r\n");
}
}
string ProcessJsTypeToXml(Type oType, string sVal)
{
string sRes;
switch (Type.GetTypeCode(oType))
{
case TypeCode.Boolean:
sRes = "getXmlFromBool(" + sVal + ")";
break;
case TypeCode.Byte:
case TypeCode.SByte:
case TypeCode.Int16:
case TypeCode.Int32:
case TypeCode.Int64:
case TypeCode.UInt16:
case TypeCode.UInt32:
case TypeCode.UInt64:
case TypeCode.Single:
case TypeCode.Double:
sRes = sVal + ".toString()";
break;
default: sRes = sVal; break;
}
return sRes;
}
string getNameWithPrefix(GenClassPivot oGenClass, GenMemberPivot oGenMember)
{
string sShortNamespace = "";
if (true == oGenMember.bQualified)
{
string sMemberNamespace = null;
GenClassPivot oGenClassMember = null;
if (null != oGenMember.sNamespace)
sMemberNamespace = oGenMember.sNamespace;
else if (null != oGenMember.sType && m_mapProcessedClasses.TryGetValue(oGenMember.sType, out oGenClassMember))
sMemberNamespace = oGenClassMember.sNamespace;
else
sMemberNamespace = oGenClass.sNamespace;
if (null != sMemberNamespace)
{
Utils.m_mapNamespaceToPrefix.TryGetValue(sMemberNamespace, out sShortNamespace);
}
}
return sShortNamespace + oGenMember.sName;
}
}
}

View File

@ -45,7 +45,8 @@ namespace codegen
static string sDirJsBinOut = @"..\..\gen\";
static void Main(string[] args)
{
(new codegen.CodeGen()).Start(sDirIn, sDirCppXmlOut, sDirCppBinOut, sDirJsBinOut, ValidationCallback);
//(new codegen.CodeGen()).Start(sDirIn, sDirCppXmlOut, sDirCppBinOut, sDirJsBinOut, ValidationCallback);
(new codegen.CodeGenPivot()).Start(sDirIn, sDirCppXmlOut, sDirCppBinOut, sDirJsBinOut, ValidationCallback);
}
static void ValidationCallback(object sender, ValidationEventArgs args)
{

View File

@ -5,7 +5,6 @@
xmlns="http://purl.oclc.org/ooxml/drawingml/chart"
xmlns:cdr="http://purl.oclc.org/ooxml/drawingml/chartDrawing"
xmlns:s="http://purl.oclc.org/ooxml/officeDocument/sharedTypes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
targetNamespace="http://purl.oclc.org/ooxml/drawingml/chart" elementFormDefault="qualified"
attributeFormDefault="unqualified" blockDefault="#all">
<xsd:import namespace="http://purl.oclc.org/ooxml/officeDocument/relationships"
@ -15,7 +14,6 @@
schemaLocation="dml-chartDrawing.xsd"/>
<xsd:import namespace="http://purl.oclc.org/ooxml/officeDocument/sharedTypes"
schemaLocation="shared-commonSimpleTypes.xsd"/>
<xsd:import namespace="http://schemas.openxmlformats.org/markup-compatibility/2006" schemaLocation="mce.xsd"/>
<xsd:complexType name="CT_Boolean">
<xsd:attribute name="val" type="xsd:boolean" use="optional" default="true"/>
</xsd:complexType>
@ -1432,7 +1430,6 @@
<xsd:element name="date1904" type="CT_Boolean" minOccurs="0" maxOccurs="1"/>
<xsd:element name="lang" type="CT_TextLanguageID" minOccurs="0" maxOccurs="1"/>
<xsd:element name="roundedCorners" type="CT_Boolean" minOccurs="0" maxOccurs="1"/>
<xsd:element ref="mc:AlternateContent" minOccurs="0" maxOccurs="1"/>
<xsd:element name="style" type="CT_Style" minOccurs="0" maxOccurs="1"/>
<xsd:element name="clrMapOvr" type="a:CT_ColorMapping" minOccurs="0" maxOccurs="1"/>
<xsd:element name="pivotSource" type="CT_PivotSource" minOccurs="0" maxOccurs="1"/>

View File

@ -1441,7 +1441,7 @@
<xsd:group ref="EG_ShadeProperties" minOccurs="0" maxOccurs="1"/>
<xsd:element name="tileRect" type="CT_RelativeRect" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="flip" type="ST_TileFlipMode" use="optional"/>
<xsd:attribute name="flip" type="ST_TileFlipMode" use="optional" default="none"/>
<xsd:attribute name="rotWithShape" type="xsd:boolean" use="optional"/>
</xsd:complexType>
<xsd:complexType name="CT_TileInfoProperties">
@ -1449,7 +1449,7 @@
<xsd:attribute name="ty" type="ST_Coordinate" use="optional"/>
<xsd:attribute name="sx" type="ST_Percentage" use="optional"/>
<xsd:attribute name="sy" type="ST_Percentage" use="optional"/>
<xsd:attribute name="flip" type="ST_TileFlipMode" use="optional"/>
<xsd:attribute name="flip" type="ST_TileFlipMode" use="optional" default="none"/>
<xsd:attribute name="algn" type="ST_RectAlignment" use="optional"/>
</xsd:complexType>
<xsd:complexType name="CT_StretchInfoProperties">
@ -2118,7 +2118,7 @@
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="CT_LineEndProperties">
<xsd:attribute name="type" type="ST_LineEndType" use="optional"/>
<xsd:attribute name="type" type="ST_LineEndType" use="optional" default="none"/>
<xsd:attribute name="w" type="ST_LineEndWidth" use="optional"/>
<xsd:attribute name="len" type="ST_LineEndLength" use="optional"/>
</xsd:complexType>
@ -2896,7 +2896,7 @@
<xsd:attribute name="u" type="ST_TextUnderlineType" use="optional"/>
<xsd:attribute name="strike" type="ST_TextStrikeType" use="optional"/>
<xsd:attribute name="kern" type="ST_TextNonNegativePoint" use="optional"/>
<xsd:attribute name="cap" type="ST_TextCapsType" use="optional"/>
<xsd:attribute name="cap" type="ST_TextCapsType" use="optional" default="none"/>
<xsd:attribute name="spc" type="ST_TextPoint" use="optional"/>
<xsd:attribute name="normalizeH" type="xsd:boolean" use="optional"/>
<xsd:attribute name="baseline" type="ST_Percentage" use="optional"/>

View File

@ -518,7 +518,7 @@
<xsd:element name="cBhvr" type="CT_TLCommonBehaviorData" minOccurs="1" maxOccurs="1"/>
<xsd:element name="progress" type="CT_TLAnimVariant" minOccurs="0" maxOccurs="1"/>
</xsd:sequence>
<xsd:attribute name="transition" type="ST_TLAnimateEffectTransition" use="optional"/>
<xsd:attribute name="transition" type="ST_TLAnimateEffectTransition" default="in" use="optional"/>
<xsd:attribute name="filter" type="xsd:string" use="optional"/>
<xsd:attribute name="prLst" type="xsd:string" use="optional"/>
</xsd:complexType>

View File

@ -3374,8 +3374,8 @@
</xsd:complexType>
<xsd:complexType name="CT_CellAlignment">
<xsd:attribute name="horizontal" type="ST_HorizontalAlignment" use="optional"/>
<xsd:attribute name="vertical" type="ST_VerticalAlignment" use="optional"/>
<xsd:attribute name="textRotation" type="xsd:unsignedInt" use="optional"/>
<xsd:attribute name="vertical" type="ST_VerticalAlignment" default="bottom" use="optional"/>
<xsd:attribute name="textRotation" type="ST_TextRotation" use="optional"/>
<xsd:attribute name="wrapText" type="xsd:boolean" use="optional"/>
<xsd:attribute name="indent" type="xsd:unsignedInt" use="optional"/>
<xsd:attribute name="relativeIndent" type="xsd:int" use="optional"/>
@ -3383,6 +3383,20 @@
<xsd:attribute name="shrinkToFit" type="xsd:boolean" use="optional"/>
<xsd:attribute name="readingOrder" type="xsd:unsignedInt" use="optional"/>
</xsd:complexType>
<xsd:simpleType name="ST_TextRotation">
<xsd:union>
<xsd:simpleType>
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:maxInclusive value="180"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType>
<xsd:restriction base="xsd:nonNegativeInteger">
<xsd:enumeration value="255"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:union>
</xsd:simpleType>
<xsd:simpleType name="ST_BorderStyle">
<xsd:restriction base="xsd:string">
<xsd:enumeration value="none"/>

View File

@ -42,7 +42,7 @@
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="CT_Charset">
<xsd:attribute name="characterSet" type="s:ST_String" use="optional"/>
<xsd:attribute name="characterSet" type="s:ST_String" use="optional" default="ISO-8859-1"/>
</xsd:complexType>
<xsd:simpleType name="ST_DecimalNumberOrPercent">
<xsd:union memberTypes="s:ST_Percentage"/>
@ -185,7 +185,7 @@
</xsd:simpleType>
<xsd:complexType name="CT_Underline">
<xsd:attribute name="val" type="ST_Underline" use="optional"/>
<xsd:attribute name="color" type="ST_HexColor" use="optional"/>
<xsd:attribute name="color" type="ST_HexColor" use="optional" default="auto"/>
<xsd:attribute name="themeColor" type="ST_ThemeColor" use="optional"/>
<xsd:attribute name="themeTint" type="ST_UcharHexNumber" use="optional"/>
<xsd:attribute name="themeShade" type="ST_UcharHexNumber" use="optional"/>
@ -403,12 +403,12 @@
</xsd:simpleType>
<xsd:complexType name="CT_Border">
<xsd:attribute name="val" type="ST_Border" use="required"/>
<xsd:attribute name="color" type="ST_HexColor" use="optional"/>
<xsd:attribute name="color" type="ST_HexColor" use="optional" default="auto"/>
<xsd:attribute name="themeColor" type="ST_ThemeColor" use="optional"/>
<xsd:attribute name="themeTint" type="ST_UcharHexNumber" use="optional"/>
<xsd:attribute name="themeShade" type="ST_UcharHexNumber" use="optional"/>
<xsd:attribute name="sz" type="ST_EighthPointMeasure" use="optional"/>
<xsd:attribute name="space" type="ST_PointMeasure" use="optional"/>
<xsd:attribute name="space" type="ST_PointMeasure" use="optional" default="0"/>
<xsd:attribute name="shadow" type="s:ST_OnOff" use="optional"/>
<xsd:attribute name="frame" type="s:ST_OnOff" use="optional"/>
</xsd:complexType>
@ -594,14 +594,14 @@
</xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="CT_Spacing">
<xsd:attribute name="before" type="s:ST_TwipsMeasure" use="optional"/>
<xsd:attribute name="beforeLines" type="ST_DecimalNumber" use="optional"/>
<xsd:attribute name="beforeAutospacing" type="s:ST_OnOff" use="optional"/>
<xsd:attribute name="after" type="s:ST_TwipsMeasure" use="optional"/>
<xsd:attribute name="afterLines" type="ST_DecimalNumber" use="optional"/>
<xsd:attribute name="afterAutospacing" type="s:ST_OnOff" use="optional"/>
<xsd:attribute name="line" type="ST_SignedTwipsMeasure" use="optional"/>
<xsd:attribute name="lineRule" type="ST_LineSpacingRule" use="optional"/>
<xsd:attribute name="before" type="s:ST_TwipsMeasure" use="optional" default="0"/>
<xsd:attribute name="beforeLines" type="ST_DecimalNumber" use="optional" default="0"/>
<xsd:attribute name="beforeAutospacing" type="s:ST_OnOff" use="optional" default="off"/>
<xsd:attribute name="after" type="s:ST_TwipsMeasure" use="optional" default="0"/>
<xsd:attribute name="afterLines" type="ST_DecimalNumber" use="optional" default="0"/>
<xsd:attribute name="afterAutospacing" type="s:ST_OnOff" use="optional" default="off"/>
<xsd:attribute name="line" type="ST_SignedTwipsMeasure" use="optional" default="0"/>
<xsd:attribute name="lineRule" type="ST_LineSpacingRule" use="optional" default="auto"/>
</xsd:complexType>
<xsd:complexType name="CT_Ind">
<xsd:attribute name="start" type="ST_SignedTwipsMeasure" use="optional"/>
@ -669,7 +669,7 @@
<xsd:attribute name="lang" type="s:ST_Lang" use="required"/>
<xsd:attribute name="vendorID" type="s:ST_String" use="required"/>
<xsd:attribute name="dllVersion" type="s:ST_String" use="required"/>
<xsd:attribute name="nlCheck" type="s:ST_OnOff" use="optional"/>
<xsd:attribute name="nlCheck" type="s:ST_OnOff" use="optional" default="off"/>
<xsd:attribute name="checkStyle" type="s:ST_OnOff" use="required"/>
<xsd:attribute name="appName" type="s:ST_String" use="required"/>
</xsd:complexType>
@ -1101,7 +1101,7 @@
<xsd:sequence>
<xsd:element name="drawing" type="CT_Drawing" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="color" type="ST_HexColor" use="optional"/>
<xsd:attribute name="color" type="ST_HexColor" use="optional" default="auto"/>
<xsd:attribute name="themeColor" type="ST_ThemeColor" use="optional"/>
<xsd:attribute name="themeTint" type="ST_UcharHexNumber" use="optional"/>
<xsd:attribute name="themeShade" type="ST_UcharHexNumber" use="optional"/>
@ -1405,9 +1405,9 @@
<xsd:element name="bottom" type="CT_BottomPageBorder" minOccurs="0"/>
<xsd:element name="right" type="CT_PageBorder" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="zOrder" type="ST_PageBorderZOrder" use="optional"/>
<xsd:attribute name="zOrder" type="ST_PageBorderZOrder" use="optional" default="front"/>
<xsd:attribute name="display" type="ST_PageBorderDisplay" use="optional"/>
<xsd:attribute name="offsetFrom" type="ST_PageBorderOffset" use="optional"/>
<xsd:attribute name="offsetFrom" type="ST_PageBorderOffset" use="optional" default="text"/>
</xsd:complexType>
<xsd:complexType name="CT_PageBorder">
<xsd:complexContent>
@ -1450,27 +1450,27 @@
</xsd:simpleType>
<xsd:complexType name="CT_LineNumber">
<xsd:attribute name="countBy" type="ST_DecimalNumber" use="optional"/>
<xsd:attribute name="start" type="ST_DecimalNumber" use="optional"/>
<xsd:attribute name="start" type="ST_DecimalNumber" use="optional" default="1"/>
<xsd:attribute name="distance" type="s:ST_TwipsMeasure" use="optional"/>
<xsd:attribute name="restart" type="ST_LineNumberRestart" use="optional"/>
<xsd:attribute name="restart" type="ST_LineNumberRestart" use="optional" default="newPage"/>
</xsd:complexType>
<xsd:complexType name="CT_PageNumber">
<xsd:attribute name="fmt" type="ST_NumberFormat" use="optional"/>
<xsd:attribute name="fmt" type="ST_NumberFormat" use="optional" default="decimal"/>
<xsd:attribute name="start" type="ST_DecimalNumber" use="optional"/>
<xsd:attribute name="chapStyle" type="ST_DecimalNumber" use="optional"/>
<xsd:attribute name="chapSep" type="ST_ChapterSep" use="optional"/>
<xsd:attribute name="chapSep" type="ST_ChapterSep" use="optional" default="hyphen"/>
</xsd:complexType>
<xsd:complexType name="CT_Column">
<xsd:attribute name="w" type="s:ST_TwipsMeasure" use="optional"/>
<xsd:attribute name="space" type="s:ST_TwipsMeasure" use="optional"/>
<xsd:attribute name="space" type="s:ST_TwipsMeasure" use="optional" default="0"/>
</xsd:complexType>
<xsd:complexType name="CT_Columns">
<xsd:sequence minOccurs="0">
<xsd:element name="col" type="CT_Column" maxOccurs="45"/>
</xsd:sequence>
<xsd:attribute name="equalWidth" type="s:ST_OnOff" use="optional"/>
<xsd:attribute name="space" type="s:ST_TwipsMeasure" use="optional"/>
<xsd:attribute name="num" type="ST_DecimalNumber" use="optional"/>
<xsd:attribute name="space" type="s:ST_TwipsMeasure" use="optional" default="720"/>
<xsd:attribute name="num" type="ST_DecimalNumber" use="optional" default="1"/>
<xsd:attribute name="sep" type="s:ST_OnOff" use="optional"/>
</xsd:complexType>
<xsd:simpleType name="ST_VerticalJc">
@ -1713,7 +1713,6 @@
<xsd:restriction base="xsd:string">
<xsd:enumeration value="default"/>
<xsd:enumeration value="eastAsia"/>
<xsd:enumeration value="cs"/>
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ST_Theme">
@ -1941,7 +1940,7 @@
<xsd:sequence>
<xsd:element name="listItem" type="CT_SdtListItem" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="lastValue" type="s:ST_String" use="optional"/>
<xsd:attribute name="lastValue" type="s:ST_String" use="optional" default=""/>
</xsd:complexType>
<xsd:complexType name="CT_SdtDocPart">
<xsd:sequence>
@ -1954,7 +1953,7 @@
<xsd:sequence>
<xsd:element name="listItem" type="CT_SdtListItem" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute name="lastValue" type="s:ST_String" use="optional"/>
<xsd:attribute name="lastValue" type="s:ST_String" use="optional" default=""/>
</xsd:complexType>
<xsd:complexType name="CT_Placeholder">
<xsd:sequence>

View File

@ -45,6 +45,7 @@ namespace codegen
public static string gc_sSerToBinEnumPrefix = "c_oSer";
public static string gc_sItemsChoiceType = "ItemsChoiceType";
public static string gc_sItemsElementName = "ItemsElementName";
public static Dictionary<string, string> m_mapNamespaceToPrefix = new Dictionary<string, string>() { { "http://purl.oclc.org/ooxml/drawingml/chart", "c:" }, { "http://purl.oclc.org/ooxml/drawingml/main", "a:" }, { "http://purl.oclc.org/ooxml/officeDocument/relationships", "r:" }, { "http://schemas.openxmlformats.org/markup-compatibility/2006", "mc:" }, { "http://schemas.microsoft.com/office/drawing/2007/8/2/chart", "c14:" } };
public static string GetEnumElemName(string sEnumName, string sElemName)
{
return sEnumName.ToLower() + sElemName.ToUpper();

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
@ -10,8 +10,29 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>codepeg2</RootNamespace>
<AssemblyName>codepeg2</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<FileUpgradeFlags>
</FileUpgradeFlags>
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>3.5</OldToolsVersion>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@ -21,6 +42,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@ -29,6 +51,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -48,11 +71,14 @@
<Compile Include="CodeGen.cs" />
<Compile Include="CodegenCPP.cs" />
<Compile Include="CodegenJS.cs" />
<Compile Include="CodegenJSPivot.cs" />
<Compile Include="CodeGenPivot.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utils.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="Resource\chart20070802.xsd" />
<None Include="Resource\dml-chart.xsd" />
<None Include="Resource\dml-chartDrawing.xsd" />
@ -77,6 +103,13 @@
<None Include="Resource\sml.xsd" />
<None Include="Resource\wml.xsd" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>true</Install>
</BootstrapperPackage>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.