Compare commits

...

18 Commits

74 changed files with 17683 additions and 1942 deletions

View File

@ -7196,6 +7196,8 @@ namespace BinDocxRW
}
void WriteColorSchemeMapping(const PPTX::Logic::ClrMap& oColorSchemeMapping)
{
int re_index[] = {0, 1, 2, 3, 4, 5, 10, 11, 6, 7, 8, 9, 10, 6, 7};
int nCurPos = 0;
std::map<std::wstring, PPTX::Limit::ColorSchemeIndex>::const_iterator pFind;
@ -7204,84 +7206,84 @@ namespace BinDocxRW
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent1);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"accent2");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent2);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"accent3");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent3);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"accent4");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent4);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"accent5");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent5);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"accent6");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Accent6);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"bg1");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg1);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"bg2");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Bg2);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"folHlink");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::FollowedHyperlink);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"hlink");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::Hyperlink);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"tx1");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T1);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
pFind = oColorSchemeMapping.ColorMap.find(L"tx2");
if(pFind != oColorSchemeMapping.ColorMap.end())
{
m_oBcw.m_oStream.WriteBYTE(c_oSer_ClrSchemeMappingType::T2);
m_oBcw.m_oStream.WriteBYTE(c_oSerPropLenType::Byte);
m_oBcw.m_oStream.WriteBYTE(pFind->second.GetBYTECode());
m_oBcw.m_oStream.WriteBYTE(re_index[pFind->second.GetBYTECode()]);
}
};
};

View File

@ -1195,7 +1195,7 @@ void docx_conversion_context::process_headers_footers()
// проходим по всем page layout
BOOST_FOREACH(const odf_reader::style_master_page* page, pageLayouts.master_pages())
{
const std::wstring & styleName = page->style_master_page_attlist_.style_name_.get_value_or( L"" );
const std::wstring & styleName = page->attlist_.style_name_.get_value_or( L"" );
const std::wstring masterPageNameLayout =context.pageLayoutContainer().page_layout_name_by_style(styleName);
add_page_properties(masterPageNameLayout);

View File

@ -144,7 +144,8 @@ void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstri
}
namespace oox
{
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) : base_font_size_(12), fonts_container_(fonts)
math_context::math_context(odf_reader::fonts_container & fonts, bool graphic) :
base_font_size_(12), fonts_container_(fonts)
{
graphRPR_ = graphic;

View File

@ -57,9 +57,25 @@ namespace svg_path
{
CP_XML_NODE(val.command)
{
for (size_t i = 0; i < val.points.size(); i++)
{
oox_serialize(CP_XML_STREAM(), val.points[i]);
if (val.command == L"a:ArcTo")
{
if (val.points.size() > 0)
{
CP_XML_ATTR(L"wR", (int)(val.points[0].x.get()));
CP_XML_ATTR(L"hR", (int)(val.points[0].y.get()));
}
if (val.points.size() > 1)
{
CP_XML_ATTR(L"stAng", (int)(val.points[1].x.get() * 60000));
CP_XML_ATTR(L"swAng", (int)(val.points[1].y.get() * 60000));
}
}
else
{
for (size_t i = 0; i < val.points.size(); i++)
{
oox_serialize(CP_XML_STREAM(), val.points[i]);
}
}
}
}
@ -112,7 +128,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
_CP_OPT(std::wstring) strStrokeColor;
_CP_OPT(int) iStroke;
_CP_OPT(double) dStrokeWidth;
_CP_OPT(double) dStrokeOpacity;
_CP_OPT(double) dStrokeOpacity;
_CP_OPT(bool) bWordArt;
odf_reader::GetProperty(prop, L"wordArt", bWordArt);
@ -151,15 +167,23 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
{
if (fill != L"a:noFill")
{
if (color.length() < 1 && always_draw) color = L"000000";
else if (color.length() <1 ) color = L"ffffff";
if ( color.empty() )
{
if (always_draw) color = L"000000";
else color = L"ffffff";
}
CP_XML_NODE(L"a:srgbClr")
{
CP_XML_ATTR(L"val",color);
if (dStrokeOpacity) CP_XML_NODE(L"a:alpha"){CP_XML_ATTR(L"val", *dStrokeOpacity);}
if (dStrokeOpacity)
{
CP_XML_NODE(L"a:alpha")
{
CP_XML_ATTR(L"val", (int)(*dStrokeOpacity * 1000));
}
}
}
}
}
@ -187,69 +211,33 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
}
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop)
{
_CP_OPT(int) iShapeIndex;
_CP_OPT(bool) bWordArt;
odf_reader::GetProperty(prop, L"wordArt" , bWordArt);
odf_reader::GetProperty(prop, L"odf-custom-draw-index" , iShapeIndex);
int count_values = 0, min_value = 0, max_value = 0;
if (!bWordArt && iShapeIndex)
{
count_values = _OO_OOX_custom_shapes[*iShapeIndex].count_values;
min_value = _OO_OOX_custom_shapes[*iShapeIndex].min;
max_value = _OO_OOX_custom_shapes[*iShapeIndex].max;
}
else if (iShapeIndex)
{
count_values = _OO_OOX_wordart[*iShapeIndex].count_values;
min_value = _OO_OOX_wordart[*iShapeIndex].min;
max_value = _OO_OOX_wordart[*iShapeIndex].max;
}
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"a:avLst")
{
_CP_OPT(std::wstring) strVal;
if (odf_reader::GetProperty(prop,L"draw-modifiers",strVal) && iShapeIndex)
_CP_OPT(bool) bModifiers;
_CP_OPT(std::wstring) strModifiers;
odf_reader::GetProperty(prop, L"bModifiers", bModifiers);
odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers);
if (strModifiers)
{
std::vector< std::wstring > values;
boost::algorithm::split(values, strVal.get(), boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
boost::algorithm::split(values, strModifiers.get(), boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
if( count_values >0 && values.size()>0 && count_values < 3)//временное ограниечение .. хз как там свойства путаются
{//если не заданы доп свойства - нефиг мучится
int i=1;
if (!values.empty() && values.back().empty()) values.pop_back();
_CP_OPT(int) iMax,iMin;
odf_reader::GetProperty(prop,L"draw-modifiers-min",iMin);
odf_reader::GetProperty(prop,L"draw-modifiers-max",iMax);
values.resize(count_values);
BOOST_FOREACH(std::wstring & v, values)
for (size_t i = 0; i < values.size(); i++)
{
if (values[i].empty()) continue;
CP_XML_NODE(L"a:gd")
{
CP_XML_NODE(L"a:gd")
{
if (values.size() >1)
CP_XML_ATTR(L"name",(L"adj" + boost::lexical_cast<std::wstring>(i++)));
else
CP_XML_ATTR(L"name",L"adj");
double val=0;
if (v.length()>0)val= boost::lexical_cast<double>(v);
if (iMin && iMax && iShapeIndex)
{
if (min_value < max_value)
{
double W = *iMax - *iMin;
val = (val- (*iMin))/W * (max_value - min_value) + min_value;
}
}
CP_XML_ATTR(L"fmla",L"val " + boost::lexical_cast<std::wstring>(static_cast<int>(val)));
}
if (values.size() > 1 || bModifiers)
//весьма странное .. для некоторых модификаторов (напр math...) нужно указывать множественность их
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i+1));
else
CP_XML_ATTR(L"name", L"adj");
CP_XML_ATTR(L"fmla", L"val " + values[i]);
}
}
}
@ -342,37 +330,39 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
void _oox_drawing::serialize_shape(std::wostream & strm)
{
_CP_OPT(std::wstring) strVal;
_CP_OPT(double) dVal;
_CP_OPT(int) iOoxShapeIndex;
_CP_OPT(bool) bWordArt, bOoxShape;
_CP_OPT(std::wstring) sCustomPath;
odf_reader::GetProperty(additional, L"wordArt", bWordArt);
odf_reader::GetProperty(additional, L"oox-geom-index", iOoxShapeIndex);
odf_reader::GetProperty(additional, L"oox-geom", bOoxShape);
std::wstring shapeType;
_CP_OPT(bool) bWordArt;
odf_reader::GetProperty(additional,L"wordArt", bWordArt);
odf_reader::GetProperty(additional, L"custom_path", sCustomPath);
std::wstring shapeGeomPreset;
if (sub_type == 7)//custom
{
_CP_OPT(int) iVal;
odf_reader::GetProperty(additional, L"odf-custom-draw-index",iVal);
if (iVal)
shapeType = _OO_OOX_custom_shapes[*iVal].oox;
else
if (iOoxShapeIndex)
shapeGeomPreset = _OO_OOX_custom_shapes[*iOoxShapeIndex].oox;
else if (sCustomPath)
sub_type = 6; //path
if (shapeType == L"textBox")
if (shapeGeomPreset == L"textBox")
{
sub_type = 1;
shapeType = L"rect";
shapeGeomPreset = L"rect";
}
}
else if (sub_type < 9 && sub_type >= 0)
{
shapeType = _ooxShapeType[sub_type];
shapeGeomPreset = _ooxShapeType[sub_type]; //odf -> oox
}
if (bWordArt) sub_type = 1;
CP_XML_WRITER(strm)
{
if (sub_type == 6 || sub_type == 8)
@ -391,36 +381,40 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
CP_XML_ATTR(L"t", 0);
}
//<a:rect b="b" l="0" r="r" t="0"/>
if (odf_reader::GetProperty(additional, L"custom_path", strVal))
{
_CP_OPT(int) w, h;
odf_reader::GetProperty(additional, L"custom_path_w", w);
odf_reader::GetProperty(additional, L"custom_path_h", h);
_CP_OPT(int) w, h;
odf_reader::GetProperty(additional, L"custom_path_w", w);
odf_reader::GetProperty(additional, L"custom_path_h", h);
CP_XML_NODE(L"a:pathLst")
{
CP_XML_NODE(L"a:path")
{
CP_XML_ATTR(L"w", w ? *w : cx);
CP_XML_ATTR(L"h", h ? *h : cy);
CP_XML_STREAM() << strVal.get();
}
CP_XML_NODE(L"a:pathLst")
{
CP_XML_NODE(L"a:path")
{
CP_XML_ATTR(L"w", w ? *w : cx);
CP_XML_ATTR(L"h", h ? *h : cy);
CP_XML_STREAM() << *sCustomPath;
}
}
}
}
}
else
{
if (shapeType.length() < 1)
if (shapeGeomPreset.empty())
{
shapeType = L"rect";
sub_type = 2;
shapeGeomPreset = L"rect";
sub_type = 2;
}
CP_XML_NODE(L"a:prstGeom")//автофигура
{
CP_XML_ATTR(L"prst", shapeType);
if (!bWordArt) oox_serialize_aLst(CP_XML_STREAM(), additional);
CP_XML_ATTR(L"prst", shapeGeomPreset);
if (!bWordArt)
{
if (std::wstring::npos != shapeGeomPreset.find(L"mathPlus"))
{
additional.push_back(odf_reader::_property(L"bModifiers", true));
}
oox_serialize_aLst(CP_XML_STREAM(), additional);
}
}
}
if (bWordArt)

View File

@ -272,9 +272,9 @@ void pptx_conversion_context::end_document()
odf_reader::odf_read_context & context = root()->odf_context();
odf_reader::page_layout_container & pageLayouts = context.pageLayoutContainer();
if ((pageLayouts.master_pages().size() > 0) && (pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_))//default
if ((pageLayouts.master_pages().size() > 0) && (pageLayouts.master_pages()[0]->attlist_.style_name_))//default
{
const std::wstring masterStyleName = pageLayouts.master_pages()[0]->style_master_page_attlist_.style_name_.get();
const std::wstring masterStyleName = pageLayouts.master_pages()[0]->attlist_.style_name_.get();
const std::wstring pageProperties = root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masterStyleName);
odf_reader::page_layout_instance *pages_layouts = root()->odf_context().pageLayoutContainer().page_layout_by_name(pageProperties);

View File

@ -55,6 +55,7 @@ public:
std::wstringstream autofilter_;
std::wstringstream conditionalFormatting_;
std::wstringstream ole_objects_;
std::wstringstream page_props_;
rels hyperlinks_rels_;
rels ole_objects_rels_;
@ -134,6 +135,11 @@ std::wostream & xlsx_xml_worksheet::ole_objects()
{
return impl_->ole_objects_;
}
std::wostream & xlsx_xml_worksheet::page_properties()
{
return impl_->page_props_;
}
//---------------------------------------------------------------------------------------
rels & xlsx_xml_worksheet::hyperlinks_rels()
{
@ -196,9 +202,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
{
CP_XML_NODE(L"oleObjects")
{
CP_XML_STREAM() << impl_->ole_objects_.str();
CP_XML_STREAM() << impl_->ole_objects_.str();
}
}
if (!impl_->page_props_.str().empty())
{
CP_XML_STREAM() << impl_->page_props_.str();
}
//CP_XML_NODE(L"headerFooter){}
//CP_XML_NODE(L"rowBreaks){}

View File

@ -63,6 +63,7 @@ public:
std::wostream & conditionalFormatting();
std::wostream & sort();
std::wostream & ole_objects();
std::wostream & page_properties();
rels & hyperlinks_rels();
rels & ole_objects_rels();

View File

@ -341,11 +341,26 @@ double charsToSize(unsigned int charsCount, double maxDigitSize)
return 1.0 * int((maxDigitSize * charsCount + 5.0) / maxDigitSize * 256.0) / 256.0;
}
void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
void xlsx_table_state::serialize_page_properties (std::wostream & strm)
{
_CP_OPT(std::wstring) masterPageName = context_->root()->odf_context().styleContainer().master_page_name_by_name(table_style_);
if (!masterPageName) return;
odf_reader::style_master_page* master_style_ = context_->root()->odf_context().pageLayoutContainer().master_page_by_name(*masterPageName);
if (!master_style_) return;
if (!master_style_->attlist_.style_page_layout_name_) return;
odf_reader::page_layout_instance * page_layout = context_->root()->odf_context().pageLayoutContainer().page_layout_by_name(*master_style_->attlist_.style_page_layout_name_);
if (!page_layout) return;
page_layout->xlsx_serialize(strm, *context_);
}
void xlsx_table_state::serialize_table_format (std::wostream & strm)
{
odf_reader::odf_read_context & odfContext = context_->root()->odf_context();
CP_XML_WRITER(_Wostream)
CP_XML_WRITER(strm)
{
odf_reader::style_table_properties * table_prop = NULL;
odf_reader::style_instance * tableStyle = odfContext.styleContainer().style_by_name(table_style_, odf_types::style_family::Table, false);
@ -406,8 +421,8 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
int col = -1, row = -1;
try
{
col = boost::lexical_cast<int>(s_col);
row = boost::lexical_cast<int>(s_row);
if (!s_col.empty()) col = boost::lexical_cast<int>(s_col);
if (!s_row.empty()) row = boost::lexical_cast<int>(s_row);
}
catch(...){}
@ -435,9 +450,9 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
{
const odf_reader::style_table_row_properties * prop = rowDefStyle->content()->get_style_table_row_properties();
if ( (prop) && (prop->style_table_row_properties_attlist_.style_row_height_))
if ( (prop) && (prop->attlist_.style_row_height_))
{
default_height = prop->style_table_row_properties_attlist_.style_row_height_->get_value_unit(odf_types::length::pt);
default_height = prop->attlist_.style_row_height_->get_value_unit(odf_types::length::pt);
}
std::wstringstream ht_s;
ht_s.precision(1);
@ -451,21 +466,21 @@ void xlsx_table_state::serialize_table_format(std::wostream & _Wostream)
}
}
void xlsx_table_state::serialize_merge_cells(std::wostream & _Wostream)
void xlsx_table_state::serialize_merge_cells(std::wostream & strm)
{
return xlsx_merge_cells_.xlsx_serialize(_Wostream);
return xlsx_merge_cells_.xlsx_serialize(strm);
}
void xlsx_table_state::serialize_ole_objects(std::wostream & _Wostream)
void xlsx_table_state::serialize_ole_objects(std::wostream & strm)
{
return xlsx_drawing_context_.get_drawings()->serialize_objects(_Wostream);
return xlsx_drawing_context_.get_drawings()->serialize_objects(strm);
}
void xlsx_table_state::serialize_hyperlinks(std::wostream & _Wostream)
void xlsx_table_state::serialize_hyperlinks(std::wostream & strm)
{
return xlsx_hyperlinks_.xlsx_serialize(_Wostream);
return xlsx_hyperlinks_.xlsx_serialize(strm);
}
void xlsx_table_state::serialize_conditionalFormatting(std::wostream & _Wostream)
void xlsx_table_state::serialize_conditionalFormatting(std::wostream & strm)
{
return xlsx_conditionalFormatting_context_.serialize(_Wostream);
return xlsx_conditionalFormatting_context_.serialize(strm);
}
void xlsx_table_state::dump_rels_hyperlinks(rels & Rels)
{

View File

@ -128,7 +128,8 @@ public:
void serialize_merge_cells (std::wostream & _Wostream);
void serialize_hyperlinks (std::wostream & _Wostream);
void serialize_ole_objects (std::wostream & _Wostream);
void serialize_page_properties (std::wostream & _Wostream);
void dump_rels_hyperlinks (rels & Rels);
void dump_rels_ole_objects (rels & Rels);

View File

@ -317,6 +317,10 @@ void xlsx_table_context::serialize_table_format(std::wostream & _Wostream)
{
return state()->serialize_table_format(_Wostream);
}
void xlsx_table_context::serialize_page_properties(std::wostream & _Wostream)
{
return state()->serialize_page_properties(_Wostream);
}
void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{
return state()->serialize_hyperlinks(_Wostream);

View File

@ -90,6 +90,7 @@ public:
void serialize_conditionalFormatting(std::wostream & _Wostream);
void serialize_hyperlinks (std::wostream & _Wostream);
void serialize_ole_objects (std::wostream & _Wostream);
void serialize_page_properties (std::wostream & _Wostream);
xlsx_table_metrics & get_table_metrics();

View File

@ -317,77 +317,58 @@ void xlsx_text_context::Impl::write_rPr(std::wostream & strm)
ApplyTextProperties (span_style_name_, paragraph_style_name_, text_properties_);
_CP_OPT(double) dValFontSize;
if (text_properties_.fo_font_size_)
dValFontSize=text_properties_.fo_font_size_->get_length().get_value();
_CP_OPT(std::wstring) sValFontFamily;
if (text_properties_.fo_font_family_)
if (in_draw)
{
std::wstring val =text_properties_.fo_font_family_.get();
//'Arial' глючит
removeCharsFromString(val, _T("'"));
sValFontFamily=text_properties_.fo_font_family_.get();
odf_reader::fonts_container fonts;
text_properties_.drawing_serialize(strm, L"a:rPr", fonts);
}
//else if (text_properties_.style_font_name_) - тут может быть отсылка к font_face)decl !!!!
// sValFontFamily=text_properties_.style_font_name_.get();
_CP_OPT(std::wstring) sValFontColor;
if (text_properties_.fo_color_)
sValFontColor=text_properties_.fo_color_->get_hex_value();
_CP_OPT(int) iValFontWeight;
if (text_properties_.fo_font_weight_)
iValFontWeight=text_properties_.fo_font_weight_->get_type();
_CP_OPT(int) iValFontStyle;
if(text_properties_.fo_font_style_)
iValFontStyle=text_properties_.fo_font_style_->get_type();
CP_XML_WRITER(strm)
{
if (in_draw)
{
//oox_serialize_style_text(strm,text_properties_);
//oox_serialize_style_text(strm,odf_reader::text_format_properties_content & properties);
CP_XML_NODE(L"a:rPr")
{
//стр 3197
if (dValFontSize) {CP_XML_ATTR(L"sz", (int)(dValFontSize.get()*100));}
if ((iValFontStyle) && (iValFontStyle.get() >0)) {CP_XML_ATTR(L"i", "1");} //"true");} Exercícios de Aprendizagem.ods
if ((iValFontWeight) && (iValFontWeight.get() >0)) {CP_XML_ATTR(L"b", "1");} //"true");} Exercícios de Aprendizagem.ods
if (sValFontColor)
{
CP_XML_NODE(L"a:solidFill") {CP_XML_NODE(L"a:srgbClr"){CP_XML_ATTR(L"val", sValFontColor.get());}}
}
if (sValFontFamily)
{
CP_XML_NODE(L"a:latin"){CP_XML_ATTR(L"typeface", sValFontFamily.get());}
}
if (hyperlink_hId.length()>0)
{
CP_XML_NODE(L"a:hlinkClick ")
{
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:id", hyperlink_hId);
}
}
}
}
else
else
{
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"rPr")
{
if (sValFontFamily) {CP_XML_NODE(L"rFont") {CP_XML_ATTR(L"val", sValFontFamily.get());}}
if (dValFontSize) {CP_XML_NODE(L"sz") {CP_XML_ATTR(L"val", (int)(dValFontSize.get()));}}
if (sValFontColor) {CP_XML_NODE(L"color") {CP_XML_ATTR(L"rgb", sValFontColor.get());}}
if ((iValFontStyle) &&
(iValFontStyle.get() >0)) {CP_XML_NODE(L"i") {CP_XML_ATTR(L"val", "true");}}
if ((iValFontWeight) &&
(iValFontWeight.get() >0)) {CP_XML_NODE(L"b") {CP_XML_ATTR(L"val", "true");}}
if (text_properties_.fo_font_family_)
{
CP_XML_NODE(L"rFont")
{
CP_XML_ATTR(L"val", text_properties_.fo_font_family_.get());
}
}
if (text_properties_.fo_font_size_)
{
CP_XML_NODE(L"sz")
{
CP_XML_ATTR(L"val", (int)text_properties_.fo_font_size_->get_length().get_value());
}
}
if (text_properties_.fo_color_)
{
CP_XML_NODE(L"color")
{
CP_XML_ATTR(L"rgb", text_properties_.fo_color_->get_hex_value());
}
}
if (text_properties_.fo_font_style_)
{
CP_XML_NODE(L"i")
{
if (text_properties_.fo_font_style_->get_type() > 0)
CP_XML_ATTR(L"val", "true");
else
CP_XML_ATTR(L"val", "false");
}
}
if (text_properties_.fo_font_weight_)
{
CP_XML_NODE(L"b")
{
if (text_properties_.fo_font_weight_->get_type() > 0)
CP_XML_ATTR(L"val", "true");
else
CP_XML_ATTR(L"val", "false");
}
}
}
}
}

View File

@ -54,10 +54,9 @@ class xlsx_conversion_context;
class xlsx_text_context: boost::noncopyable
{
public:
//xlsx_text_context();
xlsx_text_context(odf_reader::styles_container & styles_);
~xlsx_text_context();
public:
xlsx_text_context (odf_reader::styles_container & styles_);
~xlsx_text_context ();
void set_local_styles_container (odf_reader::styles_container *local_styles_);
void set_cell_text_properties (odf_reader::text_format_properties_content *text_properties);

View File

@ -369,6 +369,7 @@ void xlsx_conversion_context::end_table()
current_sheet().cols() << L"</cols>";
get_table_context().serialize_table_format (current_sheet().sheetFormat());
get_table_context().serialize_page_properties (current_sheet().page_properties());
get_table_context().serialize_conditionalFormatting (current_sheet().conditionalFormatting());
get_table_context().serialize_autofilter (current_sheet().autofilter());
get_table_context().serialize_sort (current_sheet().sort());
@ -420,7 +421,7 @@ void xlsx_conversion_context::end_table()
current_sheet().set_comments_link(commentsName.first, commentsName.second);
current_sheet().set_vml_drawing_link(vml_drawingName.first, vml_drawingName.second);
}
//background picture
get_table_context().end_table();
}

View File

@ -161,7 +161,7 @@ style_table_cell_properties_attlist calc_table_cell_properties(const std::vector
BOOST_FOREACH(const style_table_cell_properties* v, props)
{
if (v)
result.apply_from(v->style_table_cell_properties_attlist_);
result.apply_from(v->attlist_);
}
return result;
}

View File

@ -251,7 +251,11 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{L"" ,L"accentBorderCallout3",0 ,0 ,0 },
{L"" ,L"accentBorderCallout2",0 ,0 ,0 },
{L"" ,L"accentBorderCallout1",0 ,0 ,0 },
{L"" ,L"halfFrame" ,0 ,0 ,0 }
{L"" ,L"halfFrame" ,0 ,0 ,0 },
{L"" ,L"leftCircularArrow",0 ,0 ,0 },
{L"" ,L"leftRightRibbon",0 ,0 ,0 },
{L"" ,L"pieWedge",0 ,0 ,0 },
{L"" ,L"swooshArrow",0 ,0 ,0 }
};

View File

@ -200,7 +200,11 @@ double pt_to_cm(double Val)
return Val / 28.34467120181406;
}
double pt_to_mm(double Val)
{
return Val / 2.834467120181406;
}
double to_pt(const length & Val)
{
switch(Val.get_unit())
@ -247,7 +251,11 @@ double length::get_value_unit(unit Unit) const
{
return pt_to_cm( to_pt(*this) );
}
else
else if (Unit == mm)
{
return pt_to_mm( to_pt(*this) );
}
else
{
return 0.0;
}

View File

@ -153,7 +153,7 @@ length ComputeContextWidth(const style_page_layout_properties * pageProperties
if (pagePropertiesNode)
{
if (const style_columns * styleColumns
= dynamic_cast<const style_columns*>( pagePropertiesNode->style_page_layout_properties_elements_.style_columns_.get()))
= dynamic_cast<const style_columns*>( pagePropertiesNode->elements_.style_columns_.get()))
{
columnsCount = styleColumns->fo_column_count_.get_value_or(1);
if (!columnsCount)
@ -784,7 +784,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
style_page_layout_properties_attlist emptyPageProperties;
const style_page_layout_properties_attlist & pageProperties =
pagePropertiesNode ? pagePropertiesNode->style_page_layout_properties_attlist_ : emptyPageProperties;
pagePropertiesNode ? pagePropertiesNode->attlist_ : emptyPageProperties;
/////////////////////////////////////////////////////////////////////////////////////////////

View File

@ -163,10 +163,10 @@ void draw_line::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
void draw_line::reset_svg_attributes()
{
double x1=draw_line_attlist_.svg_x1_.get_value_or(length(0)).get_value_unit(length::pt);
double y1=draw_line_attlist_.svg_y1_.get_value_or(length(0)).get_value_unit(length::pt);
double x2=draw_line_attlist_.svg_x2_.get_value_or(length(0)).get_value_unit(length::pt);
double y2=draw_line_attlist_.svg_y2_.get_value_or(length(0)).get_value_unit(length::pt);
double x1 = draw_line_attlist_.svg_x1_.get_value_or(length(0)).get_value_unit(length::pt);
double y1 = draw_line_attlist_.svg_y1_.get_value_or(length(0)).get_value_unit(length::pt);
double x2 = draw_line_attlist_.svg_x2_.get_value_or(length(0)).get_value_unit(length::pt);
double y2 = draw_line_attlist_.svg_y2_.get_value_or(length(0)).get_value_unit(length::pt);
if (x1 > x2)
{
@ -431,8 +431,8 @@ void draw_equation::add_attributes( const xml::attributes_wc_ptr & Attributes )
}
int draw_enhanced_geometry::parsing(_CP_OPT(std::wstring) val)
{
int pos=0, res=-1;
if (!val)return res;
int pos = 0, res = -1;
if (!val) return res;
BOOST_FOREACH(wchar_t c, val.get())
{
@ -533,12 +533,12 @@ void draw_enhanced_geometry::find_draw_type_oox()
}
else
{
bOoxType_ = true;
std::wstring oox_type = odf_type.substr(pos + 6);
for (long i = 0; i< count; i++)
{
if (_OO_OOX_custom_shapes[i].oox == oox_type)
{
bOoxType_ = true;
draw_type_oox_index_ = i;
break;
}
@ -550,38 +550,36 @@ void draw_enhanced_geometry::find_draw_type_oox()
}
}
}
std::wstringstream str;
// for (size_t i = 0; i < draw_handle_.size(); i++)
// {
//draw_handle * handle = dynamic_cast<draw_handle *>(draw_handle_[i].get());
//if (!handle) continue;
for (size_t i = 0; i < draw_handle_.size(); i++)
{
draw_handle * handle = dynamic_cast<draw_handle *>(draw_handle_[i].get());
if (!handle) continue;
//int min = -1, max = -1;
//
//try
//{
// min = parsing(handle->draw_handle_attlist_.draw_handle_range_y_minimum_);//пока статик .. и выдается только цыфровое значение
// if (min < 0) min = parsing(handle->draw_handle_attlist_.draw_handle_range_x_minimum_);
// if (min < 0) min = parsing(handle->draw_handle_attlist_.draw_handle_radius_range_minimum_);
//}
//catch(...)
//{
//}
//if (min < 0 ) min=0;
int min = -1, max = -1;
try
{
min = parsing(handle->draw_handle_attlist_.draw_handle_range_y_minimum_);//пока статик .. и выдается только цыфровое значение
if (min < 0) min = parsing(handle->draw_handle_attlist_.draw_handle_range_x_minimum_);
if (min < 0) min = parsing(handle->draw_handle_attlist_.draw_handle_radius_range_minimum_);
}
catch(...)
{
}
if (min < 0 ) min=0;
try
{
max = parsing(handle->draw_handle_attlist_.draw_handle_range_y_maximum_);
if (max < 0) max = parsing(handle->draw_handle_attlist_.draw_handle_range_x_maximum_);
if (max < 0) max = parsing(handle->draw_handle_attlist_.draw_handle_radius_range_maximum_);
}
catch(...)
{
}
draw_handle_geometry elm = {min, max};
draw_handle_geometry_.push_back(elm);
}
//try
//{
// max = parsing(handle->draw_handle_attlist_.draw_handle_range_y_maximum_);
// if (max < 0) max = parsing(handle->draw_handle_attlist_.draw_handle_range_x_maximum_);
// if (max < 0) max = parsing(handle->draw_handle_attlist_.draw_handle_radius_range_maximum_);
//}
//catch(...)
//{
//}
//draw_handle_geometry elm = {min, max};
//draw_handle_geometry_.push_back(elm);
// }
}
////////////////////////////////////////////////////////////////////////////////////////////////////
/// draw-caption-attlist

View File

@ -246,7 +246,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
if (draw_type_oox_index_)
{
shape->additional_.push_back(_property(L"odf-custom-draw-index", draw_type_oox_index_.get()));
shape->additional_.push_back(_property(L"oox-geom-index", draw_type_oox_index_.get()));
shape->additional_.push_back(_property(L"oox-geom", bOoxType_));
if (shape->word_art_ == true)
shape->additional_.push_back(_property(L"wordArt", true));
@ -259,7 +260,7 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
shape->sub_type_ = sub_type_.get();
set_shape = true;
}
std::wstring odf_path;
std::wstring odf_path; //общая часть - объединить ...
if (draw_enhanced_geometry_attlist_.drawooo_enhanced_path_)
odf_path = draw_enhanced_geometry_attlist_.drawooo_enhanced_path_.get();
else if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
@ -280,7 +281,7 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
res = false;
}
if (o_Polyline.size() > 1 && res )
if (!o_Polyline.empty() && res )
{
//сформируем xml-oox сдесь ... а то придется плодить массивы в drawing .. хоть и не красиво..
std::wstringstream output_;
@ -317,14 +318,10 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
if (draw_enhanced_geometry_attlist_.draw_modifiers_)
{
shape->additional_.push_back(_property(L"draw-modifiers",draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
if (draw_handle_geometry_.size()>0)
if (bOoxType_)
shape->additional_.push_back(_property(L"oox-draw-modifiers", draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
else
{
if (draw_handle_geometry_[0].min < draw_handle_geometry_[0].max)
{
shape->additional_.push_back(_property(L"draw-modifiers-min", draw_handle_geometry_[0].min));
shape->additional_.push_back(_property(L"draw-modifiers-max", draw_handle_geometry_[0].max));
}
}
}

View File

@ -312,8 +312,9 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
if (draw_type_oox_index_)
{
Context.get_slide_context().set_property(_property(L"odf-custom-draw-index", draw_type_oox_index_.get()));
Context.get_slide_context().set_property(_property(L"oox-geom-index", draw_type_oox_index_.get()));
Context.get_slide_context().set_property(_property(L"oox-geom", bOoxType_));
if (word_art_ == true)
Context.get_slide_context().set_property(_property(L"wordArt", true));
@ -325,7 +326,13 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
set_shape = true;
}
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
std::wstring odf_path;
if (draw_enhanced_geometry_attlist_.drawooo_enhanced_path_)
odf_path = draw_enhanced_geometry_attlist_.drawooo_enhanced_path_.get();
else if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
odf_path = draw_enhanced_geometry_attlist_.draw_enhanced_path_.get();
if (!odf_path.empty())
{
std::vector<::svg_path::_polyline> o_Polyline;
@ -333,7 +340,7 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
try
{
res = ::svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true);
}
catch(...)
{
@ -375,16 +382,20 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
}
if (draw_enhanced_geometry_attlist_.draw_modifiers_)
{
Context.get_slide_context().set_property(_property(L"draw-modifiers",draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
if (draw_handle_geometry_.size()>0)
if (bOoxType_)
Context.get_slide_context().set_property(_property(L"oox-draw-modifiers", draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
else
{
if (draw_handle_geometry_[0].min < draw_handle_geometry_[0].max)
{
Context.get_slide_context().set_property(_property(L"draw-modifiers-min",draw_handle_geometry_[0].min));
Context.get_slide_context().set_property(_property(L"draw-modifiers-max",draw_handle_geometry_[0].max));
}
}
//if (draw_handle_geometry_.size()>0)
//{
// if (draw_handle_geometry_[0].min < draw_handle_geometry_[0].max)
// {
// Context.get_slide_context().set_property(_property(L"draw-modifiers-min",draw_handle_geometry_[0].min));
// Context.get_slide_context().set_property(_property(L"draw-modifiers-max",draw_handle_geometry_[0].max));
// }
//}
}
if (!set_shape)
{

View File

@ -258,7 +258,8 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
if (draw_type_oox_index_)
{
Context.get_drawing_context().set_property(_property(L"odf-custom-draw-index", draw_type_oox_index_.get()));
Context.get_drawing_context().set_property(_property(L"oox-geom-index", draw_type_oox_index_.get()));
Context.get_drawing_context().set_property(_property(L"oox-geom", bOoxType_));
if (word_art_ == true)
Context.get_drawing_context().set_property(_property(L"wordArt", true));
@ -269,7 +270,13 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
Context.get_drawing_context().start_shape(sub_type_.get());
}
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
std::wstring odf_path;
if (draw_enhanced_geometry_attlist_.drawooo_enhanced_path_)
odf_path = draw_enhanced_geometry_attlist_.drawooo_enhanced_path_.get();
else if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
odf_path = draw_enhanced_geometry_attlist_.draw_enhanced_path_.get();
if (!odf_path.empty())
{
std::vector<::svg_path::_polyline> o_Polyline;
@ -277,7 +284,7 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
try
{
res = ::svg_path::parseSvgD(o_Polyline, draw_enhanced_geometry_attlist_.draw_enhanced_path_.get(), true);
res = ::svg_path::parseSvgD(o_Polyline, odf_path, true);
}
catch(...)
{
@ -321,15 +328,10 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
}
if (draw_enhanced_geometry_attlist_.draw_modifiers_)
{
Context.get_drawing_context().set_property(_property(L"draw-modifiers",draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
if (draw_handle_geometry_.size()>0)
if (bOoxType_)
Context.get_drawing_context().set_property(_property(L"oox-draw-modifiers", draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
else
{
if (draw_handle_geometry_[0].min < draw_handle_geometry_[0].max)
{
Context.get_drawing_context().set_property(_property(L"draw-modifiers-min",draw_handle_geometry_[0].min));
Context.get_drawing_context().set_property(_property(L"draw-modifiers-max",draw_handle_geometry_[0].max));
}
}
}
}

View File

@ -292,7 +292,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
{
CP_XML_NODE(L"m:ctrlPr")
{
Context.text_properties_->content().oox_convert(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
}
}
}
@ -317,7 +317,7 @@ void math_mstyle::oox_convert(oox::math_context & Context)
{
CP_XML_NODE(L"m:ctrlPr")
{
Context.text_properties_->content().oox_convert(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
}
}
}

View File

@ -114,7 +114,7 @@ void math_mi::oox_convert(oox::math_context & Context)
}
}
Context.text_properties_->content().oox_convert(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
CP_XML_NODE(L"m:t")
{
@ -162,7 +162,7 @@ void math_mo::oox_convert(oox::math_context & Context)
{
// + доп стили текста ... todoooo
Context.text_properties_->content().oox_convert(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
CP_XML_NODE(L"m:t")
{
@ -203,7 +203,7 @@ void math_mn::oox_convert(oox::math_context & Context)
{
// + доп стили текста ... todoooo
Context.text_properties_->content().oox_convert(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
Context.text_properties_->content().oox_serialize(CP_XML_STREAM(), Context.graphRPR_, Context.fonts_container_);
CP_XML_NODE(L"m:t")
{

View File

@ -462,8 +462,8 @@ void odf_document::Impl::parse_styles()
continue;
}
const std::wstring styleName = masterPage->style_master_page_attlist_.style_name_.get_value_or(L"");
const std::wstring pageLayoutName = masterPage->style_master_page_attlist_.style_page_layout_name_.get_value_or(L"");
const std::wstring styleName = masterPage->attlist_.style_name_.get_value_or(L"");
const std::wstring pageLayoutName = masterPage->attlist_.style_page_layout_name_.get_value_or(L"");
context_->pageLayoutContainer().add_master_page(styleName, pageLayoutName, masterPage);
}

View File

@ -40,23 +40,24 @@ namespace cpdoccore {
namespace odf_reader {
style_instance::style_instance(
styles_container *Container,
const std::wstring &Name,
style_family::type Type,
style_content *Content,
bool IsAutomatic,
bool IsDefault,
const std::wstring & ParentStyleName,
const std::wstring & NextStyleName,
const std::wstring & DataStyleName
) : container_(Container),
name_(Name),
style_type_(Type),
content_(Content),
is_automatic_(IsAutomatic),
is_default_(IsDefault),
next_name_(NextStyleName),
next_(Container->style_by_name(NextStyleName, style_type_,false)),
styles_container *Container,
const std::wstring &Name,
style_family::type Type,
style_content *Content,
bool IsAutomatic,
bool IsDefault,
const std::wstring & ParentStyleName,
const std::wstring & NextStyleName,
const std::wstring & DataStyleName
) :
container_ (Container),
name_ (Name),
style_type_ (Type),
content_ (Content),
is_automatic_ (IsAutomatic),
is_default_ (IsDefault),
next_name_ (NextStyleName),
next_ (Container->style_by_name(NextStyleName, style_type_, false)),
data_style_name_(DataStyleName)
{
parent_name_ = ParentStyleName;
@ -64,8 +65,7 @@ style_instance::style_instance(
{
parent_name_ = L"Standard";
}
parent_ = Container->style_by_name(parent_name_, style_type_,false);
parent_ = Container->style_by_name(parent_name_, style_type_, false);
}
style_instance * styles_container::hyperlink_style()
@ -325,6 +325,13 @@ style_page_layout_properties * page_layout_instance::properties() const
return dynamic_cast<style_page_layout_properties *>(style_page_layout_->style_page_layout_properties_.get());
}
void page_layout_instance::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
{
style_page_layout_properties * props = properties();
if (props)
props->xlsx_serialize(strm, Context);
}
void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
{
const style_header_style * headerStyle = dynamic_cast<style_header_style *>(style_page_layout_->style_header_style_.get());
@ -348,8 +355,10 @@ void page_layout_instance::docx_convert_serialize(std::wostream & strm, oox::doc
_CP_OPT(length) bottom = attr.fo_min_height_ ? attr.fo_min_height_ : attr.svg_height_;
Context.get_header_footer_context().set_footer(bottom);
}
properties()->docx_convert_serialize(strm, Context);
style_page_layout_properties * props = properties();
if (props)
props->docx_convert_serialize(strm, Context);
}
void page_layout_instance::pptx_convert(oox::pptx_conversion_context & Context)
{

View File

@ -193,8 +193,9 @@ public:
const std::wstring & name() const;
style_page_layout_properties * properties() const;
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
void xlsx_serialize (std::wostream & strm, oox::xlsx_conversion_context & Context);
void pptx_convert (oox::pptx_conversion_context & Context);
const style_page_layout * style_page_layout_;

View File

@ -98,7 +98,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
std::vector<style_master_page*> & masterPages = Context.root()->odf_context().pageLayoutContainer().master_pages();
if (!masterPages.empty())
{
Context.set_master_page_name(masterPages[0]->style_master_page_attlist_.style_name_.get_value_or(L"Standard"));
Context.set_master_page_name(masterPages[0]->attlist_.style_name_.get_value_or(L"Standard"));
}
const page_layout_instance * layout = Context.root()->odf_context().pageLayoutContainer().page_layout_first();
@ -116,15 +116,15 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
//background (for all pages)
if (page_layout_instance * firtsPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
{
if (style_page_layout_properties * prop = firtsPageLayout->properties())
if (style_page_layout_properties * layout_properties = firtsPageLayout->properties())
{
oox::_oox_fill fill;
Compute_GraphicFill(prop->style_page_layout_properties_attlist_.common_draw_fill_attlist_,
prop->style_page_layout_properties_elements_.style_background_image_,
Compute_GraphicFill(layout_properties->attlist_.common_draw_fill_attlist_,
layout_properties->elements_.style_background_image_,
Context.root()->odf_context().drawStyles(), fill);
if (prop->style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ || fill.type != 0)
if (layout_properties->attlist_.common_background_color_attlist_.fo_background_color_ || fill.type != 0)
{
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
{
@ -132,7 +132,7 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, fill.bitmap->isInternal, href);
}
int id = Context.get_drawing_context().get_current_shape_id();
if (prop->docx_background_serialize(Context.output_stream(), Context, fill, id))
if (layout_properties->docx_background_serialize(Context.output_stream(), Context, fill, id))
{
Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape", true));
}

View File

@ -225,7 +225,7 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
{
CP_XML_NODE(L"a:spcBef")
{
if (fo_margin_bottom_->get_type() == length_or_percent::Length)
if (fo_margin_top_->get_type() == length_or_percent::Length)
{
std::wstring w_before = pptx_process_margin(fo_margin_top_, length::pt, 100.0);
CP_XML_NODE(L"a:spcPts")
@ -235,11 +235,10 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
}
else
{
std::wstringstream s;
s << fo_margin_top_;
double pct = fo_margin_top_->get_percent().get_value();
CP_XML_NODE(L"a:spcPct")
{
CP_XML_ATTR(L"val", s.str());
CP_XML_ATTR(L"val", (int)(pct * 1000));
}
}
}
@ -258,11 +257,11 @@ void paragraph_format_properties::xlsx_convert(std::wostream & strm, bool in_dra
}
else
{
std::wstringstream s;
s << fo_margin_bottom_;
double pct = fo_margin_bottom_->get_percent().get_value();
CP_XML_NODE(L"a:spcPct")
{
CP_XML_ATTR(L"val", s.str());
CP_XML_ATTR(L"val", (int)(pct * 1000));
}
}
}
@ -468,11 +467,11 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
}
else
{
std::wstringstream s;
s << fo_margin_top_;
double pct = fo_margin_top_->get_percent().get_value();
CP_XML_NODE(L"a:spcPct")
{
CP_XML_ATTR(L"val", s.str());
CP_XML_ATTR(L"val", (int)(pct * 1000));
}
}
}
@ -491,11 +490,11 @@ void paragraph_format_properties::pptx_convert(oox::pptx_conversion_context & Co
}
else
{
std::wstringstream s;
s << fo_margin_bottom_;
double pct = fo_margin_bottom_->get_percent().get_value();
CP_XML_NODE(L"a:spcPct")
{
CP_XML_ATTR(L"val", s.str());
CP_XML_ATTR(L"val", (int)(pct * 1000));
}
}
}

View File

@ -155,17 +155,17 @@ const wchar_t * style_table_properties::name = L"table-properties";
void style_table_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
table_format_properties_.add_attributes(Attributes);
content_.add_attributes(Attributes);
}
void style_table_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
table_format_properties_.add_child_element(Reader, Ns, Name, getContext());
content_.add_child_element(Reader, Ns, Name, getContext());
}
void style_table_properties::docx_convert(oox::docx_conversion_context & Context)
{
table_format_properties_.docx_convert(Context);
content_.docx_convert(Context);
}
// style-table-column-properties-attlist
@ -186,7 +186,7 @@ const wchar_t * style_table_column_properties::name = L"table-column-properties"
void style_table_column_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
style_table_column_properties_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void style_table_column_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -199,14 +199,14 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
std::wostream & strm = Context.output_stream();
if (style_table_column_properties_attlist_.style_column_width_)
if (attlist_.style_column_width_)
{
double kf_max_width_ms =1.;
const page_layout_instance * pp = Context.root()->odf_context().pageLayoutContainer().page_layout_first();//
if (pp)
{
style_page_layout_properties_attlist & attr_page = pp->properties()->style_page_layout_properties_attlist_;
style_page_layout_properties_attlist & attr_page = pp->properties()->attlist_;
if (attr_page.fo_page_width_)
{
int val = 0.5 + 20.0 * attr_page.fo_page_width_->get_value_unit(length::pt);
@ -215,7 +215,7 @@ void style_table_column_properties::docx_convert(oox::docx_conversion_context &
}
}
int val = style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::pt);
int val = attlist_.style_column_width_->get_value_unit(length::pt);
//_CP_OPT(int) iUnormalWidth;
@ -236,9 +236,9 @@ void style_table_column_properties::pptx_convert(oox::pptx_conversion_context &
std::wostream & strm = Context.get_table_context().tableData();
if (style_table_column_properties_attlist_.style_column_width_)
if (attlist_.style_column_width_)
{
int val = style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::emu);
int val = attlist_.style_column_width_->get_value_unit(length::emu);
strm << L"<a:gridCol w=\"" << val << "\"/>";
}
@ -289,7 +289,7 @@ const wchar_t * style_table_cell_properties::name = L"table-cell-properties";
void style_table_cell_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
style_table_cell_properties_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void style_table_cell_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -351,7 +351,7 @@ const wchar_t * style_table_row_properties::name = L"table-row-properties";
void style_table_row_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
style_table_row_properties_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void style_table_row_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -368,7 +368,7 @@ void style_table_row_properties::add_child_element( xml::sax * Reader, const std
void style_table_row_properties::docx_convert(oox::docx_conversion_context & Context)
{
style_table_row_properties_attlist_.docx_convert(Context);
attlist_.docx_convert(Context);
}
/////
@ -654,7 +654,7 @@ void style_table_cell_properties_attlist::pptx_serialize(oox::pptx_conversion_co
void style_table_cell_properties::docx_convert(oox::docx_conversion_context & Context)
{
style_table_cell_properties_attlist_.docx_convert(Context);
attlist_.docx_convert(Context);
}
void style_table_cell_properties_attlist::apply_from(const style_table_cell_properties_attlist & Other)

View File

@ -89,7 +89,6 @@ public:
};
/// style:table-properties
class style_table_properties : public office_element_impl<style_table_properties>
{
public:
@ -101,19 +100,17 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
virtual void docx_convert(oox::docx_conversion_context & Context) ;
table_format_properties & content() {return table_format_properties_;}
table_format_properties & content() {return content_;}
private:
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
table_format_properties table_format_properties_;
table_format_properties content_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_table_properties);
// style-table-column-properties-attlist
class style_table_column_properties_attlist
{
public:
@ -126,7 +123,6 @@ public:
};
/// style:table-column-properties
class style_table_column_properties : public office_element_impl<style_table_column_properties>
{
public:
@ -146,13 +142,12 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
style_table_column_properties_attlist style_table_column_properties_attlist_;
style_table_column_properties_attlist attlist_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_table_column_properties);
// style-table-row-properties-attlist
class style_table_row_properties_attlist
{
public:
@ -161,7 +156,6 @@ public:
void docx_convert(oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
public:
_CP_OPT(odf_types::length) style_row_height_;
_CP_OPT(odf_types::length) style_min_row_height_;
_CP_OPT(bool) style_use_optimal_row_height_;
@ -171,7 +165,6 @@ public:
};
/// style:table-row-properties
class style_table_row_properties : public office_element_impl<style_table_row_properties>
{
public:
@ -189,14 +182,13 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
style_table_row_properties_attlist style_table_row_properties_attlist_;
style_table_row_properties_attlist attlist_;
office_element_ptr style_background_image_;
};
CP_REGISTER_OFFICE_ELEMENT2(style_table_row_properties);
// style-table-cell-properties-attlist
class style_table_cell_properties_attlist
{
public:
@ -207,7 +199,6 @@ public:
void apply_from(const style_table_cell_properties_attlist & Other);
public:
odf_types::common_shadow_attlist common_shadow_attlist_;
odf_types::common_background_color_attlist common_background_color_attlist_;
odf_types::common_border_attlist common_border_attlist_;
@ -227,26 +218,21 @@ public:
_CP_OPT(std::wstring) style_cell_protect_;
_CP_OPT(bool) style_print_content_;
_CP_OPT(unsigned int) style_decimal_places_;
_CP_OPT(bool) style_repeat_content_;
_CP_OPT(bool) style_shrink_to_fit_;
_CP_OPT(bool) style_repeat_content_;
_CP_OPT(bool) style_shrink_to_fit_;
_CP_OPT(odf_types::wrap_option) fo_wrap_option_;
};
// style-table-cell-properties-elements
class style_table_cell_properties_elements
{
public:
void add_attributes( const xml::attributes_wc_ptr & Attributes );
private:
// 15.11.6
office_element_ptr style_background_image_;
};
/// style:table-cell-properties
class style_table_cell_properties : public office_element_impl<style_table_cell_properties>
{
public:
@ -264,8 +250,8 @@ private:
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
public:
style_table_cell_properties_attlist style_table_cell_properties_attlist_;
office_element_ptr style_background_image_;
style_table_cell_properties_attlist attlist_;
office_element_ptr style_background_image_;
};

File diff suppressed because it is too large Load Diff

View File

@ -80,7 +80,9 @@ public:
void pptx_convert (oox::pptx_conversion_context & Context);
void pptx_convert_as_list (oox::pptx_conversion_context & Context);
void oox_convert (std::wostream & stream, bool graphic, fonts_container & fonts);
void oox_serialize (std::wostream & stream, bool graphic, fonts_container & fonts);
void docx_serialize (std::wostream & stream, fonts_container & fonts);
void drawing_serialize (std::wostream & stream, std::wstring node, fonts_container & fonts, const odf_reader::style_instance *current_style = NULL, std::wstring hlink = L"");
void apply_from (const text_format_properties_content & Other);
void apply_to (std::vector<_property> & properties);

View File

@ -722,7 +722,6 @@ void style_footer_left::add_child_element( xml::sax * Reader, const std::wstring
content().header_footer_content_.add_child_element(Reader, Ns, Name, getContext());
}
/// style:columns
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_columns::ns = L"style";
const wchar_t * style_columns::name = L"columns";
@ -745,7 +744,6 @@ void style_columns::add_child_element( xml::sax * Reader, const std::wstring & N
}
}
/// style:column
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_column::ns = L"style";
const wchar_t * style_column::name = L"column";
@ -765,7 +763,6 @@ void style_column::add_child_element( xml::sax * Reader, const std::wstring & Ns
CP_NOT_APPLICABLE_ELM();
}
/// style:column-sep
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_column_sep::ns = L"style";
const wchar_t * style_column_sep::name = L":column-sep";
@ -784,8 +781,6 @@ void style_column_sep::add_child_element( xml::sax * Reader, const std::wstring
CP_NOT_APPLICABLE_ELM();
}
/// style:section-properties
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_section_properties::ns = L"style";
const wchar_t * style_section_properties::name = L"section-properties";
@ -811,7 +806,6 @@ void style_section_properties::add_child_element( xml::sax * Reader, const std::
}
}
/// style:header-style
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_header_style::ns = L"style";
const wchar_t * style_header_style::name = L"header-style";
@ -837,7 +831,6 @@ void style_header_style::add_child_element( xml::sax * Reader, const std::wstrin
}
}
/// style:footer-style
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_footer_style::ns = L"style";
const wchar_t * style_footer_style::name = L"footer-style";
@ -863,15 +856,12 @@ void style_footer_style::add_child_element( xml::sax * Reader, const std::wstrin
}
}
/// style-page-layout-attlist
void style_page_layout_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:name", style_name_, std::wstring(L""));
CP_APPLY_ATTR(L"style:page-usage", style_page_usage_, page_usage(page_usage::All));
}
/// style:page-layout
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * style_page_layout::ns = L"style";
const wchar_t * style_page_layout::name = L"page-layout";
@ -906,16 +896,15 @@ void style_page_layout::add_child_element( xml::sax * Reader, const std::wstring
}
}
// style-page-layout-properties-attlist
void style_page_layout_properties_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"fo:page-width", fo_page_width_);
CP_APPLY_ATTR(L"fo:page-height", fo_page_height_);
common_num_format_attlist_.add_attributes(Attributes);
common_num_format_prefix_suffix_attlist_.add_attributes(Attributes);
CP_APPLY_ATTR(L"style:paper-tray-name", style_paper_tray_name_);
CP_APPLY_ATTR(L"style:print-orientation", style_print_orientation_);
common_num_format_attlist_.add_attributes(Attributes);
common_num_format_prefix_suffix_attlist_.add_attributes(Attributes);
common_horizontal_margin_attlist_.add_attributes(Attributes);
common_vertical_margin_attlist_.add_attributes(Attributes);
common_margin_attlist_.add_attributes(Attributes);
@ -947,34 +936,6 @@ void style_page_layout_properties_attlist::add_attributes( const xml::attributes
CP_APPLY_ATTR(L"style:layout-grid-display", style_layout_grid_display_);
}
/*
Choice [0..6]
[ ] w:headerReference Header Reference
[ ] w:footerReference Footer Reference
[ ] from group w:EG_SectPrContents
[ ] Sequence
[ ] w:footnotePr Section-Wide Footnote Properties
[ ] w:endnotePr Section-Wide Endnote Properties
[ ] w:type Section Type
[x] w:pgSz Page Size
[ ] w:pgMar Page Margins
[ ] w:paperSrc Paper Source Information
[ ] w:pgBorders Page Borders
[ ] w:lnNumType Line Numbering Settings
[ ] w:pgNumType Page Numbering Settings
[ ] w:cols Column Definitions
[ ] w:formProt Only Allow Editing of Form Fields
[ ] w:vAlign Vertical Text Alignment on Page
[ ] w:noEndnote Suppress Endnotes In Document
[ ] w:titlePg Different First Page Headers and Footers
[ ] w:textDirection Text Flow Direction
[ ] w:bidi Right to Left Section Layout
[ ] w:rtlGutter Gutter on Right Side of Page
[ ] w:docGrid Document Grid
[ ] w:printerSettings Reference to Printer Settings Data
[ ] w:sectPrChange Revision Information for Section Properties
*/
namespace {
std::wstring process_page_margin(const _CP_OPT(length_or_percent) & Val,
@ -1012,7 +973,7 @@ void style_page_layout_properties_attlist::docx_convert_serialize(std::wostream
//Context.set_settings_property(odf_reader::_property(L"UnormalWidthPage",val));
val =31680;//22"
}
w_w = boost::lexical_cast<std::wstring>(val);
w_w = std::to_wstring(val);
}
if (fo_page_height_)
{
@ -1199,7 +1160,7 @@ void style_page_layout_properties_attlist::pptx_convert(oox::pptx_conversion_con
h = fo_page_height_->get_value_unit(length::emu);
if (h < 914400) h = 914400;
w_h = boost::lexical_cast<std::wstring>(h);
w_h = std::to_wstring(h);
}
std::wstring w_orient = L"custom";
@ -1259,18 +1220,18 @@ const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
void style_page_layout_properties::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
style_page_layout_properties_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void style_page_layout_properties::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
{
style_page_layout_properties_elements_.add_child_element(Reader, Ns, Name, getContext());
elements_.add_child_element(Reader, Ns, Name, getContext());
}
bool style_page_layout_properties::docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id)
{
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ &&
style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_type() == background_color::Transparent)
if (attlist_.common_background_color_attlist_.fo_background_color_ &&
attlist_.common_background_color_attlist_.fo_background_color_->get_type() == background_color::Transparent)
return true; //??
//прозрачный фон
@ -1280,8 +1241,8 @@ bool style_page_layout_properties::docx_background_serialize(std::wostream & str
{
std::wstring color = L"ffffff";
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_)
color = style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
if (attlist_.common_background_color_attlist_.fo_background_color_)
color = attlist_.common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
CP_XML_ATTR(L"w:color", color);
@ -1290,9 +1251,91 @@ bool style_page_layout_properties::docx_background_serialize(std::wostream & str
}
return true;
}
void style_page_layout_properties::xlsx_convert(oox::xlsx_conversion_context & Context)
{
}
void style_page_layout_properties::xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context)
{
CP_XML_WRITER(strm)
{
odf_types::common_horizontal_margin_attlist horizontal_margins = attlist_.common_horizontal_margin_attlist_;
odf_types::common_vertical_margin_attlist vertical_margins = attlist_.common_vertical_margin_attlist_;
if (horizontal_margins.fo_margin_left_ || horizontal_margins.fo_margin_right_ ||
vertical_margins.fo_margin_top_ || vertical_margins.fo_margin_bottom_ )
{
//_CP_OPT(odf_types::length) margin_top, margin_bottom;
//margin_top = Context.get_header_footer_context().header();
//margin_bottom = Context.get_header_footer_context().footer();
CP_XML_NODE(L"pageMargins")
{
if (horizontal_margins.fo_margin_left_ && horizontal_margins.fo_margin_left_->get_type() == odf_types::length_or_percent::Length)
CP_XML_ATTR(L"left" , horizontal_margins.fo_margin_left_->get_length().get_value_unit(odf_types::length::inch));
if (horizontal_margins.fo_margin_right_ && horizontal_margins.fo_margin_right_->get_type() == odf_types::length_or_percent::Length)
CP_XML_ATTR(L"right" , horizontal_margins.fo_margin_right_->get_length().get_value_unit(odf_types::length::inch));
if (vertical_margins.fo_margin_top_ && vertical_margins.fo_margin_top_->get_type() == odf_types::length_or_percent::Length)
CP_XML_ATTR(L"top" , vertical_margins.fo_margin_top_->get_length().get_value_unit(odf_types::length::inch));
if (vertical_margins.fo_margin_bottom_ && vertical_margins.fo_margin_bottom_->get_type() == odf_types::length_or_percent::Length)
CP_XML_ATTR(L"bottom" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
CP_XML_ATTR(L"header" , vertical_margins.fo_margin_top_->get_length().get_value_unit(odf_types::length::inch));
CP_XML_ATTR(L"footer" , vertical_margins.fo_margin_bottom_->get_length().get_value_unit(odf_types::length::inch));
}
}
if (attlist_.fo_page_width_ || attlist_.fo_page_height_ || attlist_.style_print_orientation_)
{
CP_XML_NODE(L"pageSetup")
{
double h = 0, w = 0;
if (attlist_.fo_page_width_)
{
w = attlist_.fo_page_width_->get_value_unit(length::mm);
CP_XML_ATTR(L"paperWidth", (int)w);
}
if (attlist_.fo_page_height_)
{
h = attlist_.fo_page_height_->get_value_unit(length::mm);
CP_XML_ATTR(L"paperHeight", (int)h);
}
CP_XML_ATTR(L"paperUnits", L"mm");
if (attlist_.style_print_orientation_)
{
CP_XML_ATTR(L"orientation", *attlist_.style_print_orientation_);
}
}
}
if (elements_.style_background_image_)
{
oox::_oox_fill fill;
Compute_GraphicFill(attlist_.common_draw_fill_attlist_, elements_.style_background_image_, Context.root()->odf_context().drawStyles(), fill);
if (fill.bitmap)
{
if ( fill.bitmap->rId.empty())
{
std::wstring href = fill.bitmap->xlink_href_;
fill.bitmap->rId = Context.get_mediaitems().add_or_find(href, oox::typeImage, fill.bitmap->isInternal, href);
Context.get_drawing_context().get_drawings()->add(fill.bitmap->isInternal, fill.bitmap->rId, href, oox::typeImage, true);
}
CP_XML_NODE(L"picture")
{
CP_XML_ATTR(L"r:id", fill.bitmap->rId );
}
}
}
}
}
void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
{
style_columns * columns = dynamic_cast<style_columns *>( style_page_layout_properties_elements_.style_columns_.get());
style_columns * columns = dynamic_cast<style_columns *>( elements_.style_columns_.get());
CP_XML_WRITER(strm)
{
@ -1325,14 +1368,14 @@ void style_page_layout_properties::docx_convert_serialize(std::wostream & strm,
oox::section_context::_section & section = Context.get_section_context().get();
style_page_layout_properties_attlist_.docx_convert_serialize(strm, Context, section.margin_left_, section.margin_right_);
attlist_.docx_convert_serialize(strm, Context, section.margin_left_, section.margin_right_);
//todooo при появлении еще накладок - переписать !!
}
}
}
void style_page_layout_properties::pptx_convert(oox::pptx_conversion_context & Context)
{
style_page_layout_properties_attlist_.pptx_convert(Context);
attlist_.pptx_convert(Context);
}
@ -1363,10 +1406,10 @@ void style_page_layout_properties_elements::add_child_element( xml::sax * Reader
//////////////////////////////////////////////////////////////////////////////////////////////////
void style_master_page_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:name", style_name_);
CP_APPLY_ATTR(L"style:display-name", style_display_name_);
CP_APPLY_ATTR(L"style:page-layout-name", style_page_layout_name_);
CP_APPLY_ATTR(L"draw:style-name", draw_style_name_);
CP_APPLY_ATTR(L"style:name", style_name_);
CP_APPLY_ATTR(L"style:display-name", style_display_name_);
CP_APPLY_ATTR(L"style:page-layout-name",style_page_layout_name_);
CP_APPLY_ATTR(L"draw:style-name", draw_style_name_);
CP_APPLY_ATTR(L"style:next-style-name", style_next_style_name_);
}
@ -1382,7 +1425,7 @@ std::wostream & style_master_page::text_to_stream(std::wostream & _Wostream) con
void style_master_page::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
style_master_page_attlist_.add_attributes(Attributes);
attlist_.add_attributes(Attributes);
}
void style_master_page::add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name)
@ -1457,9 +1500,9 @@ int style_master_page::find_placeHolderIndex(presentation_class::type placeHolde
void style_master_page::pptx_convert(oox::pptx_conversion_context & Context)
{
if (style_master_page_attlist_.draw_style_name_)
if (attlist_.draw_style_name_)
{
std::wstring style_name = style_master_page_attlist_.draw_style_name_.get();
std::wstring style_name = attlist_.draw_style_name_.get();
style_instance * style_inst = Context.root()->odf_context().styleContainer().style_by_name(style_name,style_family::DrawingPage,true);
if ((style_inst) && (style_inst->content()))

View File

@ -442,7 +442,6 @@ public:
_CP_OPT(std::wstring) style_next_style_name_;
};
// style:master-page
class style_master_page;
typedef boost::shared_ptr<style_master_page> style_master_page_ptr;
@ -465,7 +464,7 @@ private:
public:
int find_placeHolderIndex(odf_types::presentation_class::type placeHolder,int & last_idx);
style_master_page_attlist style_master_page_attlist_;
style_master_page_attlist attlist_;
office_element_ptr style_header_;
office_element_ptr style_header_left_;
@ -975,15 +974,17 @@ public:
static const ElementType type = typeStylePageLayout;
CPDOCCORE_DEFINE_VISITABLE();
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context);
void docx_convert_serialize (std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert (oox::pptx_conversion_context & Context);
void xlsx_convert (oox::xlsx_conversion_context & Context);
bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id);
void xlsx_serialize(std::wostream & strm, oox::xlsx_conversion_context & Context);
style_page_layout_properties() { }
style_page_layout_properties_attlist style_page_layout_properties_attlist_;
style_page_layout_properties_elements style_page_layout_properties_elements_;
style_page_layout_properties_attlist attlist_;
style_page_layout_properties_elements elements_;
private:

View File

@ -455,6 +455,45 @@ namespace svg_path
}
}break;
case 'G':
{
nPos++;
skipSpaces(nPos, rSvgDStatement, nLen);
while(nPos < nLen && isOnNumberChar(rSvgDStatement, nPos))
{
double nX, nY;
double A1, A2;
if(!importDoubleAndSpaces(nX, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(nY, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(A1, nPos, rSvgDStatement, nLen)) return false;
if(!importDoubleAndSpaces(A2, nPos, rSvgDStatement, nLen)) return false;
if(bRelative)
{
nX += nLastX;
nY += nLastY;
}
aCurrPoly.command = L"a:ArcTo";
// append curved edge
aCurrPoly.points.push_back(_point(nX, nY));
aCurrPoly.points.push_back(_point(A1, A2));
Polyline.push_back(aCurrPoly);
aCurrPoly.points.clear();
// set last position
nLastX = nX;
nLastY = nY;
//keep control point
nLastControlX = nX;
nLastControlY = nY;
}
}break;
// #100617# quadratic beziers are imported as cubic ones
//case 'q' :
//{

View File

@ -81,7 +81,7 @@ void table_table_row::pptx_convert(oox::pptx_conversion_context & Context)
if ((inst) && (inst->content()) && (inst->content()->get_style_table_row_properties()))
{
style_table_row_properties_attlist & row_attlist = inst->content()->get_style_table_row_properties()->style_table_row_properties_attlist_;
style_table_row_properties_attlist & row_attlist = inst->content()->get_style_table_row_properties()->attlist_;
if (row_attlist.style_row_height_)
{
height = (int)( 0.5 +row_attlist.style_row_height_->get_value_unit(length::emu) );

View File

@ -120,12 +120,12 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
if ((rowStyle) && (rowStyle->content()))
{
const odf_reader::style_table_row_properties * prop = rowStyle->content()->get_style_table_row_properties();
if ((prop) && (prop->style_table_row_properties_attlist_.style_row_height_))
if ((prop) && (prop->attlist_.style_row_height_))
{
row_height = prop->style_table_row_properties_attlist_.style_row_height_->get_value_unit(odf_types::length::pt);
row_height = prop->attlist_.style_row_height_->get_value_unit(odf_types::length::pt);
if ((prop->style_table_row_properties_attlist_.style_use_optimal_row_height_) &&
(*prop->style_table_row_properties_attlist_.style_use_optimal_row_height_==true))
if ((prop->attlist_.style_use_optimal_row_height_) &&
(*prop->attlist_.style_use_optimal_row_height_==true))
{
//автоматическая подстройка высоты.
//нету в оох
@ -478,11 +478,11 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
{
if (const style_table_column_properties * prop = inst->content()->get_style_table_column_properties())
{
if (prop->style_table_column_properties_attlist_.style_column_width_)
if (prop->attlist_.style_column_width_)
{
pt_width = prop->style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::pt);
cm_width = prop->style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::cm);
in_width = prop->style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::inch);
pt_width = prop->attlist_.style_column_width_->get_value_unit(length::pt);
cm_width = prop->attlist_.style_column_width_->get_value_unit(length::cm);
in_width = prop->attlist_.style_column_width_->get_value_unit(length::inch);
if (collapsed)
{
@ -492,7 +492,7 @@ void table_table_column::xlsx_convert(oox::xlsx_conversion_context & Context)
const double pixDpi = in_width * 96.;
width = pixToSize(pixDpi, Context.getMaxDigitSize().first);
//const double width = cmToChars(prop->style_table_column_properties_attlist_.style_column_width_->get_value_unit(length::cm));
//const double width = cmToChars(prop->attlist_.style_column_width_->get_value_unit(length::cm));
// see ECMA-376 page 1768
if (in_width > 0)

View File

@ -57,15 +57,15 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"mso-spt200" , 7}, // shapetypeActionButtonMovie,
{ L"mso-spt197" , 7}, // shapetypeActionButtonReturn,
{ L"mso-spt199" , 7}, // shapetypeActionButtonSound,
{ L"ooxml-arc" , 7}, // shapetypeArc,
{ L"" , 7}, // shapetypeArc,
{ L"mso-spt91" , 7}, // shapetypeBentArrow,
{ L"mso-spt33" , 7}, // shapetypeBentConnector2,
{ L"mso-spt34" , 7}, // shapetypeBentConnector3,
{ L"mso-spt35" , 7}, // shapetypeBentConnector4,
{ L"mso-spt36" , 7}, // shapetypeBentConnector5,
{ L"mso-spt90" , 7}, // shapetypeBentUpArrow,
{ L"" , 7}, // shapetypeBentUpArrow,
{ L"quad-bevel" , 7}, // shapetypeBevel,
{ L"block-arc" , 7}, // shapetypeBlockArc,
{ L"" , 7}, // shapetypeBlockArc,
{ L"mso-spt49" , 7}, // shapetypeBorderCallout1,
{ L"mso-spt50" , 7}, // shapetypeBorderCallout2,
{ L"mso-spt51" , 7}, // shapetypeBorderCallout3,
@ -78,7 +78,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"" , 7}, // shapetypeChartPlus,
{ L"" , 7}, // shapetypeChartStar,
{ L"" , 7}, // shapetypeChartX,
{ L"chevron" , 7}, // shapetypeChevron,
{ L"" , 7}, // shapetypeChevron,
{ L"" , 7}, // shapetypeChord,
{ L"" , 7}, // shapetypeCircularArrow,
{ L"cloud" , 7}, // shapetypeCloud,
@ -92,16 +92,16 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"mso-spt40" , 7}, // shapetypeCurvedConnector5,
{ L"" , 7}, // shapetypeCurvedDownArrow,
{ L"" , 7}, // shapetypeCurvedLeftArrow,
{ L"mso-spt102" , 7}, // shapetypeCurvedRightArrow,
{ L"" , 7}, // shapetypeCurvedRightArrow,
{ L"mso-spt104" , 7}, // shapetypeCurvedUpArrow,
{ L"" , 7}, // shapetypeDecagon,
{ L"" , 7}, // shapetypeDiagStripe,
{ L"diamond" , 7}, // shapetypeDiamond,
{ L"" , 7}, // shapetypeDiamond,
{ L"" , 7}, // shapetypeDodecagon,
{ L"ring" , 7}, // shapetypeDonut,
{ L"" , 7}, // shapetypeDonut,
{ L"" , 7}, // shapetypeDoubleWave,
{ L"down-arrow" , 7}, // shapetypeDownArrow,
{ L"down-arrow-callout" , 7}, // shapetypeDownArrowCallout,
{ L"" , 7}, // shapetypeDownArrow,
{ L"" , 7}, // shapetypeDownArrowCallout,
{ L"ellipse" , 3}, // shapetypeEllipse,
{ L"mso-spt107" , 7}, // shapetypeEllipseRibbon,
{ L"mso-spt108" , 7}, // shapetypeEllipseRibbon2,
@ -112,7 +112,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"flowchart-delay" , 7}, // shapetypeFlowChartDelay,
{ L"flowchart-display" , 7}, // shapetypeFlowChartDisplay,
{ L"flowchart-document" , 7}, // shapetypeFlowChartDocument,
{ L"flowchart-extract" , 7}, // shapetypeFlowChartExtract,
{ L"" , 7}, // shapetypeFlowChartExtract,
{ L"flowchart-data" , 7}, // shapetypeFlowChartInputOutput,
{ L"flowchart-internal-storage" , 7}, // shapetypeFlowChartInternalStorage,
{ L"flowchart-magnetic-disk" , 7}, // shapetypeFlowChartMagneticDisk,
@ -135,7 +135,7 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"flowchart-summing-junction" , 7}, // shapetypeFlowChartSummingJunction,
{ L"flowchart-terminator" , 7}, // shapetypeFlowChartTerminator,
{ L"paper" , 7}, // shapetypeFoldedCorner,
{ L"frame" , 7}, // shapetypeFrame,
{ L"" , 7}, // shapetypeFrame,
{ L"" , 7}, // shapetypeFunnel,
{ L"" , 7}, // shapetypeGear6,
{ L"" , 7}, // shapetypeGear9,
@ -143,21 +143,21 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"heart" , 7}, // shapetypeHeart,
{ L"" , 7}, // shapetypeHeptagon,
{ L"hexagon" , 7}, // shapetypeHexagon,
{ L"pentagon-right" , 7}, // shapetypeHomePlate,
{ L"" , 7}, // shapetypeHomePlate,
{ L"horizontal-scroll" , 7}, // shapetypeHorizontalScroll,
{ L"" , 7}, // shapetypeIrregularSeal1,
{ L"" , 7}, // shapetypeIrregularSeal2,
{ L"left-arrow" , 7}, // shapetypeLeftArrow,
{ L"left-arrow-callout" , 7}, // shapetypeLeftArrowCallout,
{ L"" , 7}, // shapetypeLeftArrow,
{ L"" , 7}, // shapetypeLeftArrowCallout,
{ L"left-brace" , 7}, // shapetypeLeftBrace,
{ L"left-bracket" , 7}, // shapetypeLeftBracket,
{ L"" , 7}, // shapetypeLeftCircularArrow,
{ L"left-right-arrow" , 7}, // shapetypeLeftRightArrow,
{ L"" , 7}, // shapetypeLeftRightArrow,
{ L"left-right-arrow-callout" , 7}, // shapetypeLeftRightArrowCallout,
{ L"" , 7}, // shapetypeLeftRightCircularArrow,
{ L"" , 7}, // shapetypeLeftRightRibbon,
{ L"mso-spt182" , 7}, // shapetypeLeftRightUpArrow,
{ L"mso-spt89" , 7}, // shapetypeLeftUpArrow,
{ L"" , 7}, // shapetypeLeftUpArrow,
{ L"lightning" , 7}, // shapetypeLightningBolt,
{ L"" , 5}, // shapetypeLine,
{ L"" , 7}, // shapetypeLineInv,
@ -166,33 +166,33 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"" , 7}, // shapetypeMathMinus,
{ L"" , 7}, // shapetypeMathMultiply,
{ L"" , 7}, // shapetypeMathNotEqual,
{ L"cross" , 7}, // shapetypeMathPlus,
{ L"" , 7}, // shapetypeMathPlus,
{ L"moon" , 7}, // shapetypeMoon,
{ L"" , 7}, // shapetypeNonIsoscelesTrapezoid,
{ L"forbidden" , 7}, // shapetypeNoSmoking,
{ L"notched-right-arrow" , 7}, // shapetypeNotchedRightArrow,
{ L"" , 7}, // shapetypeNotchedRightArrow,
{ L"octagon" , 7}, // shapetypeOctagon,
{ L"parallelogram" , 7}, // shapetypeParallelogram,
{ L"" , 7}, // shapetypeParallelogram,
{ L"pentagon" , 7}, // shapetypePentagon,
{ L"mso-spt100" , 7}, // shapetypePie,
{ L"" , 7}, // shapetypePie,
{ L"" , 7}, // shapetypePieWedge,
{ L"" , 7}, // shapetypePlaque,
{ L"" , 7}, // shapetypePlaqueTabs,
{ L"cross" , 7}, // shapetypePlus,
{ L"" , 7}, // shapetypePlus,
{ L"quad-arrow" , 7}, // shapetypeQuadArrow,
{ L"quad-arrow-callout" , 7}, // shapetypeQuadArrowCallout,
{ L"rectangle" , 2}, // shapetypeRect,
{ L"mso-spt53" , 7}, // shapetypeRibbon,
{ L"mso-spt54" , 7}, // shapetypeRibbon2,
{ L"right-arrow" , 7}, // shapetypeRightArrow,
{ L"right-arrow-callout" , 7}, // shapetypeRightArrowCallout,
{ L"" , 7}, // shapetypeRightArrow,
{ L"" , 7}, // shapetypeRightArrowCallout,
{ L"right-brace" , 7}, // shapetypeRightBrace,
{ L"right-bracket" , 7}, // shapetypeRightBracket,
{ L"" , 7}, // shapetypeRound1Rect,
{ L"" , 7}, // shapetypeRound2DiagRect,
{ L"" , 7}, // shapetypeRound2SameRect,
{ L"round-rectangle" , 7}, // shapetypeRoundRect,
{ L"right-triangle" , 7}, // shapetypeRtTriangle,
{ L"" , 7}, // shapetypeRoundRect,
{ L"" , 7}, // shapetypeRtTriangle,
{ L"smiley" , 7}, // shapetypeSmileyFace,
{ L"" , 7}, // shapetypeSnip1Rect,
{ L"" , 7}, // shapetypeSnip2DiagRect,
@ -214,11 +214,11 @@ static const _sh_typ Shape_Types_Mapping[] = // index === OOX::Drawing::EShapeTy
{ L"" , 7}, // shapetypeSun,
{ L"" , 7}, // shapetypeSwooshArrow,
{ L"" , 7}, // shapetypeTeardrop,
{ L"trapezoid" , 7}, // shapetypeTrapezoid,
{ L"isosceles-triangle" , 7}, // shapetypeTriangle,
{ L"up-arrow" , 7}, // shapetypeUpArrow,
{ L"up-arrow-callout" , 7}, // shapetypeUpArrowCallout,
{ L"up-down-arrow" , 7}, // shapetypeUpDownArrow,
{ L"" , 7}, // shapetypeTrapezoid,
{ L"" , 7}, // shapetypeTriangle,
{ L"" , 7}, // shapetypeUpArrow,
{ L"" , 7}, // shapetypeUpArrowCallout,
{ L"" , 7}, // shapetypeUpDownArrow,
{ L"up-down-arrow-callout" , 7}, // shapetypeUpDownArrowCallout,
{ L"mso-spt101" , 7}, // shapetypeUturnArrow,
{ L"vertical-scroll" , 7}, // shapetypeVerticalScroll,

View File

@ -30,6 +30,12 @@
*
*/
#include "../oox_shape_defines.h"
// shapetypeAccentBorderCallout1,
// shapetypeAccentBorderCallout2,
// shapetypeAccentBorderCallout3,
namespace cpdoccore
{
}

View File

@ -29,3 +29,9 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "../oox_shape_defines.h"
namespace cpdoccore
{
}

File diff suppressed because it is too large Load Diff

View File

@ -29,3 +29,67 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "../oox_shape_defines.h"
//+ shapetypeBentUpArrow
// shapetypeBentArrow,
// shapetypeBentConnector2,
// shapetypeBentConnector3,
// shapetypeBentConnector4,
// shapetypeBentConnector5,
namespace cpdoccore
{
class oox_shape_BentUpArrow : public oox_shape
{
public:
oox_shape_BentUpArrow()
{
odf_type_name =L"ooxml-bentUpArrow";
enhanced_path = L"M 0 ?f13 L ?f10 ?f13 ?f10 ?f4 ?f6 ?f4 ?f8 0 ?f18 ?f4 ?f11 ?f4 ?f11 ?f17 0 ?f17 Z N";
text_areas = L"0 ?f13 ?f11 ?f17";
view_box = L"0 0 0 0";
modifiers = L"25000 25000 25000";
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"if(0-$2 ,0,if(50000-$2 ,$2 ,50000))");
add(L"f3", L"min(logwidth,logheight)");
add(L"f4", L"?f3 *?f2 /100000");
add(L"f5", L"?f3 *?f1 /50000");
add(L"f6", L"logwidth+0-?f5 ");
add(L"f7", L"?f3 *?f1 /100000");
add(L"f8", L"logwidth+0-?f7 ");
add(L"f9", L"?f3 *?f0 /200000");
add(L"f10", L"?f8 +0-?f9 ");
add(L"f11", L"?f8 +?f9 -0");
add(L"f12", L"?f3 *?f0 /100000");
add(L"f13", L"logheight+0-?f12 ");
add(L"f14", L"?f11 *1/2");
add(L"f15", L"(?f13 +logheight)/2");
add(L"f16", L"(?f4 +logheight)/2");
add(L"f17", L"logheight");
add(L"f18", L"logwidth");
/////////////////////////////////////////////////////////
_handle h1, h2;
h1.position = L"0 ?f13";
h1.y_maximum= L"50000";
h1.y_minimum= L"0";
handles.push_back(h1);
h2.position = L"?f6 0";
h2.x_maximum= L"50000";
h2.x_minimum= L"0";
handles.push_back(h2);
h1.position = L"?f10 ?f4";
h1.y_maximum= L"50000";
h1.y_minimum= L"0";
handles.push_back(h1);
}
};
}

View File

@ -29,3 +29,253 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "../oox_shape_defines.h"
//+ shapetypeLeftArrowCallout
//+ shapetypeRightArrowCallout
//+ shapetypeUpArrowCallout
//+ shapetypeDownArrowCallout
namespace cpdoccore
{
class oox_shape_LeftArrowCallout : public oox_shape
{
public:
oox_shape_LeftArrowCallout()
{
odf_type_name =L"ooxml-leftArrowCallout";
enhanced_path = L"M 0 ?f12 L ?f17 ?f13 ?f17 ?f14 ?f19 ?f14 ?f19 0 ?f22 0 ?f22 ?f21 ?f19 ?f21 ?f19 ?f15 ?f17 ?f15 ?f17 ?f16 Z N";
text_areas = L"?f19 0 ?f22 ?f21";
view_box = L"0 0 0 0";
modifiers = L"25000 25000 25000 64977";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"50000*logheight/?f0 ");
add(L"f2", L"if(0-$1 ,0,if(?f1 -$1 ,$1 ,?f1 ))");
add(L"f3", L"?f2 *2/1");
add(L"f4", L"if(0-$0 ,0,if(?f3 -$0 ,$0 ,?f3 ))");
add(L"f5", L"100000*logwidth/?f0 ");
add(L"f6", L"if(0-$2 ,0,if(?f5 -$2 ,$2 ,?f5 ))");
add(L"f7", L"?f6 *?f0 /logwidth");
add(L"f8", L"100000+0-?f7 ");
add(L"f9", L"if(0-$3 ,0,if(?f8 -$3 ,$3 ,?f8 ))");
add(L"f10", L"?f0 *?f2 /100000");
add(L"f11", L"?f0 *?f4 /200000");
add(L"f12", L"logheight/2");
add(L"f13", L"?f12 +0-?f10 ");
add(L"f14", L"?f12 +0-?f11 ");
add(L"f15", L"?f12 +?f11 -0");
add(L"f16", L"?f12 +?f10 -0");
add(L"f17", L"?f0 *?f6 /100000");
add(L"f18", L"logwidth*?f9 /100000");
add(L"f19", L"logwidth+0-?f18 ");
add(L"f20", L"(?f19 +logwidth)/2");
add(L"f21", L"logheight");
add(L"f22", L"logwidth");
/////////////////////////////////////////////////////////
_handle h1, h2;
h2.position = L"?f17 ?f14";
h2.y_maximum= L"?f3";
h2.y_minimum= L"0";
handles.push_back(h2);
h2.position = L"0 ?f13";
h2.y_maximum= L"?f1";
h2.y_minimum= L"0";
handles.push_back(h2);
h1.position = L"?f17 0";
h1.x_maximum= L"?f5";
h1.x_minimum= L"0";
handles.push_back(h1);
h1.position = L"?f19 ?f21";
h1.x_maximum= L"?f8";
h1.x_minimum= L"0";
handles.push_back(h1);
}
};
class oox_shape_RightArrowCallout : public oox_shape
{
public:
oox_shape_RightArrowCallout()
{
odf_type_name = L"ooxml-rightArrowCallout";
enhanced_path = L"M 0 0 L ?f19 0 ?f19 ?f14 ?f18 ?f14 ?f18 ?f13 ?f21 ?f12 ?f18 ?f16 ?f18 ?f15 ?f19 ?f15 ?f19 ?f22 0 ?f22 Z N";
text_areas = L"0 0 ?f19 ?f22";
view_box = L"0 0 0 0";
modifiers = L"25000 25000 25000 64977";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"50000*logheight/?f0 ");
add(L"f2", L"if(0-$1 ,0,if(?f1 -$1 ,$1 ,?f1 ))");
add(L"f3", L"?f2 *2/1");
add(L"f4", L"if(0-$0 ,0,if(?f3 -$0 ,$0 ,?f3 ))");
add(L"f5", L"100000*logwidth/?f0 ");
add(L"f6", L"if(0-$2 ,0,if(?f5 -$2 ,$2 ,?f5 ))");
add(L"f7", L"?f6 *?f0 /logwidth");
add(L"f8", L"100000+0-?f7 ");
add(L"f9", L"if(0-$3 ,0,if(?f8 -$3 ,$3 ,?f8 ))");
add(L"f10", L"?f0 *?f2 /100000");
add(L"f11", L"?f0 *?f4 /200000");
add(L"f12", L"logheight/2");
add(L"f13", L"?f12 +0-?f10 ");
add(L"f14", L"?f12 +0-?f11 ");
add(L"f15", L"?f12 +?f11 -0");
add(L"f16", L"?f12 +?f10 -0");
add(L"f17", L"?f0 *?f6 /100000");
add(L"f18", L"logwidth+0-?f17 ");
add(L"f19", L"logwidth*?f9 /100000");
add(L"f20", L"?f19 *1/2");
add(L"f21", L"logwidth");
add(L"f22", L"logheight");
/////////////////////////////////////////////////////////
_handle h1, h2;
h2.position = L"?f18 ?f14";
h2.y_maximum= L"?f3";
h2.y_minimum= L"0";
handles.push_back(h2);
h2.position = L"?f21 ?f13";
h2.y_maximum= L"?f1";
h2.y_minimum= L"0";
handles.push_back(h2);
h1.position = L"?f18 0";
h1.x_maximum= L"?f5";
h1.x_minimum= L"0";
handles.push_back(h1);
h1.position = L"?f19 ?f22";
h1.x_maximum= L"?f8";
h1.x_minimum= L"0";
handles.push_back(h1);
}
};
class oox_shape_UpArrowCallout : public oox_shape
{
public:
oox_shape_UpArrowCallout()
{
odf_type_name =L"ooxml-upArrowCallout";
enhanced_path = L"M 0 ?f19 L ?f14 ?f19 ?f14 ?f17 ?f13 ?f17 ?f12 0 ?f16 ?f17 ?f15 ?f17 ?f15 ?f19 ?f21 ?f19 ?f21 ?f22 0 ?f22 Z N";
text_areas = L"0 ?f19 ?f21 ?f22";
view_box = L"0 0 0 0";
modifiers = L"25000 25000 25000 64977";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"50000*logwidth/?f0 ");
add(L"f2", L"if(0-$1 ,0,if(?f1 -$1 ,$1 ,?f1 ))");
add(L"f3", L"?f2 *2/1");
add(L"f4", L"if(0-$0 ,0,if(?f3 -$0 ,$0 ,?f3 ))");
add(L"f5", L"100000*logheight/?f0 ");
add(L"f6", L"if(0-$2 ,0,if(?f5 -$2 ,$2 ,?f5 ))");
add(L"f7", L"?f6 *?f0 /logheight");
add(L"f8", L"100000+0-?f7 ");
add(L"f9", L"if(0-$3 ,0,if(?f8 -$3 ,$3 ,?f8 ))");
add(L"f10", L"?f0 *?f2 /100000");
add(L"f11", L"?f0 *?f4 /200000");
add(L"f12", L"logwidth/2");
add(L"f13", L"?f12 +0-?f10 ");
add(L"f14", L"?f12 +0-?f11 ");
add(L"f15", L"?f12 +?f11 -0");
add(L"f16", L"?f12 +?f10 -0");
add(L"f17", L"?f0 *?f6 /100000");
add(L"f18", L"logheight*?f9 /100000");
add(L"f19", L"logheight+0-?f18 ");
add(L"f20", L"(?f19 +logheight)/2");
add(L"f21", L"logwidth");
add(L"f22", L"logheight");
/////////////////////////////////////////////////////////
_handle h1, h2;
h1.position = L"?f14 ?f17";
h1.x_maximum= L"?f3";
h1.x_minimum= L"0";
handles.push_back(h1);
h1.position = L"?f13 0";
h1.x_maximum= L"?f1";
h1.x_minimum= L"0";
handles.push_back(h1);
h2.position = L"?f21 ?f17";
h2.y_maximum= L"?f5";
h2.y_minimum= L"0";
handles.push_back(h2);
h2.position = L"0 ?f19";
h2.y_maximum= L"?f8";
h2.y_minimum= L"0";
handles.push_back(h2);
}
};
class oox_shape_DownArrowCallout : public oox_shape
{
public:
oox_shape_DownArrowCallout()
{
odf_type_name =L"ooxml-downArrowCallout";
enhanced_path = L"M 0 0 L ?f22 0 ?f22 ?f19 ?f15 ?f19 ?f15 ?f18 ?f16 ?f18 ?f12 ?f21 ?f13 ?f18 ?f14 ?f18 ?f14 ?f19 0 ?f19 Z N";
text_areas = L"0 0 ?f22 ?f19";
view_box = L"0 0 0 0";
modifiers = L"25000 25000 25000 64977";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"50000*logwidth/?f0 ");
add(L"f2", L"if(0-$1 ,0,if(?f1 -$1 ,$1 ,?f1 ))");
add(L"f3", L"?f2 *2/1");
add(L"f4", L"if(0-$0 ,0,if(?f3 -$0 ,$0 ,?f3 ))");
add(L"f5", L"100000*logheight/?f0 ");
add(L"f6", L"if(0-$2 ,0,if(?f5 -$2 ,$2 ,?f5 ))");
add(L"f7", L"?f6 *?f0 /logheight");
add(L"f8", L"100000+0-?f7 ");
add(L"f9", L"if(0-$3 ,0,if(?f8 -$3 ,$3 ,?f8 ))");
add(L"f10", L"?f0 *?f2 /100000");
add(L"f11", L"?f0 *?f4 /200000");
add(L"f12", L"logwidth/2");
add(L"f13", L"?f12 +0-?f10 ");
add(L"f14", L"?f12 +0-?f11 ");
add(L"f15", L"?f12 +?f11 -0");
add(L"f16", L"?f12 +?f10 -0");
add(L"f17", L"?f0 *?f6 /100000");
add(L"f18", L"logheight+0-?f17 ");
add(L"f19", L"logheight*?f9 /100000");
add(L"f20", L"?f19 *1/2");
add(L"f21", L"logheight");
add(L"f22", L"logwidth");
/////////////////////////////////////////////////////////
_handle h1, h2;
h1.position = L"?f14 ?f18";
h1.x_maximum= L"?f3";
h1.x_minimum= L"0";
handles.push_back(h1);
h1.position = L"?f13 ?f21";
h1.x_maximum= L"?f1";
h1.x_minimum= L"0";
handles.push_back(h1);
h2.position = L"?f22 ?f18";
h2.y_maximum= L"?f5";
h2.y_minimum= L"0";
handles.push_back(h2);
h2.position = L"0 ?f19";
h2.y_maximum= L"?f8";
h2.y_minimum= L"0";
handles.push_back(h2);
}
};
}

View File

@ -29,6 +29,32 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "../oox_shape_defines.h"
// shapetypeChartPlus,
// shapetypeChartStar,
// shapetypeChartX,
// shapetypeChartX
//+ shapetypeFlowChartExtract
namespace cpdoccore
{
class oox_shape_FlowChartExtract : public oox_shape
{
public:
oox_shape_FlowChartExtract()
{
odf_type_name =L"ooxml-flowChartExtract";
enhanced_path = L"M 0 2 L 1 0 2 2 Z N";
text_areas = L"?f2 ?f3 ?f0 ?f4";
view_box = L"0 0 0 0";
add(L"f0", L"logwidth*3/4");
add(L"f1", L"logwidth/2");
add(L"f2", L"logwidth/4");
add(L"f3", L"logheight/2");
add(L"f4", L"logheight");
}
};
}

View File

@ -29,3 +29,9 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "../oox_shape_defines.h"
namespace cpdoccore
{
}

View File

@ -35,202 +35,386 @@
// shapetypeCurvedConnector5,
//+ shapetypeCurvedDownArrow,
//+ shapetypeCurvedLeftArrow,
// shapetypeCurvedRightArrow,
// shapetypeCurvedUpArrow,
//+ shapetypeCurvedRightArrow,
//+ shapetypeCurvedUpArrow,
#include "../oox_shape_defines.h"
namespace cpdoccore
{
class oox_shape_curvedLeftArrow : public oox_shape
class oox_shape_CurvedLeftArrow : public oox_shape
{
public:
oox_shape_curvedLeftArrow()
oox_shape_CurvedLeftArrow()
{
odf_type_name =L"ooxml-curvedLeftArrow";
//modifiers = L"23520";
enhanced_path = L"M ?f2 ?f8 A ?f65 ?f66 ?f67 ?f68 ?f2 ?f8 ?f62 ?f64 W ?f69 ?f70 ?f71 ?f72 ?f2 ?f8 ?f62 ?f64 Z N";
text_areas = L"?f22 ?f24 ?f23 ?f25";
glue_points = L"?f22 ?f24 ?f22 ?f25 ?f23 ?f25 ?f23 ?f24";
view_box = L"0 0 21600 21600";
enhanced_path = L"M 0 ?f31 L ?f32 ?f28 ?f32 ?f24 G ?f44 ?f8 ?f45 ?f46 ?f44 ?f8 ?f47 ?f48 L ?f32 ?f29 Z S N M ?f42 ?f18 G ?f44 ?f8 ?f49 ?f50 L 0 0 G ?f44 ?f8 ?f51 ?f52 Z I S N M ?f42 ?f18 G ?f44 ?f8 ?f53 ?f54 L 0 0 G ?f44 ?f8 ?f55 ?f56 L ?f42 ?f18 G ?f44 ?f8 ?f57 ?f58 L ?f32 ?f29 0 ?f31 ?f32 ?f28 ?f32 ?f24 G ?f44 ?f8 ?f59 ?f60 F N";
text_areas = L"0 0 ?f42 ?f43";
view_box = L"0 0 0 0";
modifiers = L"25000 50000 25000";
add(L"f0", L"10800000");
add(L"f0", L"10800000");
add(L"f1", L"5400000");
add(L"f2", L"left");
add(L"f3", L"right");
add(L"f4", L"top");
add(L"f5", L"bottom");
add(L"f6", L"?f5 - ?f4");
add(L"f7", L"?f6 / 2");
add(L"f8", L"?f4 + ?f7");
add(L"f9", L"?f3 - ?f2");
add(L"f10", L"?f9 / 2");
add(L"f11", L"?f2 + ?f10");
add(L"f12", L"5419351 / 1725033");
add(L"f13", L"2700000 + ?f1");
add(L"f14", L"?f13 * ?f12 / ?f0");
add(L"f15", L"0 - ?f14");
add(L"f16", L"sin(?f15)");
add(L"f17", L"0 - ?f16");
add(L"f18", L"?f17 * ?f10");
add(L"f19", L"cos(?f15)");
add(L"f20", L"0 - ?f19");
add(L"f21", L"?f20 * ?f7");
add(L"f22", L"?f11 - ?f18");
add(L"f23", L"?f11 + ?f18");
add(L"f24", L"?f8 - ?f21");
add(L"f25", L"?f8 + ?f21");
add(L"f26", L"21550000 - 21600000");
add(L"f27", L"if(?f26, 21600000, 21550000)");
add(L"f28", L"-21550000 - ?f27");
add(L"f29", L"if(?f28, -21550000, ?f27)");
add(L"f30", L"?f0 + ?f29");
add(L"f31", L"?f0 + ?f1");
add(L"f32", L"?f31 * ?f12 / ?f0");
add(L"f33", L"0 - ?f32");
add(L"f34", L"cos(?f33)");
add(L"f35", L"0 - ?f34");
add(L"f36", L"?f35 * ?f10");
add(L"f37", L"sin(?f33)");
add(L"f38", L"0 - ?f37");
add(L"f39", L"?f38 * ?f7");
add(L"f40", L"sqrt(?f36 * ?f36 + ?f39 * ?f39 + 0 * 0)");
add(L"f41", L"?f10 * ?f7 / ?f40");
add(L"f42", L"?f38 * ?f41");
add(L"f43", L"?f2 - ?f42");
add(L"f44", L"?f35 * ?f41");
add(L"f45", L"?f8 - ?f44");
add(L"f46", L"?f43 - ?f10");
add(L"f47", L"?f45 - ?f7");
add(L"f48", L"?f43 + ?f10");
add(L"f49", L"?f45 + ?f7");
add(L"f50", L"?f30 + ?f1");
add(L"f51", L"?f50 * ?f12 / ?f0");
add(L"f52", L"0 - ?f51");
add(L"f53", L"cos(?f52)");
add(L"f54", L"0 - ?f53");
add(L"f55", L"?f54 * ?f10");
add(L"f56", L"sin(?f52)");
add(L"f57", L"0 - ?f56");
add(L"f58", L"?f57 * ?f7");
add(L"f59", L"sqrt(?f55 * ?f55 + ?f58 * ?f58 + 0 * 0)");
add(L"f60", L"?f10 * ?f7 / ?f59");
add(L"f61", L"?f57 * ?f60");
add(L"f62", L"?f43 + ?f61");
add(L"f63", L"?f54 * ?f60");
add(L"f64", L"?f45 + ?f63");
add(L"f65", L"if(?f29, ?f2, ?f46)");
add(L"f66", L"if(?f29, ?f8, ?f47)");
add(L"f67", L"if(?f29, ?f2, ?f48)");
add(L"f68", L"if(?f29, ?f8, ?f49)");
add(L"f69", L"if(?f29, ?f46, ?f62)");
add(L"f70", L"if(?f29, ?f47, ?f64)");
add(L"f71", L"if(?f29, ?f48, ?f62)");
add(L"f72", L"if(?f29, ?f49, ?f64)");
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"50000*logheight/?f0 ");
add(L"f2", L"if(0-$1 ,0,if(?f1 -$1 ,$1 ,?f1 ))");
add(L"f3", L"if(0-$0 ,0,if(?f2 -$0 ,$0 ,?f2 ))");
add(L"f4", L"?f0 *?f3 /100000");
add(L"f5", L"?f0 *?f2 /100000");
add(L"f6", L"(?f4 +?f5 )/4");
add(L"f7", L"logheight/2");
add(L"f8", L"?f7 +0-?f6 ");
add(L"f9", L"?f8 *2/1");
add(L"f10", L"?f9 *?f9 /1");
add(L"f11", L"?f4 *?f4 /1");
add(L"f12", L"?f10 +0-?f11 ");
add(L"f13", L"sqrt(?f12 )");
add(L"f14", L"?f13 *logwidth/?f9 ");
add(L"f15", L"100000*?f14 /?f0 ");
add(L"f16", L"if(0-$2 ,0,if(?f15 -$2 ,$2 ,?f15 ))");
add(L"f17", L"?f0 *?f16 /100000");
add(L"f18", L"?f8 +?f4 -0");
add(L"f19", L"logwidth*logwidth/1");
add(L"f20", L"?f17 *?f17 /1");
add(L"f21", L"?f19 +0-?f20 ");
add(L"f22", L"sqrt(?f21 )");
add(L"f23", L"?f22 *?f8 /logwidth");
add(L"f24", L"?f8 +?f23 -0");
add(L"f25", L"?f18 +?f23 -0");
add(L"f26", L"?f5 +0-?f4 ");
add(L"f27", L"?f26 *1/2");
add(L"f28", L"?f24 +0-?f27 ");
add(L"f29", L"?f25 +?f27 -0");
add(L"f30", L"?f5 *1/2");
add(L"f31", L"logheight+0-?f30 ");
add(L"f32", L"0+?f17 -0");
add(L"f33", L"(10800000*atan2(?f23 ,?f17 ))/pi");
add(L"f34", L"0+0-?f33 ");
add(L"f35", L"0+?f14 -0");
add(L"f36", L"(?f8 +?f18 )/2");
add(L"f37", L"?f4 *1/2");
add(L"f38", L"(10800000*atan2(?f37 ,?f14 ))/pi");
add(L"f39", L"?f38 +0-?f33 ");
add(L"f40", L"?f33 +?f38 -0");
add(L"f41", L"0+0-?f38 ");
add(L"f42", L"logwidth");
add(L"f43", L"logheight");
add(L"f44", L"logwidth");
add(L"f45", L"(?f33 )/60000.0");
add(L"f46", L"(?f39 )/60000.0");
add(L"f47", L"(?f41 )/60000.0");
add(L"f48", L"(?f40 )/60000.0");
add(L"f49", L"(0)/60000.0");
add(L"f50", L"(-5400000)/60000.0");
add(L"f51", L"(16200000)/60000.0");
add(L"f52", L"(5400000)/60000.0");
add(L"f53", L"(0)/60000.0");
add(L"f54", L"(-5400000)/60000.0");
add(L"f55", L"(16200000)/60000.0");
add(L"f56", L"(5400000)/60000.0");
add(L"f57", L"(0)/60000.0");
add(L"f58", L"(?f33 )/60000.0");
add(L"f59", L"(?f33 )/60000.0");
add(L"f60", L"(?f39 )/60000.0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"0 ?f2";
h.y_maximum= L"51965";
h.y_minimum= L"0";
_handle h1, h2;
h1.position = L"?f32 ?f24";
h1.y_maximum= L"?f2";
h1.y_minimum= L"0";
handles.push_back(h1);
handles.push_back(h);
h1.position = L"?f42 ?f28";
h1.y_maximum= L"?f1";
h1.y_minimum= L"0";
handles.push_back(h1);
h2.position = L"?f32 ?f43";
h2.x_maximum= L"?f15";
h2.x_minimum= L"0";
handles.push_back(h2);
}
};
class oox_shape_curvedDownArrow : public oox_shape
class oox_shape_CurvedRightArrow : public oox_shape
{
public:
oox_shape_curvedDownArrow()
oox_shape_CurvedRightArrow()
{
odf_type_name =L"ooxml-curvedRightArrow";
enhanced_path = L"M 0 ?f8 G ?f45 ?f8 ?f46 ?f47 L ?f32 ?f28 ?f43 ?f31 ?f32 ?f29 ?f32 ?f25 G ?f45 ?f8 ?f48 ?f49 Z S N M ?f43 ?f4 G ?f45 ?f8 ?f50 ?f51 ?f45 ?f8 ?f52 ?f53 Z I S N M 0 ?f8 G ?f45 ?f8 ?f54 ?f55 L ?f32 ?f28 ?f43 ?f31 ?f32 ?f29 ?f32 ?f25 G ?f45 ?f8 ?f56 ?f57 L 0 ?f8 G ?f45 ?f8 ?f58 ?f59 L ?f43 ?f4 G ?f45 ?f8 ?f60 ?f61 F N";
text_areas = L"0 0 ?f43 ?f44";
view_box = L"0 0 0 0";
modifiers = L"25000 50000 25000";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"50000*logheight/?f0 ");
add(L"f2", L"if(0-$1 ,0,if(?f1 -$1 ,$1 ,?f1 ))");
add(L"f3", L"if(0-$0 ,0,if(?f2 -$0 ,$0 ,?f2 ))");
add(L"f4", L"?f0 *?f3 /100000");
add(L"f5", L"?f0 *?f2 /100000");
add(L"f6", L"(?f4 +?f5 )/4");
add(L"f7", L"logheight/2");
add(L"f8", L"?f7 +0-?f6 ");
add(L"f9", L"?f8 *2/1");
add(L"f10", L"?f9 *?f9 /1");
add(L"f11", L"?f4 *?f4 /1");
add(L"f12", L"?f10 +0-?f11 ");
add(L"f13", L"sqrt(?f12 )");
add(L"f14", L"?f13 *logwidth/?f9 ");
add(L"f15", L"100000*?f14 /?f0 ");
add(L"f16", L"if(0-$2 ,0,if(?f15 -$2 ,$2 ,?f15 ))");
add(L"f17", L"?f0 *?f16 /100000");
add(L"f18", L"?f8 +?f4 -0");
add(L"f19", L"logwidth*logwidth/1");
add(L"f20", L"?f17 *?f17 /1");
add(L"f21", L"?f19 +0-?f20 ");
add(L"f22", L"sqrt(?f21 )");
add(L"f23", L"?f22 *?f8 /logwidth");
add(L"f24", L"?f8 +?f23 -0");
add(L"f25", L"?f18 +?f23 -0");
add(L"f26", L"?f5 +0-?f4 ");
add(L"f27", L"?f26 *1/2");
add(L"f28", L"?f24 +0-?f27 ");
add(L"f29", L"?f25 +?f27 -0");
add(L"f30", L"?f5 *1/2");
add(L"f31", L"logheight+0-?f30 ");
add(L"f32", L"logwidth+0-?f17 ");
add(L"f33", L"(10800000*atan2(?f23 ,?f17 ))/pi");
add(L"f34", L"10800000+0-?f33 ");
add(L"f35", L"0+0-?f33 ");
add(L"f36", L"logwidth+0-?f14 ");
add(L"f37", L"(?f8 +?f18 )/2");
add(L"f38", L"?f4 *1/2");
add(L"f39", L"(10800000*atan2(?f38 ,?f14 ))/pi");
add(L"f40", L"?f39 +0-5400000");
add(L"f41", L"5400000+?f39 -0");
add(L"f42", L"10800000+0-?f39 ");
add(L"f43", L"logwidth");
add(L"f44", L"logheight");
add(L"f45", L"logwidth");
add(L"f46", L"(10800000)/60000.0");
add(L"f47", L"(?f35 )/60000.0");
add(L"f48", L"(?f34 )/60000.0");
add(L"f49", L"(?f33 )/60000.0");
add(L"f50", L"(16200000)/60000.0");
add(L"f51", L"(?f40 )/60000.0");
add(L"f52", L"(?f42 )/60000.0");
add(L"f53", L"(?f41 )/60000.0");
add(L"f54", L"(10800000)/60000.0");
add(L"f55", L"(?f35 )/60000.0");
add(L"f56", L"(?f34 )/60000.0");
add(L"f57", L"(?f33 )/60000.0");
add(L"f58", L"(10800000)/60000.0");
add(L"f59", L"(5400000)/60000.0");
add(L"f60", L"(16200000)/60000.0");
add(L"f61", L"(?f40 )/60000.0");
/////////////////////////////////////////////////////////
_handle h1, h2;
h1.position = L"?f32 ?f24";
h1.y_maximum= L"?f2";
h1.y_minimum= L"0";
handles.push_back(h1);
h1.position = L"?f43 ?f28";
h1.y_maximum= L"?f1";
h1.y_minimum= L"0";
handles.push_back(h1);
h2.position = L"?f32 ?f43";
h2.x_maximum= L"?f15";
h2.x_minimum= L"0";
handles.push_back(h2);
}
};
class oox_shape_CurvedDownArrow : public oox_shape
{
public:
oox_shape_CurvedDownArrow()
{
odf_type_name =L"ooxml-curvedDownArrow";
//modifiers = L"23520";
enhanced_path = L"M ?f2 ?f8 A ?f65 ?f66 ?f67 ?f68 ?f2 ?f8 ?f62 ?f64 W ?f69 ?f70 ?f71 ?f72 ?f2 ?f8 ?f62 ?f64 Z N";
text_areas = L"?f22 ?f24 ?f23 ?f25";
glue_points = L"?f22 ?f24 ?f22 ?f25 ?f23 ?f25 ?f23 ?f24";
view_box = L"0 0 21600 21600";
enhanced_path = L"M ?f31 ?f43 L ?f28 ?f32 ?f24 ?f32 G ?f8 ?f45 ?f46 ?f47 L ?f18 0 G ?f8 ?f45 ?f48 ?f49 L ?f29 ?f32 Z S N M ?f36 ?f35 G ?f8 ?f45 ?f50 ?f51 L 0 ?f43 G ?f8 ?f45 ?f52 ?f53 Z I S N M ?f36 ?f35 G ?f8 ?f45 ?f54 ?f55 L 0 ?f43 G ?f8 ?f45 ?f56 ?f57 L ?f18 0 G ?f8 ?f45 ?f58 ?f59 L ?f29 ?f32 ?f31 ?f43 ?f28 ?f32 ?f24 ?f32 G ?f8 ?f45 ?f60 ?f61 F N";
text_areas = L"0 0 ?f44 ?f43";
view_box = L"0 0 0 0";
modifiers = L"25000 50000 25000";
add(L"f0", L"10800000");
add(L"f1", L"5400000");
add(L"f2", L"left");
add(L"f3", L"right");
add(L"f4", L"top");
add(L"f5", L"bottom");
add(L"f6", L"?f5 - ?f4");
add(L"f7", L"?f6 / 2");
add(L"f8", L"?f4 + ?f7");
add(L"f9", L"?f3 - ?f2");
add(L"f10", L"?f9 / 2");
add(L"f11", L"?f2 + ?f10");
add(L"f12", L"5419351 / 1725033");
add(L"f13", L"2700000 + ?f1");
add(L"f14", L"?f13 * ?f12 / ?f0");
add(L"f15", L"0 - ?f14");
add(L"f16", L"sin(?f15)");
add(L"f17", L"0 - ?f16");
add(L"f18", L"?f17 * ?f10");
add(L"f19", L"cos(?f15)");
add(L"f20", L"0 - ?f19");
add(L"f21", L"?f20 * ?f7");
add(L"f22", L"?f11 - ?f18");
add(L"f23", L"?f11 + ?f18");
add(L"f24", L"?f8 - ?f21");
add(L"f25", L"?f8 + ?f21");
add(L"f26", L"21550000 - 21600000");
add(L"f27", L"if(?f26, 21600000, 21550000)");
add(L"f28", L"-21550000 - ?f27");
add(L"f29", L"if(?f28, -21550000, ?f27)");
add(L"f30", L"?f0 + ?f29");
add(L"f31", L"?f0 + ?f1");
add(L"f32", L"?f31 * ?f12 / ?f0");
add(L"f33", L"0 - ?f32");
add(L"f34", L"cos(?f33)");
add(L"f35", L"0 - ?f34");
add(L"f36", L"?f35 * ?f10");
add(L"f37", L"sin(?f33)");
add(L"f38", L"0 - ?f37");
add(L"f39", L"?f38 * ?f7");
add(L"f40", L"sqrt(?f36 * ?f36 + ?f39 * ?f39 + 0 * 0)");
add(L"f41", L"?f10 * ?f7 / ?f40");
add(L"f42", L"?f38 * ?f41");
add(L"f43", L"?f2 - ?f42");
add(L"f44", L"?f35 * ?f41");
add(L"f45", L"?f8 - ?f44");
add(L"f46", L"?f43 - ?f10");
add(L"f47", L"?f45 - ?f7");
add(L"f48", L"?f43 + ?f10");
add(L"f49", L"?f45 + ?f7");
add(L"f50", L"?f30 + ?f1");
add(L"f51", L"?f50 * ?f12 / ?f0");
add(L"f52", L"0 - ?f51");
add(L"f53", L"cos(?f52)");
add(L"f54", L"0 - ?f53");
add(L"f55", L"?f54 * ?f10");
add(L"f56", L"sin(?f52)");
add(L"f57", L"0 - ?f56");
add(L"f58", L"?f57 * ?f7");
add(L"f59", L"sqrt(?f55 * ?f55 + ?f58 * ?f58 + 0 * 0)");
add(L"f60", L"?f10 * ?f7 / ?f59");
add(L"f61", L"?f57 * ?f60");
add(L"f62", L"?f43 + ?f61");
add(L"f63", L"?f54 * ?f60");
add(L"f64", L"?f45 + ?f63");
add(L"f65", L"if(?f29, ?f2, ?f46)");
add(L"f66", L"if(?f29, ?f8, ?f47)");
add(L"f67", L"if(?f29, ?f2, ?f48)");
add(L"f68", L"if(?f29, ?f8, ?f49)");
add(L"f69", L"if(?f29, ?f46, ?f62)");
add(L"f70", L"if(?f29, ?f47, ?f64)");
add(L"f71", L"if(?f29, ?f48, ?f62)");
add(L"f72", L"if(?f29, ?f49, ?f64)");
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"50000*logwidth/?f0 ");
add(L"f2", L"if(0-$1 ,0,if(?f1 -$1 ,$1 ,?f1 ))");
add(L"f3", L"if(0-$0 ,0,if(100000-$0 ,$0 ,100000))");
add(L"f4", L"?f0 *?f3 /100000");
add(L"f5", L"?f0 *?f2 /100000");
add(L"f6", L"(?f4 +?f5 )/4");
add(L"f7", L"logwidth/2");
add(L"f8", L"?f7 +0-?f6 ");
add(L"f9", L"?f8 *2/1");
add(L"f10", L"?f9 *?f9 /1");
add(L"f11", L"?f4 *?f4 /1");
add(L"f12", L"?f10 +0-?f11 ");
add(L"f13", L"sqrt(?f12 )");
add(L"f14", L"?f13 *logheight/?f9 ");
add(L"f15", L"100000*?f14 /?f0 ");
add(L"f16", L"if(0-$2 ,0,if(?f15 -$2 ,$2 ,?f15 ))");
add(L"f17", L"?f0 *$2 /100000");
add(L"f18", L"?f8 +?f4 -0");
add(L"f19", L"logheight*logheight/1");
add(L"f20", L"?f17 *?f17 /1");
add(L"f21", L"?f19 +0-?f20 ");
add(L"f22", L"sqrt(?f21 )");
add(L"f23", L"?f22 *?f8 /logheight");
add(L"f24", L"?f8 +?f23 -0");
add(L"f25", L"?f18 +?f23 -0");
add(L"f26", L"?f5 +0-?f4 ");
add(L"f27", L"?f26 *1/2");
add(L"f28", L"?f24 +0-?f27 ");
add(L"f29", L"?f25 +?f27 -0");
add(L"f30", L"?f5 *1/2");
add(L"f31", L"logwidth+0-?f30 ");
add(L"f32", L"logheight+0-?f17 ");
add(L"f33", L"(10800000*atan2(?f23 ,?f17 ))/pi");
add(L"f34", L"0+0-?f33 ");
add(L"f35", L"logheight+0-?f14 ");
add(L"f36", L"(?f8 +?f18 )/2");
add(L"f37", L"?f4 *1/2");
add(L"f38", L"(10800000*atan2(?f37 ,?f14 ))/pi");
add(L"f39", L"16200000+?f33 -0");
add(L"f40", L"16200000+0-?f38 ");
add(L"f41", L"?f38 +0-5400000");
add(L"f42", L"5400000+?f38 -0");
add(L"f43", L"logheight");
add(L"f44", L"logwidth");
add(L"f45", L"logheight");
add(L"f46", L"(?f39 )/60000.0");
add(L"f47", L"(?f34 )/60000.0");
add(L"f48", L"(16200000)/60000.0");
add(L"f49", L"(?f33 )/60000.0");
add(L"f50", L"(?f40 )/60000.0");
add(L"f51", L"(?f41 )/60000.0");
add(L"f52", L"(10800000)/60000.0");
add(L"f53", L"(?f42 )/60000.0");
add(L"f54", L"(?f40 )/60000.0");
add(L"f55", L"(?f41 )/60000.0");
add(L"f56", L"(10800000)/60000.0");
add(L"f57", L"(5400000)/60000.0");
add(L"f58", L"(16200000)/60000.0");
add(L"f59", L"(?f33 )/60000.0");
add(L"f60", L"(?f39 )/60000.0");
add(L"f61", L"(?f34 )/60000.0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"0 ?f2";
h.y_maximum= L"51965";
h.y_minimum= L"0";
_handle h1, h2;
h1.position = L"?f25 ?f32";
h1.x_maximum= L"$1";
h1.x_minimum= L"0";
handles.push_back(h1);
h1.position = L"?f28 ?f43";
h1.x_maximum= L"?f1";
h1.x_minimum= L"0";
handles.push_back(h1);
h2.position = L"?f44 ?f32";
h2.y_maximum= L"?f15";
h2.y_minimum= L"0";
handles.push_back(h2);
handles.push_back(h);
}
};
class oox_shape_CurvedUpArrow : public oox_shape
{
public:
oox_shape_CurvedUpArrow()
{
odf_type_name =L"ooxml-curvedUpArrow";
enhanced_path = L"M ?f31 0 L ?f29 ?f32 ?f25 ?f32 G ?f8 ?f46 ?f47 ?f48 ?f8 ?f46 ?f49 ?f50 L ?f28 ?f32 Z S N M ?f8 ?f45 G ?f8 ?f46 ?f51 ?f52 L ?f4 0 G ?f8 ?f46 ?f53 ?f54 Z I S N M ?f36 ?f35 G ?f8 ?f46 ?f55 ?f56 L ?f28 ?f32 ?f31 0 ?f29 ?f32 ?f25 ?f32 G ?f8 ?f46 ?f57 ?f58 L ?f8 ?f45 G ?f8 ?f46 ?f59 ?f60 L ?f4 0 G ?f8 ?f46 ?f61 ?f62 F N";
text_areas = L"0 0 ?f44 ?f45";
view_box = L"0 0 0 0";
modifiers = L"25000 50000 25000";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"50000*logwidth/?f0 ");
add(L"f2", L"if(0-$1 ,0,if(?f1 -$1 ,$1 ,?f1 ))");
add(L"f3", L"if(0-$0 ,0,if(100000-$0 ,$0 ,100000))");
add(L"f4", L"?f0 *?f3 /100000");
add(L"f5", L"?f0 *?f2 /100000");
add(L"f6", L"(?f4 +?f5 )/4");
add(L"f7", L"logwidth/2");
add(L"f8", L"?f7 +0-?f6 ");
add(L"f9", L"?f8 *2/1");
add(L"f10", L"?f9 *?f9 /1");
add(L"f11", L"?f4 *?f4 /1");
add(L"f12", L"?f10 +0-?f11 ");
add(L"f13", L"sqrt(?f12 )");
add(L"f14", L"?f13 *logheight/?f9 ");
add(L"f15", L"100000*?f14 /?f0 ");
add(L"f16", L"if(0-$2 ,0,if(?f15 -$2 ,$2 ,?f15 ))");
add(L"f17", L"?f0 *$2 /100000");
add(L"f18", L"?f8 +?f4 -0");
add(L"f19", L"logheight*logheight/1");
add(L"f20", L"?f17 *?f17 /1");
add(L"f21", L"?f19 +0-?f20 ");
add(L"f22", L"sqrt(?f21 )");
add(L"f23", L"?f22 *?f8 /logheight");
add(L"f24", L"?f8 +?f23 -0");
add(L"f25", L"?f18 +?f23 -0");
add(L"f26", L"?f5 +0-?f4 ");
add(L"f27", L"?f26 *1/2");
add(L"f28", L"?f24 +0-?f27 ");
add(L"f29", L"?f25 +?f27 -0");
add(L"f30", L"?f5 *1/2");
add(L"f31", L"logwidth+0-?f30 ");
add(L"f32", L"0+?f17 -0");
add(L"f33", L"(10800000*atan2(?f23 ,?f17 ))/pi");
add(L"f34", L"0+0-?f33 ");
add(L"f35", L"0+?f14 -0");
add(L"f36", L"(?f8 +?f18 )/2");
add(L"f37", L"?f4 *1/2");
add(L"f38", L"(10800000*atan2(?f37 ,?f14 ))/pi");
add(L"f39", L"?f38 +0-?f33 ");
add(L"f40", L"0+0-?f39 ");
add(L"f41", L"5400000+0-?f33 ");
add(L"f42", L"?f33 +?f38 -0");
add(L"f43", L"5400000+0-?f38 ");
add(L"f44", L"logwidth");
add(L"f45", L"logheight");
add(L"f46", L"logheight");
add(L"f47", L"(?f41 )/60000.0");
add(L"f48", L"(?f42 )/60000.0");
add(L"f49", L"(?f43 )/60000.0");
add(L"f50", L"(?f39 )/60000.0");
add(L"f51", L"(5400000)/60000.0");
add(L"f52", L"(5400000)/60000.0");
add(L"f53", L"(10800000)/60000.0");
add(L"f54", L"(-5400000)/60000.0");
add(L"f55", L"(?f43 )/60000.0");
add(L"f56", L"(?f39 )/60000.0");
add(L"f57", L"(?f41 )/60000.0");
add(L"f58", L"(?f33 )/60000.0");
add(L"f59", L"(5400000)/60000.0");
add(L"f60", L"(5400000)/60000.0");
add(L"f61", L"(10800000)/60000.0");
add(L"f62", L"(-5400000)/60000.0");
/////////////////////////////////////////////////////////
_handle h1, h2;
h1.position = L"?f25 ?f32";
h1.x_maximum= L"?f2";
h1.x_minimum= L"0";
handles.push_back(h1);
h1.position = L"?f28 0";
h1.x_maximum= L"?f1";
h1.x_minimum= L"0";
handles.push_back(h1);
h2.position = L"?f44 ?f32";
h2.y_maximum= L"?f15";
h2.y_minimum= L"0";
handles.push_back(h2);
}
};
}

View File

@ -30,11 +30,12 @@
*
*/
#include "../oox_shape_defines.h"
// shapetypeMathDivide,
// shapetypeMathEqual,
// shapetypeMathMinus,
//+ // shapetypeMathMultiply,
// shapetypeMathNotEqual,
//+ shapetypeMathDivide,
//+ shapetypeMathEqual,
//+ shapetypeMathMinus,
//+ shapetypeMathMultiply,
//+ shapetypeMathPlus,
//+ shapetypeMathNotEqual,
namespace cpdoccore
{
class oox_shape_mathMultiply : public oox_shape
@ -117,4 +118,259 @@ public:
handles.push_back(h);
}
};
class oox_shape_mathEqual : public oox_shape
{
public:
oox_shape_mathEqual()
{
odf_type_name =L"ooxml-mathEqual";
enhanced_path = L"M ?f13 ?f10 L ?f14 ?f10 ?f14 ?f8 ?f13 ?f8 Z M ?f13 ?f9 L ?f14 ?f9 ?f14 ?f11 ?f13 ?f11 Z N";
text_areas = L"?f13 ?f10 ?f14 ?f11";
view_box = L"0 0 0 0";
modifiers = L"23520 11760";
add(L"f0", L"if(0-$0 ,0,if(36745-$0 ,$0 ,36745))");
add(L"f1", L"?f0 *2/1");
add(L"f2", L"100000+0-2");
add(L"f3", L"if(0-$1 ,0,if(?f2 -$1 ,$1 ,?f2 ))");
add(L"f4", L"logheight*?f0 /100000");
add(L"f5", L"logheight*?f3 /200000");
add(L"f6", L"logwidth*73490/200000");
add(L"f7", L"logheight/2");
add(L"f8", L"?f7 +0-?f5 ");
add(L"f9", L"?f7 +?f5 -0");
add(L"f10", L"?f8 +0-?f4 ");
add(L"f11", L"?f9 +?f4 -0");
add(L"f12", L"logwidth/2");
add(L"f13", L"?f12 +0-?f6 ");
add(L"f14", L"?f12 +?f6 -0");
add(L"f15", L"(?f10 +?f8 )/2");
add(L"f16", L"(?f9 +?f11 )/2");
add(L"f17", L"logwidth");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"0 ?f10";
h.y_maximum= L"36745";
h.y_minimum= L"0";
handles.push_back(h);
h.position = L"?f17 ?f8";
h.y_maximum= L"?f2";
h.y_minimum= L"0";
handles.push_back(h);
}
};
class oox_shape_mathDivide : public oox_shape
{
public:
oox_shape_mathDivide()
{
odf_type_name =L"ooxml-mathDivide";
enhanced_path = L"M ?f20 ?f18 G ?f11 ?f11 ?f25 ?f26 Z M ?f20 ?f19 G ?f11 ?f11 ?f27 ?f28 Z M ?f21 ?f14 L ?f22 ?f14 ?f22 ?f15 ?f21 ?f15 Z N";
text_areas = L"?f21 ?f14 ?f22 ?f15";
view_box = L"0 0 0 0";
modifiers = L"23520 5880 11760";
add(L"f0", L"if(1000-$0 ,1000,if(36745-$0 ,$0 ,36745))");
add(L"f1", L"0+0-?f0 ");
add(L"f2", L"(73490+?f1 )/4");
add(L"f3", L"36745*logwidth/logheight");
add(L"f4", L"min(?f2 ,?f3 )");
add(L"f5", L"if(1000-$2 ,1000,if(?f4 -$2 ,$2 ,?f4 ))");
add(L"f6", L"-4*?f5 /1");
add(L"f7", L"73490+?f6 -?f0 ");
add(L"f8", L"if(0-$1 ,0,if(?f7 -$1 ,$1 ,?f7 ))");
add(L"f9", L"logheight*?f0 /200000");
add(L"f10", L"logheight*?f8 /100000");
add(L"f11", L"logheight*?f5 /100000");
add(L"f12", L"logwidth*73490/200000");
add(L"f13", L"logheight/2");
add(L"f14", L"?f13 +0-?f9 ");
add(L"f15", L"?f13 +?f9 -0");
add(L"f16", L"?f10 +?f11 -0");
add(L"f17", L"?f14 +0-?f16 ");
add(L"f18", L"?f17 +0-?f11 ");
add(L"f19", L"logheight+0-?f18 ");
add(L"f20", L"logwidth/2");
add(L"f21", L"?f20 +0-?f12 ");
add(L"f22", L"?f20 +?f12 -0");
add(L"f23", L"?f20 +0-?f11 ");
add(L"f24", L"logwidth");
add(L"f25", L"(16200000)/60000.0");
add(L"f26", L"(21600000)/60000.0");
add(L"f27", L"(5400000)/60000.0");
add(L"f28", L"(21600000)/60000.0");
/////////////////////////////////////////////////////////
_handle h, h1;
h.position = L"0 ?f14";
h.y_maximum= L"36745";
h.y_minimum= L"1000";
handles.push_back(h);
h.position = L"?f24 ?f17";
h.y_maximum= L"?f7";
h.y_minimum= L"0";
handles.push_back(h);
h1.position = L"?f23 0";
h1.x_maximum= L"?f4";
h1.x_minimum= L"1000";
handles.push_back(h1);
}
};
class oox_shape_mathNotEqual : public oox_shape
{
public:
oox_shape_mathNotEqual()
{
odf_type_name =L"ooxml-mathNotEqual";
enhanced_path = L"M ?f9 ?f14 L ?f24 ?f14 ?f43 ?f47 ?f42 ?f46 ?f34 ?f14 ?f10 ?f14 ?f10 ?f12 ?f35 ?f12 ?f36 ?f13 ?f10 ?f13 ?f10 ?f15 ?f37 ?f15 ?f49 ?f51 ?f48 ?f50 ?f30 ?f15 ?f9 ?f15 ?f9 ?f13 ?f28 ?f13 ?f26 ?f12 ?f9 ?f12 Z N";
text_areas = L"?f9 ?f14 ?f10 ?f15";
view_box = L"0 0 0 0";
modifiers = L"23520 6600000 11760";
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
add(L"f1", L"if(4200000-$1 ,4200000,if(6600000-$1 ,$1 ,6600000))");
add(L"f2", L"?f0 *2/1");
add(L"f3", L"100000+0-2");
add(L"f4", L"if(0-$2 ,0,if(?f3 -$2 ,$2 ,?f3 ))");
add(L"f5", L"logheight*?f0 /100000");
add(L"f6", L"logheight*?f4 /200000");
add(L"f7", L"logwidth*73490/200000");
add(L"f8", L"logwidth/2");
add(L"f9", L"?f8 +0-?f7 ");
add(L"f10", L"?f8 +?f7 -0");
add(L"f11", L"logheight/2");
add(L"f12", L"?f11 +0-?f6 ");
add(L"f13", L"?f11 +?f6 -0");
add(L"f14", L"?f12 +0-?f5 ");
add(L"f15", L"?f13 +?f5 -0");
add(L"f16", L"?f1 +0-5400000");
add(L"f17", L"logheight/2");
add(L"f18", L"?f17 *tan(pi*(?f16 )/10800000)");
add(L"f19", L"sqrt(?f18 *?f18 +?f17 *?f17 +0*0)");
add(L"f20", L"?f19 *?f5 /?f17 ");
add(L"f21", L"?f20 *1/2");
add(L"f22", L"?f8 +?f18 -?f21 ");
add(L"f23", L"?f18 *?f14 /?f17 ");
add(L"f24", L"?f22 +0-?f23 ");
add(L"f25", L"?f18 *?f12 /?f17 ");
add(L"f26", L"?f22 +0-?f25 ");
add(L"f27", L"?f18 *?f13 /?f17 ");
add(L"f28", L"?f22 +0-?f27 ");
add(L"f29", L"?f18 *?f15 /?f17 ");
add(L"f30", L"?f22 +0-?f29 ");
add(L"f31", L"?f18 *2/1");
add(L"f32", L"?f22 +0-?f31 ");
add(L"f33", L"?f22 +?f20 -0");
add(L"f34", L"?f24 +?f20 -0");
add(L"f35", L"?f26 +?f20 -0");
add(L"f36", L"?f28 +?f20 -0");
add(L"f37", L"?f30 +?f20 -0");
add(L"f38", L"?f32 +?f20 -0");
add(L"f39", L"?f5 *?f17 /?f19 ");
add(L"f40", L"?f22 +?f39 -0");
add(L"f41", L"?f33 +0-?f39 ");
add(L"f42", L"if(?f16 ,?f40 ,?f33 )");
add(L"f43", L"if(?f16 ,?f22 ,?f41 )");
add(L"f44", L"?f5 *?f18 /?f19 ");
add(L"f45", L"0+0-?f44 ");
add(L"f46", L"if(?f16 ,?f44 ,0)");
add(L"f47", L"if(?f16 ,0,?f45 )");
add(L"f48", L"logwidth+0-?f42 ");
add(L"f49", L"logwidth+0-?f43 ");
add(L"f50", L"logheight+0-?f46 ");
add(L"f51", L"logheight+0-?f47 ");
add(L"f52", L"(?f42 +?f43 )/2");
add(L"f53", L"(?f49 +?f48 )/2");
add(L"f54", L"(?f46 +?f47 )/2");
add(L"f55", L"(?f14 +?f12 )/2");
add(L"f56", L"(?f13 +?f15 )/2");
add(L"f57", L"(?f51 +?f50 )/2");
add(L"f58", L"logwidth");
/////////////////////////////////////////////////////////
_handle h, h1;
h.position = L"0 ?f14";
h.y_maximum= L"50000";
h.y_minimum= L"0";
handles.push_back(h);
h1.position = L"?f43 0";
handles.push_back(h1);
h.position = L"?f58 ?f12";
h.y_maximum= L"?f3";
h.y_minimum= L"0";
handles.push_back(h);
}
};
class oox_shape_mathPlus : public oox_shape
{
public:
oox_shape_mathPlus()
{
odf_type_name =L"ooxml-mathPlus";
enhanced_path = L"?f6 ?f12 L ?f7 ?f12 ?f7 ?f11 ?f8 ?f11 ?f8 ?f12 ?f9 ?f12 ?f9 ?f13 ?f8 ?f13 ?f8 ?f14 ?f7 ?f14 ?f7 ?f13 ?f6 ?f13 Z N";
text_areas = L"?f6 ?f12 ?f9 ?f13";
view_box = L"0 0 0 0";
modifiers = L"23520";
add(L"f0", L"if(0-$0 ,0,if(73490-$0 ,$0 ,73490))");
add(L"f1", L"logwidth*73490/200000");
add(L"f2", L"logheight*73490/200000");
add(L"f3", L"min(logwidth,logheight)");
add(L"f4", L"?f3 *?f0 /200000");
add(L"f5", L"logwidth/2");
add(L"f6", L"?f5 +0-?f1 ");
add(L"f7", L"?f5 +0-?f4 ");
add(L"f8", L"?f5 +?f4 -0");
add(L"f9", L"?f5 +?f1 -0");
add(L"f10", L"logheight/2");
add(L"f11", L"?f10 +0-?f2 ");
add(L"f12", L"?f10 +0-?f4 ");
add(L"f13", L"?f10 +?f4 -0");
add(L"f14", L"?f10 +?f2 -0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"0 ?f12";
h.y_maximum= L"73490";
h.y_minimum= L"0";
handles.push_back(h);
}
};
class oox_shape_mathMinus : public oox_shape
{
public:
oox_shape_mathMinus()
{
odf_type_name =L"ooxml-mathMinus";
enhanced_path = L"M ?f7 ?f4 L ?f8 ?f4 ?f8 ?f5 ?f7 ?f5 Z N";
text_areas = L"?f7 ?f4 ?f8 ?f5";
view_box = L"0 0 0 0";
modifiers = L"23520";
add(L"f0", L"if(0-$0 ,0,if(100000-$0 ,$0 ,100000))");
add(L"f1", L"logheight*?f0 /200000");
add(L"f2", L"logwidth*73490/200000");
add(L"f3", L"logheight/2");
add(L"f4", L"?f3 +0-?f1 ");
add(L"f5", L"?f3 +?f1 -0");
add(L"f6", L"logwidth/2");
add(L"f7", L"?f6 +0-?f2 ");
add(L"f8", L"?f6 +?f2 -0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"0 ?f4";
h.y_maximum= L"100000";
h.y_minimum= L"0";
handles.push_back(h);
}
};
}

View File

@ -29,12 +29,15 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
// shapetypeArc,
// shapetypeChord,
// shapetypeCorner,
//+ shapetypeArc,
//+ shapetypeBevel,
//+ shapetypeChevron,
//+ shapetypeChord,
//+ shapetypeCorner,
// shapetypeCornerTabs,
// shapetypeDecagon,
// shapetypeDiagStripe,
//+ shapetypeDiamond
// shapetypeDodecagon,
//+ shapetypeDoubleWave,
//+ shapetypeFunnel,
@ -42,13 +45,19 @@
//+ shapetypeGear9,
// shapetypeHalfFrame,
// shapetypeHeptagon,
//+ shapetypeHomePlate,
// shapetypeNonIsoscelesTrapezoid,
// shapetypePie,
//+ shapetypeParallelogram
//+ shapetypePie,
//+ shapetypePieWedge,
//+ shapetypePlaque,
// shapetypePlaqueTabs,
// shapetypeSquareTabs,
// shapetypeTeardrop,
// shapetypeTeardrop
//+ shapetypeTriangle
//+ shapetypeTrapezoid
//+ shapetypeBlockArc
//+ shapetypeDonut
#include "../oox_shape_defines.h"
@ -764,7 +773,7 @@ class oox_shape_PieWedge : public oox_shape
public:
oox_shape_PieWedge()
{
odf_type_name =L"ooxml-PieWedge";
odf_type_name =L"ooxml-pieWedge";
enhanced_path = L"M 0 ?f7 G ?f8 ?f9 ?f10 ?f11 L ?f4 ?f7 Z N";
text_areas = L"?f2 ?f3 ?f4 ?f7";
@ -785,4 +794,692 @@ public:
/////////////////////////////////////////////////////////
}
};
}
class oox_shape_Pie : public oox_shape
{
public:
oox_shape_Pie()
{
odf_type_name =L"ooxml-pie";
enhanced_path = L"M ?f12 ?f14 G ?f5 ?f7 ?f29 ?f30 L ?f11 ?f13 Z N";
text_areas = L"?f23 ?f24 ?f25 ?f26";
view_box = L"0 0 0 0";
modifiers = L"9000000 16200000";
add(L"f0", L"if(0-$0 ,0,if(21599999-$0 ,$0 ,21599999))");
add(L"f1", L"if(0-$1 ,0,if(21599999-$1 ,$1 ,21599999))");
add(L"f2", L"?f1 +0-?f0 ");
add(L"f3", L"?f2 +21600000-0");
add(L"f4", L"if(?f2 ,?f2 ,?f3 )");
add(L"f5", L"logwidth/2");
add(L"f6", L"?f5 *sin(pi*(?f0 )/10800000)");
add(L"f7", L"logheight/2");
add(L"f8", L"?f7 *cos(pi*(?f0 )/10800000)");
add(L"f9", L"?f5 *(cos(atan2(?f6 ,?f8 )))");
add(L"f10", L"?f7 *(sin(atan2(?f6 ,?f8 )))");
add(L"f11", L"logwidth/2");
add(L"f12", L"?f11 +?f9 -0");
add(L"f13", L"logheight/2");
add(L"f14", L"?f13 +?f10 -0");
add(L"f15", L"?f5 *sin(pi*(?f1 )/10800000)");
add(L"f16", L"?f7 *cos(pi*(?f1 )/10800000)");
add(L"f17", L"?f5 *(cos(atan2(?f15 ,?f16 )))");
add(L"f18", L"?f7 *(sin(atan2(?f15 ,?f16 )))");
add(L"f19", L"?f11 +?f17 -0");
add(L"f20", L"?f13 +?f18 -0");
add(L"f21", L"?f5 *cos(pi*(2700000)/10800000)");
add(L"f22", L"?f7 *sin(pi*(2700000)/10800000)");
add(L"f23", L"?f11 +0-?f21 ");
add(L"f24", L"?f11 +?f21 -0");
add(L"f25", L"?f13 +0-?f22 ");
add(L"f26", L"?f13 +?f22 -0");
add(L"f27", L"logwidth");
add(L"f28", L"logheight");
add(L"f29", L"(?f0 )/60000.0");
add(L"f30", L"(?f4 )/60000.0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f12 ?f14";
handles.push_back(h);
h.position = L"?f19 ?f20";
handles.push_back(h);
}
};
class oox_shape_BlockArc : public oox_shape
{
public:
oox_shape_BlockArc()
{
odf_type_name =L"ooxml-blockArc";
enhanced_path = L"M ?f18 ?f20 G ?f7 ?f9 ?f76 ?f77 L ?f35 ?f36 G ?f25 ?f26 ?f78 ?f79 Z N";
text_areas = L"f60 ?f68 ?f44 ?f52";
modifiers = L"13500000 10800000 12740";
view_box = L"0 0 0 0";
add(L"f0", L"if(0-$0 ,0,if(21599999-$0 ,$0 ,21599999))");
add(L"f1", L"if(0-$1 ,0,if(21599999-$1 ,$1 ,21599999))");
add(L"f2", L"if(0-$2 ,0,if(50000-$2 ,$2 ,50000))");
add(L"f3", L"?f1 +0-?f0 ");
add(L"f4", L"?f3 +21600000-0");
add(L"f5", L"if(?f3 ,?f3 ,?f4 )");
add(L"f6", L"0+0-?f5 ");
add(L"f7", L"logwidth/2");
add(L"f8", L"?f7 *sin(pi*(?f0 )/10800000)");
add(L"f9", L"logheight/2");
add(L"f10", L"?f9 *cos(pi*(?f0 )/10800000)");
add(L"f11", L"?f7 *sin(pi*(?f1 )/10800000)");
add(L"f12", L"?f9 *cos(pi*(?f1 )/10800000)");
add(L"f13", L"?f7 *(cos(atan2(?f8 ,?f10 )))");
add(L"f14", L"?f9 *(sin(atan2(?f8 ,?f10 )))");
add(L"f15", L"?f7 *(cos(atan2(?f11 ,?f12 )))");
add(L"f16", L"?f9 *(sin(atan2(?f11 ,?f12 )))");
add(L"f17", L"logwidth/2");
add(L"f18", L"?f17 +?f13 -0");
add(L"f19", L"logheight/2");
add(L"f20", L"?f19 +?f14 -0");
add(L"f21", L"?f17 +?f15 -0");
add(L"f22", L"?f19 +?f16 -0");
add(L"f23", L"min(logwidth,logheight)");
add(L"f24", L"?f23 *?f2 /100000");
add(L"f25", L"?f7 +0-?f24 ");
add(L"f26", L"?f9 +0-?f24 ");
add(L"f27", L"?f25 *sin(pi*(?f1 )/10800000)");
add(L"f28", L"?f26 *cos(pi*(?f1 )/10800000)");
add(L"f29", L"?f25 *sin(pi*(?f0 )/10800000)");
add(L"f30", L"?f26 *cos(pi*(?f0 )/10800000)");
add(L"f31", L"?f25 *(cos(atan2(?f27 ,?f28 )))");
add(L"f32", L"?f26 *(sin(atan2(?f27 ,?f28 )))");
add(L"f33", L"?f25 *(cos(atan2(?f29 ,?f30 )))");
add(L"f34", L"?f26 *(sin(atan2(?f29 ,?f30 )))");
add(L"f35", L"?f17 +?f31 -0");
add(L"f36", L"?f19 +?f32 -0");
add(L"f37", L"?f17 +?f33 -0");
add(L"f38", L"?f19 +?f34 -0");
add(L"f39", L"21600000+0-?f0 ");
add(L"f40", L"?f5 +0-?f39 ");
add(L"f41", L"max(?f18 ,?f35 )");
add(L"f42", L"max(?f21 ,?f37 )");
add(L"f43", L"max(?f41 ,?f42 )");
add(L"f44", L"if(?f40 ,logwidth,?f43 )");
add(L"f45", L"5400000+0-?f0 ");
add(L"f46", L"27000000+0-?f0 ");
add(L"f47", L"if(?f45 ,?f45 ,?f46 )");
add(L"f48", L"?f5 +0-?f47 ");
add(L"f49", L"max(?f20 ,?f36 )");
add(L"f50", L"max(?f22 ,?f38 )");
add(L"f51", L"max(?f49 ,?f50 )");
add(L"f52", L"if(?f48 ,logheight,?f51 )");
add(L"f53", L"10800000+0-?f0 ");
add(L"f54", L"32400000+0-?f0 ");
add(L"f55", L"if(?f53 ,?f53 ,?f54 )");
add(L"f56", L"?f5 +0-?f55 ");
add(L"f57", L"min(?f18 ,?f35 )");
add(L"f58", L"min(?f21 ,?f37 )");
add(L"f59", L"min(?f57 ,?f58 )");
add(L"f60", L"if(?f56 ,0,?f59 )");
add(L"f61", L"16200000+0-?f0 ");
add(L"f62", L"37800000+0-?f0 ");
add(L"f63", L"if(?f61 ,?f61 ,?f62 )");
add(L"f64", L"?f5 +0-?f63 ");
add(L"f65", L"min(?f20 ,?f36 )");
add(L"f66", L"min(?f22 ,?f38 )");
add(L"f67", L"min(?f65 ,?f66 )");
add(L"f68", L"if(?f64 ,0,?f67 )");
add(L"f69", L"(?f18 +?f37 )/2");
add(L"f70", L"(?f20 +?f38 )/2");
add(L"f71", L"(?f21 +?f35 )/2");
add(L"f72", L"(?f22 +?f36 )/2");
add(L"f73", L"?f0 +0-5400000");
add(L"f74", L"?f1 +5400000-0");
add(L"f75", L"(?f73 +?f74 )/2");
add(L"f76", L"(?f0 )/60000.0");
add(L"f77", L"(?f5 )/60000.0");
add(L"f78", L"(?f1 )/60000.0");
add(L"f79", L"(?f6 )/60000.0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f18 ?f20";
handles.push_back(h);
h.position = L"?f35 ?f36";
h.r_minimum = L"0";
h.r_maximum = L"50000";
handles.push_back(h);
}
};
class oox_shape_Corner : public oox_shape
{
public:
oox_shape_Corner()
{
odf_type_name =L"ooxml-corner";
enhanced_path = L"M 0 0 L ?f5 0 ?f5 ?f7 ?f13 ?f7 ?f13 ?f15 0 ?f15 Z N";
text_areas = L"0 ?f11 ?f12 ?f15";
view_box = L"0 0 0 0";
modifiers = L"16120 16110";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"100000*logheight/?f0 ");
add(L"f2", L"100000*logwidth/?f0 ");
add(L"f3", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
add(L"f4", L"if(0-$1 ,0,if(?f2 -$1 ,$1 ,?f2 ))");
add(L"f5", L"?f0 *?f4 /100000");
add(L"f6", L"?f0 *?f3 /100000");
add(L"f7", L"logheight+0-?f6 ");
add(L"f8", L"?f5 *1/2");
add(L"f9", L"(?f7 +logheight)/2");
add(L"f10", L"logwidth+0-logheight");
add(L"f11", L"if(?f10 ,?f7 ,0)");
add(L"f12", L"if(?f10 ,logwidth,?f5 )");
add(L"f13", L"logwidth");
add(L"f14", L"logwidth/2");
add(L"f15", L"logheight");
add(L"f16", L"logheight/2");
/////////////////////////////////////////////////////////
_handle h1, h2;
h1.position = L"0 ?f7";
h1.y_minimum = L"0";
h1.y_maximum = L"?f1";
handles.push_back(h1);
h2.position = L"?f5 0";
h2.x_minimum = L"0";
h2.x_maximum = L"?f2";
handles.push_back(h2);
}
};
class oox_shape_Chord : public oox_shape
{
public:
oox_shape_Chord()
{
odf_type_name =L"ooxml-chord";
enhanced_path = L"M ?f16 ?f18 G ?f5 ?f7 ?f31 ?f32 Z N";
text_areas = L"?f27 ?f29 ?f28 ?f30";
view_box = L"0 0 0 0";
modifiers = L"1168272 9631728";
add(L"f0", L"if(0-$0 ,0,if(21599999-$0 ,$0 ,21599999))");
add(L"f1", L"if(0-$1 ,0,if(21599999-$1 ,$1 ,21599999))");
add(L"f2", L"?f1 +0-?f0 ");
add(L"f3", L"?f2 +21600000-0");
add(L"f4", L"if(?f2 ,?f2 ,?f3 )");
add(L"f5", L"logwidth/2");
add(L"f6", L"?f5 *sin(pi*(?f0 )/10800000)");
add(L"f7", L"logheight/2");
add(L"f8", L"?f7 *cos(pi*(?f0 )/10800000)");
add(L"f9", L"?f5 *(cos(atan2(?f6 ,?f8 )))");
add(L"f10", L"?f7 *(sin(atan2(?f6 ,?f8 )))");
add(L"f11", L"?f5 *sin(pi*(?f1 )/10800000)");
add(L"f12", L"?f7 *cos(pi*(?f1 )/10800000)");
add(L"f13", L"?f5 *(cos(atan2(?f11 ,?f12 )))");
add(L"f14", L"?f7 *(sin(atan2(?f11 ,?f12 )))");
add(L"f15", L"logwidth/2");
add(L"f16", L"?f15 +?f9 -0");
add(L"f17", L"logheight/2");
add(L"f18", L"?f17 +?f10 -0");
add(L"f19", L"?f15 +?f13 -0");
add(L"f20", L"?f17 +?f14 -0");
add(L"f21", L"(?f16 +?f19 )/2");
add(L"f22", L"(?f18 +?f20 )/2");
add(L"f23", L"?f4 *1/2");
add(L"f24", L"?f0 +?f23 -10800000");
add(L"f25", L"?f5 *cos(pi*(2700000)/10800000)");
add(L"f26", L"?f7 *sin(pi*(2700000)/10800000)");
add(L"f27", L"?f15 +0-?f25 ");
add(L"f28", L"?f15 +?f25 -0");
add(L"f29", L"?f17 +0-?f26 ");
add(L"f30", L"?f17 +?f26 -0");
add(L"f31", L"(?f0 )/60000.0");
add(L"f32", L"(?f4 )/60000.0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f16 ?f18";
handles.push_back(h);
h.position = L"?f19 ?f20";
handles.push_back(h);
}
};
class oox_shape_Donut : public oox_shape
{
public:
oox_shape_Donut()
{
odf_type_name =L"ooxml-donut";
enhanced_path = L"M 0 ?f12 G ?f3 ?f5 ?f17 ?f18 ?f3 ?f5 ?f19 ?f20 ?f3 ?f5 ?f21 ?f22 ?f3 ?f5 ?f23 ?f24 Z M ?f2 ?f12 G ?f4 ?f6 ?f25 ?f26 ?f4 ?f6 ?f27 ?f28 ?f4 ?f6 ?f29 ?f30 ?f4 ?f6 ?f31 ?f32 Z N";
text_areas = L"?f10 ?f13 ?f11 ?f14";
view_box = L"0 0 0 0";
modifiers = L"20000";
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
add(L"f1", L"min(logwidth,logheight)");
add(L"f2", L"?f1 *?f0 /100000");
add(L"f3", L"logwidth/2");
add(L"f4", L"?f3 +0-?f2 ");
add(L"f5", L"logheight/2");
add(L"f6", L"?f5 +0-?f2 ");
add(L"f7", L"?f3 *cos(pi*(2700000)/10800000)");
add(L"f8", L"?f5 *sin(pi*(2700000)/10800000)");
add(L"f9", L"logwidth/2");
add(L"f10", L"?f9 +0-?f7 ");
add(L"f11", L"?f9 +?f7 -0");
add(L"f12", L"logheight/2");
add(L"f13", L"?f12 +0-?f8 ");
add(L"f14", L"?f12 +?f8 -0");
add(L"f15", L"logheight");
add(L"f16", L"logwidth");
add(L"f17", L"(10800000)/60000.0");
add(L"f18", L"(5400000)/60000.0");
add(L"f19", L"(16200000)/60000.0");
add(L"f20", L"(5400000)/60000.0");
add(L"f21", L"(0)/60000.0");
add(L"f22", L"(5400000)/60000.0");
add(L"f23", L"(5400000)/60000.0");
add(L"f24", L"(5400000)/60000.0");
add(L"f25", L"(10800000)/60000.0");
add(L"f26", L"(-5400000)/60000.0");
add(L"f27", L"(5400000)/60000.0");
add(L"f28", L"(-5400000)/60000.0");
add(L"f29", L"(0)/60000.0");
add(L"f30", L"(-5400000)/60000.0");
add(L"f31", L"(16200000)/60000.0");
add(L"f32", L"(-5400000)/60000.0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f2 ?f12";
h.r_minimum = L"0";
h.r_maximum = L"50000";
handles.push_back(h);
}
};
class oox_shape_Chevron : public oox_shape
{
public:
oox_shape_Chevron()
{
odf_type_name =L"ooxml-chevron";
enhanced_path = L"M 0 0 L ?f4 0 ?f11 ?f9 ?f4 ?f10 0 ?f10 ?f3 ?f9 Z N";
text_areas = L"?f7 0 ?f8 ?f10";
view_box = L"0 0 0 0";
modifiers = L"50000";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"100000*logwidth/?f0 ");
add(L"f2", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
add(L"f3", L"?f0 *?f2 /100000");
add(L"f4", L"logwidth+0-?f3 ");
add(L"f5", L"?f4 *1/2");
add(L"f6", L"?f4 +0-?f3 ");
add(L"f7", L"if(?f6 ,?f3 ,0)");
add(L"f8", L"if(?f6 ,?f4 ,logwidth)");
add(L"f9", L"logheight/2");
add(L"f10", L"logheight");
add(L"f11", L"logwidth");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f4 0";
h.x_minimum = L"0";
h.x_maximum = L"?f1";
handles.push_back(h);
}
};
class oox_shape_Arc : public oox_shape
{
public:
oox_shape_Arc()
{
odf_type_name =L"ooxml-arc";
enhanced_path = L"M ?f16 ?f18 G ?f5 ?f7 ?f46 ?f47 L ?f15 ?f17 Z S N M ?f16 ?f18 G ?f5 ?f7 ?f48 ?f49 F N";
text_areas = L"?f36 ?f42 ?f24 ?f30";
view_box = L"0 0 0 0";
modifiers = L"16200000 0";
add(L"f0", L"if(0-$0 ,0,if(21599999-$0 ,$0 ,21599999))");
add(L"f1", L"if(0-$1 ,0,if(21599999-$1 ,$1 ,21599999))");
add(L"f2", L"?f1 +0-?f0 ");
add(L"f3", L"?f2 +21600000-0");
add(L"f4", L"if(?f2 ,?f2 ,?f3 )");
add(L"f5", L"logwidth/2");
add(L"f6", L"?f5 *sin(pi*(?f0 )/10800000)");
add(L"f7", L"logheight/2");
add(L"f8", L"?f7 *cos(pi*(?f0 )/10800000)");
add(L"f9", L"?f5 *(cos(atan2(?f6 ,?f8 )))");
add(L"f10", L"?f7 *(sin(atan2(?f6 ,?f8 )))");
add(L"f11", L"?f5 *sin(pi*(?f1 )/10800000)");
add(L"f12", L"?f7 *cos(pi*(?f1 )/10800000)");
add(L"f13", L"?f5 *(cos(atan2(?f11 ,?f12 )))");
add(L"f14", L"?f7 *(sin(atan2(?f11 ,?f12 )))");
add(L"f15", L"logwidth/2");
add(L"f16", L"?f15 +?f9 -0");
add(L"f17", L"logheight/2");
add(L"f18", L"?f17 +?f10 -0");
add(L"f19", L"?f15 +?f13 -0");
add(L"f20", L"?f17 +?f14 -0");
add(L"f21", L"21600000+0-?f0 ");
add(L"f22", L"?f4 +0-?f21 ");
add(L"f23", L"max(?f16 ,?f19 )");
add(L"f24", L"if(?f22 ,logwidth,?f23 )");
add(L"f25", L"5400000+0-?f0 ");
add(L"f26", L"27000000+0-?f0 ");
add(L"f27", L"if(?f25 ,?f25 ,?f26 )");
add(L"f28", L"?f4 +0-?f27 ");
add(L"f29", L"max(?f18 ,?f20 )");
add(L"f30", L"if(?f28 ,logheight,?f29 )");
add(L"f31", L"10800000+0-?f0 ");
add(L"f32", L"32400000+0-?f0 ");
add(L"f33", L"if(?f31 ,?f31 ,?f32 )");
add(L"f34", L"?f4 +0-?f33 ");
add(L"f35", L"min(?f16 ,?f19 )");
add(L"f36", L"if(?f34 ,0,?f35 )");
add(L"f37", L"16200000+0-?f0 ");
add(L"f38", L"37800000+0-?f0 ");
add(L"f39", L"if(?f37 ,?f37 ,?f38 )");
add(L"f40", L"?f4 +0-?f39 ");
add(L"f41", L"min(?f18 ,?f20 )");
add(L"f42", L"if(?f40 ,0,?f41 )");
add(L"f43", L"?f0 +0-5400000");
add(L"f44", L"?f1 +5400000-0");
add(L"f45", L"(?f43 +?f44 )/2");
add(L"f46", L"(?f0 )/60000.0");
add(L"f47", L"(?f4 )/60000.0");
add(L"f48", L"(?f0 )/60000.0");
add(L"f49", L"(?f4 )/60000.0");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f16 ?f18";
handles.push_back(h);
h.position = L"?f19 ?f20";
handles.push_back(h);
}
};
class oox_shape_HomePlate : public oox_shape
{
public:
oox_shape_HomePlate()
{
odf_type_name =L"ooxml-homePlate";
enhanced_path = L"M 0 0 L ?f4 0 ?f9 ?f7 ?f4 ?f8 0 ?f8 Z N";
text_areas = L"0 0 ?f5 ?f8";
view_box = L"0 0 0 0";
modifiers = L"50000";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"100000*logwidth/?f0 ");
add(L"f2", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
add(L"f3", L"?f0 *?f2 /100000");
add(L"f4", L"logwidth+0-?f3 ");
add(L"f5", L"(?f4 +logwidth)/2");
add(L"f6", L"?f4 *1/2");
add(L"f7", L"logheight/2");
add(L"f8", L"logheight");
add(L"f9", L"logwidth");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f4 0";
h.x_minimum = L"0";
h.x_maximum = L"?f1";
handles.push_back(h);
}
};
class oox_shape_Bevel : public oox_shape
{
public:
oox_shape_Bevel()
{
odf_type_name =L"ooxml-bevel";
enhanced_path = L"M ?f2 ?f2 L ?f3 ?f2 ?f3 ?f4 ?f2 ?f4 Z S N M 0 0 L ?f5 0 ?f3 ?f2 ?f2 ?f2 Z K S N M 0 ?f8 L ?f2 ?f4 ?f3 ?f4 ?f5 ?f8 Z I S N M 0 0 L ?f2 ?f2 ?f2 ?f4 0 ?f8 Z J S N M ?f5 0 L ?f5 ?f8 ?f3 ?f4 ?f3 ?f2 Z H S N M 0 0 L ?f5 0 ?f5 ?f8 0 ?f8 Z M ?f2 ?f2 L ?f3 ?f2 ?f3 ?f4 ?f2 ?f4 Z M 0 0 L ?f2 ?f2 M 0 ?f8 L ?f2 ?f4 M ?f5 0 L ?f3 ?f2 M ?f5 ?f8 L ?f3 ?f4 F N";
text_areas = L"?f2 ?f2 ?f3 ?f4";
view_box = L"0 0 0 0";
modifiers = L"12500";
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
add(L"f1", L"min(logwidth,logheight)");
add(L"f2", L"?f1 *?f0 /100000");
add(L"f3", L"logwidth+0-?f2 ");
add(L"f4", L"logheight+0-?f2 ");
add(L"f5", L"logwidth");
add(L"f6", L"logheight/2");
add(L"f7", L"logwidth/2");
add(L"f8", L"logheight");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f2 0";
h.x_minimum = L"0";
h.x_maximum = L"50000";
handles.push_back(h);
}
};
class oox_shape_Trapezoid : public oox_shape
{
public:
oox_shape_Trapezoid()
{
odf_type_name =L"ooxml-trapezoid";
enhanced_path = L"M 0 ?f14 L ?f4 0 ?f5 0 ?f15 ?f14 Z N";
text_areas = L"?f8 ?f10 ?f11 ?f14";
view_box = L"0 0 0 0";
modifiers = L"25000";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"50000*logwidth/?f0");
add(L"f2", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
add(L"f3", L"?f0 *?f2 /200000");
add(L"f4", L"?f0 *?f2 /100000");
add(L"f5", L"logwidth+0-?f4");
add(L"f6", L"logwidth+0-?f3");
add(L"f7", L"logwidth/3");
add(L"f8", L"?f7 *?f2 /?f1");
add(L"f9", L"logheight/3");
add(L"f10", L"?f9 *?f2 /?f1");
add(L"f11", L"logwidth+0-?f8");
add(L"f12", L"logwidth/2");
add(L"f13", L"logheight/2");
add(L"f14", L"logheight");
add(L"f15", L"logwidth");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f4 0";
h.x_minimum = L"0";
h.x_maximum = L"?f1";
handles.push_back(h);
}
};
class oox_shape_Triangle : public oox_shape
{
public:
oox_shape_Triangle()
{
odf_type_name =L"ooxml-triangle";
enhanced_path = L"M 0 ?f6 L ?f2 0 ?f7 ?f6 Z N";
text_areas = L"?f1 ?f5 ?f4 ?f6";
view_box = L"0 0 0 0";
modifiers = L"50000";
add(L"f0", L"if(0-$0 ,0,if(100000-$0 ,$0 ,100000))");
add(L"f1", L"logwidth*?f0 /200000");
add(L"f2", L"logwidth*?f0 /100000");
add(L"f3", L"logwidth/2");
add(L"f4", L"?f1 +?f3 -0");
add(L"f5", L"logheight/2");
add(L"f6", L"logheight");
add(L"f7", L"logwidth");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f2 0";
h.x_minimum = L"0";
h.x_maximum = L"100000";
handles.push_back(h);
}
};
class oox_shape_Diamond : public oox_shape
{
public:
oox_shape_Diamond()
{
odf_type_name =L"ooxml-diamond";
enhanced_path = L"M 0 ?f3 L ?f2 0 ?f5 ?f3 ?f2 ?f4 Z N";
text_areas = L"?f6 ?f7 ?f0 ?f1";
view_box = L"0 0 0 0";
add(L"f0", L"logwidth*3/4");
add(L"f1", L"logheight*3/4");
add(L"f2", L"logwidth/2");
add(L"f3", L"logheight/2");
add(L"f4", L"logheight");
add(L"f5", L"logwidth");
add(L"f6", L"logwidth/4");
add(L"f7", L"logheight/4");
}
};
class oox_shape_Parallelogram : public oox_shape
{
public:
oox_shape_Parallelogram()
{
odf_type_name =L"ooxml-parallelogram";
enhanced_path = L"M 0 ?f22 L ?f4 0 ?f23 0 ?f6 ?f22 Z N";
text_areas = L"?f13 ?f14 ?f15 ?f16";
view_box = L"0 0 0 0";
modifiers = L"25000";
add(L"f0", L"min(logwidth,logheight)");
add(L"f1", L"100000*logwidth/?f0");
add(L"f2", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
add(L"f3", L"?f0 *?f2 /200000");
add(L"f4", L"?f0 *?f2 /100000");
add(L"f5", L"logwidth+0-?f3");
add(L"f6", L"logwidth+0-?f4");
add(L"f7", L"?f6 *1/2");
add(L"f8", L"logwidth+0-?f7");
add(L"f9", L"logwidth/2");
add(L"f10", L"?f9 *?f2 /?f1");
add(L"f11", L"5*?f2 /?f1 ");
add(L"f12", L"(1+?f11 )/12");
add(L"f13", L"?f12 *logwidth/1");
add(L"f14", L"?f12 *logheight/1");
add(L"f15", L"logwidth+0-?f13");
add(L"f16", L"logheight+0-?f14");
add(L"f17", L"logwidth/2");
add(L"f18", L"logheight*?f17 /?f4");
add(L"f19", L"if(0-?f18 ,0,if(logheight-?f18 ,?f18 ,logheight))");
add(L"f20", L"logheight+0-?f19");
add(L"f21", L"logheight/2");
add(L"f22", L"logheight");
add(L"f23", L"logwidth");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f4 0";
h.x_minimum = L"0";
h.x_maximum = L"?f1";
handles.push_back(h);
}
};
class oox_shape_RtTriangle : public oox_shape
{
public:
oox_shape_RtTriangle()
{
odf_type_name =L"ooxml-rtTriangle";
enhanced_path = L"M 0 ?f4 L 0 0 ?f6 ?f4 Z N";
text_areas = L"?f7 ?f0 ?f1 ?f2";
view_box = L"0 0 0 0";
add(L"f0", L"logheight*7/12");
add(L"f1", L"logwidth*7/12");
add(L"f2", L"logheight*11/12");
add(L"f3", L"logheight/2");
add(L"f4", L"logheight");
add(L"f5", L"logwidth/2");
add(L"f6", L"logwidth");
add(L"f7", L"logwidth/12");
}
};
class oox_shape_Plus : public oox_shape
{
public:
oox_shape_Plus()
{
odf_type_name =L"ooxml-plus";
enhanced_path = L"M 0 ?f2 L ?f2 ?f2 ?f2 0 ?f3 0 ?f3 ?f2 ?f13 ?f2 ?f13 ?f4 ?f3 ?f4 ?f3 ?f12 ?f2 ?f12 ?f2 ?f4 0 ?f4 Z N";
text_areas = L"?f6 ?f8 ?f7 ?f9";
view_box = L"0 0 0 0";
modifiers = L"25000";
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
add(L"f1", L"min(logwidth,logheight)");
add(L"f2", L"?f1 *?f0 /100000");
add(L"f3", L"logwidth+0-?f2 ");
add(L"f4", L"logheight+0-?f2 ");
add(L"f5", L"logwidth+0-logheight");
add(L"f6", L"if(?f5 ,0,?f2 )");
add(L"f7", L"if(?f5 ,logwidth,?f3 )");
add(L"f8", L"if(?f5 ,?f2 ,0)");
add(L"f9", L"if(?f5 ,?f4 ,logheight)");
add(L"f10", L"logwidth/2");
add(L"f11", L"logheight/2");
add(L"f12", L"logheight");
add(L"f13", L"logwidth");
/////////////////////////////////////////////////////////
_handle h;
h.position = L"?f2 0";
h.x_minimum = L"0";
h.x_maximum = L"50000";
handles.push_back(h);
}
};}

View File

@ -29,4 +29,83 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
//{ L"" , 7}, // shapetypeLeftRightRibbon,
//+ shapetypeLeftRightRibbon
namespace cpdoccore
{
class oox_shape_LeftRightRibbon : public oox_shape
{
public:
oox_shape_LeftRightRibbon()
{
odf_type_name =L"ooxml-leftRightRibbon";
enhanced_path = L"M 0 ?f16 L ?f9 0 ?f9 ?f14 ?f23 ?f14 G ?f4 ?f22 ?f30 ?f31 ?f4 ?f22 ?f32 ?f33 L ?f10 ?f21 ?f10 ?f19 ?f28 ?f17 ?f10 ?f29 ?f10 ?f15 ?f23 ?f15 G ?f4 ?f22 ?f34 ?f35 L ?f24 ?f20 ?f9 ?f20 ?f9 ?f18 Z S N M ?f25 ?f26 G ?f4 ?f22 ?f36 ?f37 ?f4 ?f22 ?f38 ?f39 L ?f25 ?f21 Z I S N M 0 ?f16 L ?f9 0 ?f9 ?f14 ?f23 ?f14 G ?f4 ?f22 ?f40 ?f41 ?f4 ?f22 ?f42 ?f43 L ?f10 ?f21 ?f10 ?f19 ?f28 ?f17 ?f10 ?f29 ?f10 ?f15 ?f23 ?f15 G ?f4 ?f22 ?f44 ?f45 L ?f24 ?f20 ?f9 ?f20 ?f9 ?f18 Z M ?f25 ?f26 L ?f25 ?f21 M ?f24 ?f27 L ?f24 ?f20 F N";
text_areas = L"?f9 ?f14 ?f10 ?f15";
view_box = L"0 0 0 0";
modifiers = L"50000 50000 16667";
add(L"f0", L"if(0-$2 ,0,if(33333-$2 ,$2 ,33333))");
add(L"f1", L"100000+0-?f0 ");
add(L"f2", L"if(0-$0 ,0,if(?f1 -$0 ,$0 ,?f1 ))");
add(L"f3", L"logwidth/2");
add(L"f4", L"logwidth/32");
add(L"f5", L"?f3 +0-?f4 ");
add(L"f6", L"min(logwidth,logheight)");
add(L"f7", L"100000*?f5 /?f6 ");
add(L"f8", L"if(0-$1 ,0,if(?f7 -$1 ,$1 ,?f7 ))");
add(L"f9", L"?f6 *?f8 /100000");
add(L"f10", L"logwidth+0-?f9 ");
add(L"f11", L"logheight*?f2 /200000");
add(L"f12", L"logheight*?f0 /-200000");
add(L"f13", L"logheight/2");
add(L"f14", L"?f13 +?f12 -?f11 ");
add(L"f15", L"?f13 +?f11 -?f12 ");
add(L"f16", L"?f14 +?f11 -0");
add(L"f17", L"logheight+0-?f16 ");
add(L"f18", L"?f16 *2/1");
add(L"f19", L"logheight+0-?f18 ");
add(L"f20", L"?f18 +0-?f14 ");
add(L"f21", L"logheight+0-?f20 ");
add(L"f22", L"?f0 *?f6 /400000");
add(L"f23", L"logwidth/2");
add(L"f24", L"?f23 +0-?f4 ");
add(L"f25", L"?f23 +?f4 -0");
add(L"f26", L"?f14 +?f22 -0");
add(L"f27", L"?f21 +0-?f22 ");
add(L"f28", L"logwidth");
add(L"f29", L"logheight");
add(L"f30", L"(16200000)/60000.0");
add(L"f31", L"(10800000)/60000.0");
add(L"f32", L"(16200000)/60000.0");
add(L"f33", L"(-10800000)/60000.0");
add(L"f34", L"(5400000)/60000.0");
add(L"f35", L"(5400000)/60000.0");
add(L"f36", L"(0)/60000.0");
add(L"f37", L"(5400000)/60000.0");
add(L"f38", L"(16200000)/60000.0");
add(L"f39", L"(-10800000)/60000.0");
add(L"f40", L"(16200000)/60000.0");
add(L"f41", L"(10800000)/60000.0");
add(L"f42", L"(16200000)/60000.0");
add(L"f43", L"(-10800000)/60000.0");
add(L"f44", L"(5400000)/60000.0");
add(L"f45", L"(5400000)/60000.0");
/////////////////////////////////////////////////////////
_handle h1, h2, h3;
h1.position = L"??f10 ?f21";
h1.y_maximum= L"?f1";
h1.y_minimum= L"0";
handles.push_back(h1);
h2.position = L"?f9 0";
h2.x_maximum= L"?f7";
h2.x_minimum= L"0";
handles.push_back(h2);
h3.position = L"?f25 ?f21";
h3.y_maximum= L"33333";
h3.y_minimum= L"0";
handles.push_back(h3);
}
};
}

View File

@ -719,4 +719,45 @@ public:
add(L"f198", L"if(?f26, ?f175, ?f190)");
}
};
class oox_shape_roundRect : public oox_shape
{
public:
oox_shape_roundRect()
{
odf_type_name =L"ooxml-roundRect";
enhanced_path = L"M 0 ?f2 G ?f2 ?f2 ?f12 ?f13 L ?f3 0 G ?f2 ?f2 ?f14 ?f15 L ?f11 ?f4 G ?f2 ?f2 ?f16 ?f17 L ?f2 ?f10 G ?f2 ?f2 ?f18 ?f19 Z N";
text_areas = L"?f5 ?f5 ?f6 ?f7";
view_box = L"0 0 0 0";
modifiers = L"16667";
add(L"f0", L"if(0-$0 ,0,if(50000-$0 ,$0 ,50000))");
add(L"f1", L"min(logwidth,logheight)");
add(L"f2", L"?f1 *?f0 /100000");
add(L"f3", L"logwidth+0-?f2 ");
add(L"f4", L"logheight+0-?f2 ");
add(L"f5", L"?f2 *29289/100000");
add(L"f6", L"logwidth+0-?f5 ");
add(L"f7", L"logheight+0-?f5 ");
add(L"f8", L"logwidth/2");
add(L"f9", L"logheight/2");
add(L"f10", L"logheight");
add(L"f11", L"logwidth");
add(L"f12", L"(10800000)/60000.0");
add(L"f13", L"(5400000)/60000.0");
add(L"f14", L"(16200000)/60000.0");
add(L"f15", L"(5400000)/60000.0");
add(L"f16", L"(0)/60000.0");
add(L"f17", L"(5400000)/60000.0");
add(L"f18", L"(5400000)/60000.0");
add(L"f19", L"(5400000)/60000.0");
//-----------------------------------------------------------------
_handle h1;
h1.position = L"?f2 0";
h1.x_maximum= L"50000";
h1.x_minimum= L"0";
handles.push_back(h1);
}
};
}

View File

@ -353,6 +353,10 @@ void odf_drawing_context::check_anchor()
set_vertical_pos(0);
}
}
int odf_drawing_context::get_group_level()
{
return impl_->current_level_.size();
}
void odf_drawing_context::start_group()
{
office_element_ptr group_elm = impl_->create_draw_element(5000);
@ -849,7 +853,7 @@ void odf_drawing_context::end_shape()
draw_path* path = dynamic_cast<draw_path*>(impl_->current_drawing_state_.elements_[0].elm.get());
if (path)
{
if (impl_->current_drawing_state_.view_box_.length() < 1 && impl_->current_drawing_state_.svg_width_ && impl_->current_drawing_state_.svg_height_)
if (impl_->current_drawing_state_.view_box_.empty() && impl_->current_drawing_state_.svg_width_ && impl_->current_drawing_state_.svg_height_)
set_viewBox( impl_->current_drawing_state_.svg_width_->get_value_unit(length::cm) * 1000,
impl_->current_drawing_state_.svg_height_->get_value_unit(length::cm) *1000);
@ -954,11 +958,16 @@ void odf_drawing_context::end_shape()
{
oox_shape_ptr shape_define = oox_shape::create(impl_->current_drawing_state_.oox_shape_preset_);
if (!shape_define) shape_define = impl_->current_drawing_state_.oox_shape_;
if (!shape_define)
shape_define = impl_->current_drawing_state_.oox_shape_;
if (shape_define)
{
enhanced->svg_viewbox_ = shape_define->view_box;
if (impl_->current_drawing_state_.oox_shape_ && impl_->current_drawing_state_.oox_shape_->view_box)
enhanced->svg_viewbox_ = impl_->current_drawing_state_.oox_shape_->view_box;
else
enhanced->svg_viewbox_ = shape_define->view_box;
enhanced->draw_enhanced_geometry_attlist_.draw_type_ = shape_define->odf_type_name;
enhanced->draw_enhanced_geometry_attlist_.draw_text_areas_ = shape_define->text_areas;
@ -1004,6 +1013,9 @@ void odf_drawing_context::end_shape()
if (shape_define->handles[i].y_maximum) h->draw_handle_attlist_.draw_handle_range_y_maximum_ = *shape_define->handles[i].y_maximum;
if (shape_define->handles[i].x_minimum) h->draw_handle_attlist_.draw_handle_range_x_minimum_ = *shape_define->handles[i].x_minimum;
if (shape_define->handles[i].x_maximum) h->draw_handle_attlist_.draw_handle_range_x_maximum_ = *shape_define->handles[i].x_maximum;
if (shape_define->handles[i].r_maximum) h->draw_handle_attlist_.draw_handle_radius_range_maximum_ = *shape_define->handles[i].r_maximum;
if (shape_define->handles[i].r_minimum) h->draw_handle_attlist_.draw_handle_radius_range_minimum_ = *shape_define->handles[i].r_minimum;
}
end_element();
}
@ -1509,6 +1521,8 @@ void odf_drawing_context::set_viewBox (double W, double H)
if (impl_->current_drawing_state_.oox_shape_)
{
impl_->current_drawing_state_.oox_shape_->view_box = impl_->current_drawing_state_.view_box_;
if (impl_->current_drawing_state_.oox_shape_->sub_view_size)
impl_->current_drawing_state_.oox_shape_->sub_view_size = *impl_->current_drawing_state_.oox_shape_->sub_view_size + L" " + std::to_wstring((int)W) + L" " + std::to_wstring((int)H);
else
@ -2001,7 +2015,7 @@ std::wstring odf_drawing_context::add_marker_style(int type)
{
if (type == 2) return L"";
std::wstring str_types [] = {L"ArrowMarker", L"DiamondMarker", L"None", L"OvalMarker", L"StealthMarker", L"TriangleMarker"};
std::wstring str_types [] = {L"None", L"ArrowMarker", L"DiamondMarker", L"OvalMarker", L"StealthMarker", L"TriangleMarker"};
style * style_=NULL;
if (impl_->styles_context_->find_odf_style(str_types[type],style_family::Marker,style_)) return str_types[type];
@ -2022,7 +2036,7 @@ std::wstring odf_drawing_context::add_marker_style(int type)
switch(type)
{
case 1:
case 2:
marker->svg_d_ = L"M0 564l564 567 567-567-567-564z";
marker->svg_viewBox_ = L"0 0 1131 1131";
break;
@ -2038,7 +2052,7 @@ std::wstring odf_drawing_context::add_marker_style(int type)
marker->svg_d_ = L"M1321 3493h-1321l702-3493z";
marker->svg_viewBox_ = L"0 0 1321 3493";
break;
case 0:
case 1:
default:
marker->svg_d_ =L"M0 2108v17 17l12 42 30 34 38 21 43 4 29-8 30-21 25-26 13-34 343-1532 339 1520 13 42 29 34 39 21 42 4 42-12 34-30 21-42v-39-12l-4 4-440-1998-9-42-25-39-38-25-43-8-42 8-38 25-26 39-8 42z";
marker->svg_viewBox_ = L"0 0 1122 2243";
@ -2102,17 +2116,15 @@ void odf_drawing_context::set_textarea_wrap(bool Val)
impl_->current_graphic_properties->fo_wrap_option_ = wrap_option(wrap_option::NoWrap);
}
void odf_drawing_context::set_textarea_font(std::wstring & latin, std::wstring & cs, std::wstring & ea)
{
if (impl_->current_drawing_state_.elements_.empty())return;
if (!impl_->current_text_properties)
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
impl_->current_text_properties = style_state->get_text_properties();
}
impl_->current_text_properties = style_state->get_text_properties();
}
if (!impl_->current_text_properties) return;
@ -2126,13 +2138,10 @@ void odf_drawing_context::set_textarea_fontcolor(std::wstring hexColor)
{
if (impl_->current_drawing_state_.elements_.empty())return;
if (!impl_->current_text_properties)
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
odf_style_state_ptr style_state = impl_->styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
impl_->current_text_properties = style_state->get_text_properties();
}
impl_->current_text_properties = style_state->get_text_properties();
}
if (!impl_->current_text_properties) return;
@ -3029,8 +3038,8 @@ void odf_drawing_context::start_bitmap_style()
odf_writer::office_element_ptr fill_image_element;
odf_writer::create_element(L"draw",L"fill-image", fill_image_element, impl_->odf_context_);
impl_->styles_context_->add_style(fill_image_element,false,true, style_family::FillImage);
odf_writer::create_element(L"draw", L"fill-image", fill_image_element, impl_->odf_context_);
impl_->styles_context_->add_style(fill_image_element, false, true, style_family::FillImage);
draw_fill_image * fill_image = dynamic_cast<draw_fill_image *>(fill_image_element.get());
if (!fill_image) return;

View File

@ -104,6 +104,7 @@ public:
void end_drawing();
void end_drawing_background(odf_types::common_draw_fill_attlist & common_draw_attlist);
int get_group_level();
void start_group();
void set_group_flip_H (bool bVal);
void set_group_flip_V (bool bVal);
@ -166,8 +167,6 @@ public:
void finalize(office_element_ptr & root_elm);
///////////////////////////////////////////////////////////////////////////////////////
void get_position (_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt);
void set_position (_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt);
void set_position_line (_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt, _CP_OPT(double) & x1_pt, _CP_OPT(double) & y1_pt);

View File

@ -44,6 +44,8 @@
#include "Shapes/oox_shapeConnectors.h"
#include "Shapes/oox_shapeWordArt.h"
#include "Shapes/oox_shapeCurvedArrows.h"
#include "Shapes/oox_shapeCallouts.h"
#include "Shapes/oox_shapeBents.h"
#include "../../../Common/DocxFormat/Source/Common/SimpleTypes_Drawing.h"
@ -53,7 +55,6 @@ namespace cpdoccore
oox_shape::oox_shape()
{
odf_type_name = L"ooxml-non-primitive";
view_box = L"0 0 0 0";
}
oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
@ -61,7 +62,13 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
switch (ooxPrstGeomType)
{
case SimpleTypes::shapetypeMathMultiply: return boost::make_shared<oox_shape_mathMultiply>();
case SimpleTypes::shapetypeSun: return boost::make_shared<oox_shape_sun>();
case SimpleTypes::shapetypeMathEqual: return boost::make_shared<oox_shape_mathEqual>();
case SimpleTypes::shapetypeMathPlus: return boost::make_shared<oox_shape_mathPlus>();
case SimpleTypes::shapetypeMathNotEqual: return boost::make_shared<oox_shape_mathNotEqual>();
case SimpleTypes::shapetypeMathDivide: return boost::make_shared<oox_shape_mathDivide>();
case SimpleTypes::shapetypeMathMinus: return boost::make_shared<oox_shape_mathMinus>();
case SimpleTypes::shapetypeRoundRect: return boost::make_shared<oox_shape_roundRect>();
case SimpleTypes::shapetypeRound1Rect: return boost::make_shared<oox_shape_round1Rect>();
case SimpleTypes::shapetypeRound2DiagRect: return boost::make_shared<oox_shape_round2DiagRect>();
case SimpleTypes::shapetypeRound2SameRect: return boost::make_shared<oox_shape_round2SameRect>();
@ -69,25 +76,62 @@ oox_shape_ptr oox_shape::create(int ooxPrstGeomType)
case SimpleTypes::shapetypeSnip2DiagRect: return boost::make_shared<oox_shape_snip2DiagRect>();
case SimpleTypes::shapetypeSnip2SameRect: return boost::make_shared<oox_shape_snip2SameRect>();
case SimpleTypes::shapetypeSnipRoundRect: return boost::make_shared<oox_shape_snipRoundRect>();
case SimpleTypes::shapetypeStar6: return boost::make_shared<oox_shape_star6>();
case SimpleTypes::shapetypeStar7: return boost::make_shared<oox_shape_star7>();
case SimpleTypes::shapetypeStar10: return boost::make_shared<oox_shape_star10>();
case SimpleTypes::shapetypeStar12: return boost::make_shared<oox_shape_star12>();
case SimpleTypes::shapetypeStar16: return boost::make_shared<oox_shape_star16>();
case SimpleTypes::shapetypeStar32: return boost::make_shared<oox_shape_star32>();
case SimpleTypes::shapetypeSun: return boost::make_shared<oox_shape_sun>();
case SimpleTypes::shapetypeCircularArrow: return boost::make_shared<oox_shape_CircularArrow>();
case SimpleTypes::shapetypeCurvedLeftArrow: return boost::make_shared<oox_shape_CurvedLeftArrow>();
case SimpleTypes::shapetypeCurvedRightArrow: return boost::make_shared<oox_shape_CurvedRightArrow>();
case SimpleTypes::shapetypeCurvedDownArrow: return boost::make_shared<oox_shape_CurvedDownArrow>();
case SimpleTypes::shapetypeLeftCircularArrow: return boost::make_shared<oox_shape_LeftCircularArrow>();
case SimpleTypes::shapetypeSwooshArrow: return boost::make_shared<oox_shape_SwooshArrow>();
case SimpleTypes::shapetypeLeftArrow: return boost::make_shared<oox_shape_LeftArrow>();
case SimpleTypes::shapetypeLeftRightArrow: return boost::make_shared<oox_shape_LeftRightArrow>();
case SimpleTypes::shapetypeLeftUpArrow: return boost::make_shared<oox_shape_LeftUpArrow>();
case SimpleTypes::shapetypeUpDownArrow: return boost::make_shared<oox_shape_UpDownArrow>();
case SimpleTypes::shapetypeRightArrow: return boost::make_shared<oox_shape_RightArrow>();
case SimpleTypes::shapetypeDownArrow: return boost::make_shared<oox_shape_DownArrow>();
case SimpleTypes::shapetypeUpArrow: return boost::make_shared<oox_shape_UpArrow>();
case SimpleTypes::shapetypeNotchedRightArrow: return boost::make_shared<oox_shape_NotchedRightArrow>();
case SimpleTypes::shapetypeFunnel: return boost::make_shared<oox_shape_Funnel>();
case SimpleTypes::shapetypeGear6: return boost::make_shared<oox_shape_Gear6>();
case SimpleTypes::shapetypeGear9: return boost::make_shared<oox_shape_Gear9>();
case SimpleTypes::shapetypeCircularArrow: return boost::make_shared<oox_shape_CircularArrow>();
case SimpleTypes::shapetypeCurvedLeftArrow: return boost::make_shared<oox_shape_curvedLeftArrow>();
case SimpleTypes::shapetypeCurvedDownArrow: return boost::make_shared<oox_shape_curvedDownArrow>();
case SimpleTypes::shapetypeLeftCircularArrow: return boost::make_shared<oox_shape_LeftCircularArrow>();
case SimpleTypes::shapetypeBlockArc: return boost::make_shared<oox_shape_BlockArc>();
case SimpleTypes::shapetypeCorner: return boost::make_shared<oox_shape_Corner>();
case SimpleTypes::shapetypeChord: return boost::make_shared<oox_shape_Chord>();
case SimpleTypes::shapetypeChevron: return boost::make_shared<oox_shape_Chevron>();
case SimpleTypes::shapetypeHomePlate: return boost::make_shared<oox_shape_HomePlate>();
case SimpleTypes::shapetypeBevel: return boost::make_shared<oox_shape_Bevel>();
case SimpleTypes::shapetypeArc: return boost::make_shared<oox_shape_Arc>();
case SimpleTypes::shapetypeTrapezoid: return boost::make_shared<oox_shape_Trapezoid>();
case SimpleTypes::shapetypeTriangle: return boost::make_shared<oox_shape_Triangle>();
case SimpleTypes::shapetypeRtTriangle: return boost::make_shared<oox_shape_RtTriangle>();
case SimpleTypes::shapetypeParallelogram: return boost::make_shared<oox_shape_Parallelogram>();
case SimpleTypes::shapetypeDiamond: return boost::make_shared<oox_shape_Diamond>();
case SimpleTypes::shapetypePlus: return boost::make_shared<oox_shape_Plus>();
case SimpleTypes::shapetypePlaque: return boost::make_shared<oox_shape_Plaque>();
case SimpleTypes::shapetypeDoubleWave: return boost::make_shared<oox_shape_DoubleWave>();
case SimpleTypes::shapetypePieWedge: return boost::make_shared<oox_shape_PieWedge>();
case SimpleTypes::shapetypePie: return boost::make_shared<oox_shape_Pie>();
case SimpleTypes::shapetypeDonut: return boost::make_shared<oox_shape_Donut>();
case SimpleTypes::shapetypeLeftRightRibbon: return boost::make_shared<oox_shape_LeftRightRibbon>();
case SimpleTypes::shapetypeFlowChartExtract: return boost::make_shared<oox_shape_FlowChartExtract>();
case SimpleTypes::shapetypeLeftArrowCallout: return boost::make_shared<oox_shape_LeftArrowCallout>();
case SimpleTypes::shapetypeRightArrowCallout: return boost::make_shared<oox_shape_RightArrowCallout>();
case SimpleTypes::shapetypeUpArrowCallout: return boost::make_shared<oox_shape_UpArrowCallout>();
case SimpleTypes::shapetypeDownArrowCallout: return boost::make_shared<oox_shape_DownArrowCallout>();
case SimpleTypes::shapetypeBentUpArrow: return boost::make_shared<oox_shape_BentUpArrow>();
//case (2001 + SimpleTypes::textshapetypeTextArchDown):
//case (2001 + SimpleTypes::textshapetypeTextArchDownPour):

View File

@ -64,6 +64,8 @@ namespace cpdoccore
_CP_OPT(std::wstring) y_maximum;
_CP_OPT(std::wstring) x_minimum;
_CP_OPT(std::wstring) x_maximum;
_CP_OPT(std::wstring) r_minimum;
_CP_OPT(std::wstring) r_maximum;
};
void add(std::wstring name,std::wstring frmla)
@ -78,7 +80,8 @@ namespace cpdoccore
std::wstring enhanced_path;
std::wstring modifiers;
std::wstring text_areas;
std::wstring view_box;
_CP_OPT(std::wstring) view_box;
_CP_OPT(std::wstring) sub_view_size;
_CP_OPT(std::wstring) glue_points;

View File

@ -126,12 +126,12 @@ void style_background_image::serialize(std::wostream & strm)
{
CP_XML_NODE_SIMPLE()
{
CP_XML_ATTR_OPT(L"style:repeat", style_repeat_);
CP_XML_ATTR_OPT(L"style:position", style_position_);
CP_XML_ATTR_OPT(L"filter:name", filter_name_);
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
CP_XML_ATTR_OPT(L"style:repeat", style_repeat_);
CP_XML_ATTR_OPT(L"style:position", style_position_);
CP_XML_ATTR_OPT(L"filter:name", filter_name_);
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
if (common_xlink_attlist_) common_xlink_attlist_->serialize(CP_GET_XML_NODE());
if (xlink_attlist_) xlink_attlist_->serialize(CP_GET_XML_NODE());
if (office_binary_data_) office_binary_data_->serialize(CP_XML_STREAM());
}
}

View File

@ -169,13 +169,14 @@ public:
virtual void serialize(std::wostream & strm);
_CP_OPT(odf_types::style_repeat) style_repeat_;
_CP_OPT(odf_types::style_position) style_position_;
_CP_OPT(std::wstring) filter_name_;
_CP_OPT(odf_types::percent) draw_opacity_;
_CP_OPT(odf_types::style_repeat) style_repeat_;
_CP_OPT(odf_types::style_position) style_position_;
_CP_OPT(std::wstring) filter_name_;
_CP_OPT(odf_types::percent) draw_opacity_;
_CP_OPT(odf_types::common_xlink_attlist) common_xlink_attlist_;
office_element_ptr office_binary_data_;
_CP_OPT(odf_types::common_xlink_attlist) xlink_attlist_;
office_element_ptr office_binary_data_;
};

View File

@ -1164,13 +1164,13 @@ void style_page_layout::serialize(std::wostream & strm)
//////////////////////////////////////////////////////////////////////////////////////////////////
void style_footnote_sep_attlist::serialize(CP_ATTR_NODE)
{
CP_XML_ATTR_OPT(L"style:width", style_width_);
CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_);
CP_XML_ATTR_OPT(L"style:color", style_color_);
CP_XML_ATTR_OPT(L"style:line-style", style_line_style_);
CP_XML_ATTR_OPT(L"style:type", style_adjustment_); // default Left
CP_XML_ATTR_OPT(L"style:distance-before-sep", style_distance_before_sep_);
CP_XML_ATTR_OPT(L"style:distance-after-sep", style_distance_after_sep_);
CP_XML_ATTR_OPT(L"style:width", style_width_);
CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_);
CP_XML_ATTR_OPT(L"style:color", style_color_);
CP_XML_ATTR_OPT(L"style:line-style", style_line_style_);
CP_XML_ATTR_OPT(L"style:type", style_adjustment_); // default Left
CP_XML_ATTR_OPT(L"style:distance-before-sep", style_distance_before_sep_);
CP_XML_ATTR_OPT(L"style:distance-after-sep", style_distance_after_sep_);
}
const wchar_t * style_footnote_sep::ns = L"style";

View File

@ -358,7 +358,7 @@ void OoxConverter::convert(PPTX::Logic::GrpSpPr *oox_grpSpPr)
odf_context()->drawing_context()->set_group_size( cx, cy, ch_cx, ch_cy );
_CP_OPT(double) x, y, ch_x, ch_y;
_CP_OPT(double) x, y, ch_x, ch_y, ext_x, ext_y;
if (oox_grpSpPr->xfrm->offX.IsInit())
x = oox_grpSpPr->xfrm->offX.get() / 12700.;
@ -370,6 +370,16 @@ void OoxConverter::convert(PPTX::Logic::GrpSpPr *oox_grpSpPr)
if (oox_grpSpPr->xfrm->chOffY.IsInit())
ch_y = oox_grpSpPr->xfrm->chOffY.get() / 12700.;
int group_level = odf_context()->drawing_context()->get_group_level();
odf_context()->drawing_context()->get_position(ext_x, ext_y);
if (ext_x && ext_y && group_level < 2)
{
x = ext_x;
y = ext_y;
}
odf_context()->drawing_context()->set_group_position( x, y, ch_x, ch_y );
if (oox_grpSpPr->xfrm->rot.IsInit())
@ -484,14 +494,21 @@ void OoxConverter::convert(PPTX::Logic::Shape *oox_shape)
DocxConverter *docx_converter = dynamic_cast<DocxConverter*>(this);
if (docx_converter)
{
odf_context()->start_text_context();
docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
odf_context()->start_text_context();
//docx_converter->convert(oox_shape->oTextBoxShape.GetPointer());
for (size_t i = 0; i < oox_shape->oTextBoxShape->m_arrItems.size(); i++)
{
docx_converter->convert(oox_shape->oTextBoxShape->m_arrItems[i]);
convert(oox_shape->oTextBoxBodyPr.GetPointer());
if (oox_shape->style.IsInit())
convert(&oox_shape->style->fontRef);
}
odf_context()->drawing_context()->set_text( odf_context()->text_context());
convert(oox_shape->oTextBoxBodyPr.GetPointer());
if (oox_shape->style.IsInit())
convert(&oox_shape->style->fontRef);
odf_context()->end_text_context();
}
}
@ -994,7 +1011,7 @@ void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop, DWORD ARGB, PPTX::Log
{
if (oox_line_prop->headEnd->len.IsInit() || oox_line_prop->headEnd->type.IsInit() || oox_line_prop->headEnd->w.IsInit())
{
int type = 0, w = 1, len = 1;//medium arrow
int type = 1, w = 1, len = 1;//medium arrow
if (oox_line_prop->headEnd->len.IsInit()) len = oox_line_prop->headEnd->len->GetBYTECode();
if (oox_line_prop->headEnd->type.IsInit()) type = oox_line_prop->headEnd->type->GetBYTECode();
if (oox_line_prop->headEnd->w.IsInit()) w = oox_line_prop->headEnd->w->GetBYTECode();
@ -1006,11 +1023,11 @@ void OoxConverter::convert(PPTX::Logic::Ln *oox_line_prop, DWORD ARGB, PPTX::Log
{
if (oox_line_prop->tailEnd->len.IsInit() || oox_line_prop->tailEnd->type.IsInit() || oox_line_prop->tailEnd->w.IsInit())
{
int type = 0, w = 1, len = 1;//medium arrow
int type = 1, w = 1, len = 1;//medium arrow
if (oox_line_prop->tailEnd->len.IsInit()) len = oox_line_prop->tailEnd->len->GetBYTECode();
if (oox_line_prop->tailEnd->type.IsInit()) type = oox_line_prop->tailEnd->type->GetBYTECode();
if (oox_line_prop->tailEnd->w.IsInit()) w = oox_line_prop->tailEnd->w->GetBYTECode();
odf_context()->drawing_context()->set_line_tail(type, len, w);
}
}
@ -1511,13 +1528,13 @@ void OoxConverter::convert(PPTX::Logic::TextParagraphPr *oox_paragraph_pr , odf_
{
paragraph_properties->content_.fo_text_indent_ = odf_types::length_or_percent(odf_types::length(oox_paragraph_pr->indent.get() / 12700., odf_types::length::pt));
}
if (oox_paragraph_pr->rtl.IsInit())
if (oox_paragraph_pr->rtl.IsInit() && *oox_paragraph_pr->rtl)
{
paragraph_properties->content_.style_writing_mode_= odf_types::writing_mode(odf_types::writing_mode::RlTb);
}
}
//nullable<SimpleTypes::CDecimalNumber<> > m_oLvl;
//nullable<SimpleTypes::CCoordinate32<> > m_oDefTabSz;
//nullable<SimpleTypes::CTextFontAlignType<>> m_oFontAlgn;
//defTabSz;
//fontAlgn;
if (oox_paragraph_pr->defRPr.IsInit())
{
@ -1554,7 +1571,7 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
//------------------------------------------------------
odf_writer::odf_drawing_context *drawing = odf_context()->drawing_context();
if (drawing) //from styles impossible(
if (drawing) //from styles drawing impossible( ... todoooo ???
{
if ((oox_run_pr->Fill.is<PPTX::Logic::GradFill>()) ||
((oox_run_pr->ln.IsInit()) && (oox_run_pr->ln->Fill.is_init() && oox_run_pr->ln->Fill.getType() != OOX::et_a_noFill)))
@ -1692,37 +1709,99 @@ void OoxConverter::convert(PPTX::Logic::RunProperties *oox_run_pr, odf_writer::s
{
text_properties->content_.style_text_underline_style_ = odf_types::line_style (odf_types::line_style::Solid);
text_properties->content_.style_text_underline_type_ = odf_types::line_type (odf_types::line_type::Single);
switch(oox_run_pr->u->GetBYTECode())
{
case SimpleTypes::underlineNone :
text_properties->content_.style_text_underline_type_= odf_types::line_type(odf_types::line_type::None);break;
case SimpleTypes::underlineDash :
case SimpleTypes::underlineDashedHeavy:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Dash);break;
case SimpleTypes::underlineDotDash :
case SimpleTypes::underlineDashDotHeavy:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::DotDash);break;
case SimpleTypes::underlineDashLong:
case SimpleTypes::underlineDashLongHeavy:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::LongDash);break;
case SimpleTypes::underlineDotDotDash:
case SimpleTypes::underlineDashDotDotHeavy :
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::DotDotDash);break;
case SimpleTypes::underlineDotted:
case SimpleTypes::underlineDottedHeavy:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Dotted);break;
case SimpleTypes::underlineWave :
case SimpleTypes::underlineWavyHeavy :
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Wave);break;
case SimpleTypes::underlineDouble :
case SimpleTypes::underlineThick :
text_properties->content_.style_text_underline_type_= odf_types::line_type(odf_types::line_type::Double);break;
case SimpleTypes::underlineWavyDouble :
text_properties->content_.style_text_underline_type_= odf_types::line_type(odf_types::line_type::Double);
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Wave);break;
case 12:
text_properties->content_.style_text_underline_style_ = boost::none;
text_properties->content_.style_text_underline_type_ = odf_types::line_type(odf_types::line_type::None);break;
case 0:
case 1:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Dash);break;
case 5:
case 6:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::DotDash);break;
case 2:
case 3:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::LongDash);break;
case 7:
case 8:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::DotDotDash);break;
case 9:
case 10:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Dotted);break;
case 14:
case 16:
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Wave);break;
case 4:
text_properties->content_.style_text_underline_type_ = odf_types::line_type(odf_types::line_type::Double);break;
case 15:
text_properties->content_.style_text_underline_type_ = odf_types::line_type(odf_types::line_type::Double);
text_properties->content_.style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Wave);break;
}
PPTX::Logic::UniFill *fill = NULL;
if (oox_run_pr->uFillTx.IsInit()) fill = &oox_run_pr->uFillTx->Fill;
else if (oox_run_pr->uFill.IsInit()) fill = &oox_run_pr->uFill->Fill;
if (fill && fill->is<PPTX::Logic::SolidFill>() )
{
PPTX::Logic::SolidFill &solid = fill->as<PPTX::Logic::SolidFill>();
_CP_OPT(double) opacityText;
std::wstring hexColorText;
convert(&solid.Color, hexColorText, opacityText);
if (!hexColorText.empty())
{
text_properties->content_.style_text_underline_color_ = odf_types::color(hexColorText);
}
}
}
if (oox_run_pr->highlight.IsInit())
{
_CP_OPT(double) opacityText;
std::wstring hexColorText;
convert(&oox_run_pr->highlight->Color, hexColorText, opacityText);
text_properties->content_.fo_background_color_ = odf_types::color(hexColorText);
}
if (oox_run_pr->strike.IsInit())
{
switch(oox_run_pr->strike->GetBYTECode())
{
case 0:
text_properties->content_.style_text_line_through_style_ = odf_types::line_style (odf_types::line_style::Solid);
text_properties->content_.style_text_line_through_type_ = odf_types::line_type(odf_types::line_type::Double); break;
case 1:
text_properties->content_.style_text_line_through_style_ = boost::none;
text_properties->content_.style_text_line_through_type_ = odf_types::line_type(odf_types::line_type::None); break;
case 2:
text_properties->content_.style_text_line_through_style_ = odf_types::line_style (odf_types::line_style::Solid);
text_properties->content_.style_text_line_through_type_ = odf_types::line_type(odf_types::line_type::Single); break;
}
}
if (oox_run_pr->baseline.IsInit())
{
text_properties->content_.style_text_position_ = odf_types::text_position(*oox_run_pr->baseline / 1000.);
}
if (oox_run_pr->cap.IsInit())
{
switch(oox_run_pr->cap->GetBYTECode())
{
case 0:
text_properties->content_.fo_text_transform_ = odf_types::text_transform(odf_types::text_transform::Uppercase); break;
case 1:
text_properties->content_.fo_font_variant_ = odf_types::font_variant(odf_types::font_variant::SmallCaps); break;
case 2:
text_properties->content_.fo_font_variant_ = odf_types::font_variant(odf_types::font_variant::Normal); break;
}
}
if (oox_run_pr->normalizeH.IsInit() && *oox_run_pr->normalizeH)
{
text_properties->content_.fo_text_transform_ = odf_types::text_transform(odf_types::text_transform::Capitalize);
}
}
void OoxConverter::convert(PPTX::Logic::Run *oox_run)
{
@ -1746,9 +1825,27 @@ void OoxConverter::convert(PPTX::Logic::Run *oox_run)
if ((oox_run->rPr.IsInit()) && (oox_run->rPr->hlinkClick.IsInit()) && (oox_run->rPr->hlinkClick->id.IsInit()))
{
odf_writer::style_text_properties * text_properties = odf_context()->text_context()->get_text_properties();
if (!text_properties->content_.fo_color_)
{
PPTX::Logic::UniColor colorLink;
colorLink.Color.reset(new PPTX::Logic::SchemeClr());
PPTX::Logic::SchemeClr & clr = colorLink.as<PPTX::Logic::SchemeClr>();
clr.val.set(L"hlink");
std::wstring strHexColor;
_CP_OPT(double) opacity;
convert(&colorLink, strHexColor, opacity);
if (!strHexColor.empty())
text_properties->content_.fo_color_ = strHexColor;
}
text_properties->content_.style_text_underline_type_ = odf_types::line_type::Single;
text_properties->content_.style_text_underline_style_ = odf_types::line_style::Solid;
std::wstring hlink = find_link_by_id(oox_run->rPr->hlinkClick->id.get(), 2);
odf_context()->text_context()->add_hyperlink(hlink, oox_run->GetText());
}
else
{
@ -1866,8 +1963,11 @@ void OoxConverter::convert(PPTX::Logic::TxBody *oox_txBody, PPTX::Logic::ShapeSt
void OoxConverter::convert(PPTX::Logic::ArcTo *oox_geom_path)
{
if (!oox_geom_path) return;
int stAng = XmlUtils::GetInteger(oox_geom_path->stAng);
int swAng = XmlUtils::GetInteger(oox_geom_path->swAng);
std::wstring path_elm = oox_geom_path->hR + L" " + oox_geom_path->wR + L" " + oox_geom_path->swAng + L" " + oox_geom_path->stAng;
std::wstring path_elm = oox_geom_path->wR + L" " + oox_geom_path->hR + L" " + std::to_wstring(stAng/60000) + L" " + std::to_wstring(swAng /60000);
odf_context()->drawing_context()->add_path_element(std::wstring(L"G"), path_elm);
}

View File

@ -651,15 +651,15 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
switch(vml_stroke->m_oStartArrow.GetValue())
{
case SimpleTypes::strokearrowtypeBlock:
odf_context()->drawing_context()->set_line_head(SimpleTypes::lineendtypeStealth,vml_stroke->m_oStartArrowLength.GetValue(),vml_stroke->m_oStartArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_head(4, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeClassic:
odf_context()->drawing_context()->set_line_head(SimpleTypes::lineendtypeArrow,vml_stroke->m_oStartArrowLength.GetValue(),vml_stroke->m_oStartArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_head(1, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeDiamond:
odf_context()->drawing_context()->set_line_head(SimpleTypes::lineendtypeDiamond,vml_stroke->m_oStartArrowLength.GetValue(),vml_stroke->m_oStartArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_head(2, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeOpen:
odf_context()->drawing_context()->set_line_head(SimpleTypes::lineendtypeTriangle,vml_stroke->m_oStartArrowLength.GetValue(),vml_stroke->m_oStartArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_head(5, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeOval:
odf_context()->drawing_context()->set_line_head(SimpleTypes::lineendtypeOval,vml_stroke->m_oStartArrowLength.GetValue(),vml_stroke->m_oStartArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_head(3, vml_stroke->m_oStartArrowLength.GetValue(), vml_stroke->m_oStartArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeNone:
default:
break;
@ -667,15 +667,15 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
switch(vml_stroke->m_oEndArrow.GetValue())
{
case SimpleTypes::strokearrowtypeBlock:
odf_context()->drawing_context()->set_line_tail(SimpleTypes::lineendtypeStealth,vml_stroke->m_oEndArrowLength.GetValue(),vml_stroke->m_oEndArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_tail(4, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeClassic:
odf_context()->drawing_context()->set_line_tail(SimpleTypes::lineendtypeArrow,vml_stroke->m_oEndArrowLength.GetValue(),vml_stroke->m_oEndArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_tail(1, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeDiamond:
odf_context()->drawing_context()->set_line_tail(SimpleTypes::lineendtypeDiamond,vml_stroke->m_oEndArrowLength.GetValue(),vml_stroke->m_oEndArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_tail(2, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeOpen:
odf_context()->drawing_context()->set_line_tail(SimpleTypes::lineendtypeTriangle,vml_stroke->m_oEndArrowLength.GetValue(),vml_stroke->m_oEndArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_tail(5, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeOval:
odf_context()->drawing_context()->set_line_tail(SimpleTypes::lineendtypeOval,vml_stroke->m_oEndArrowLength.GetValue(),vml_stroke->m_oEndArrowWidth.GetValue()); break;
odf_context()->drawing_context()->set_line_tail(3, vml_stroke->m_oEndArrowLength.GetValue(), vml_stroke->m_oEndArrowWidth.GetValue()); break;
case SimpleTypes::strokearrowtypeNone:
default:
break;

View File

@ -1293,13 +1293,13 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
}
if (odt_context->notes_context()->is_started())
if (odt_context->notes_context()->is_started() && !paragraph_properties->content_.fo_margin_left_
&& !paragraph_properties->content_.fo_text_indent_)
{
paragraph_properties->content_.fo_margin_left_ = odf_types::length( 0.5, odf_types::length::cm);
paragraph_properties->content_.fo_text_indent_ = odf_types::length(-0.5, odf_types::length::cm);
paragraph_properties->content_.fo_margin_left_ = odf_types::length( 0.2, odf_types::length::cm);
paragraph_properties->content_.fo_text_indent_ = odf_types::length(-0.2, odf_types::length::cm);
paragraph_properties->content_.fo_line_height_ = odf_types::percent(100.);
paragraph_properties->content_.style_auto_text_indent_ = false;
//loext:contextual-spacing="false"
}
if (oox_paragraph_pr->m_oTabs.IsInit())

View File

@ -30,9 +30,7 @@
*
*/
#include "XlsxConverter.h"
#include "../utils.h"
#include <boost/foreach.hpp>
#include "../../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
#include "../OdfFormat/ods_conversion_context.h"
@ -45,8 +43,9 @@
#include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_properties.h"
#include "../OdfFormat/style_graphic_properties.h"
#include "../OdfFormat/style_page_layout_properties.h"
#include "../../../Common/DocxFormat/Source/XlsxFormat/Xlsx.h"
#include "../utils.h"
using namespace cpdoccore;
@ -241,10 +240,14 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
{
if (!oox_sheet) return;
OOX::IFileContainer* old_container = xlsx_current_container;
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_sheet);
if (oox_sheet->m_oDimension.IsInit())
{
ods_context->set_sheet_dimension(oox_sheet->m_oDimension->m_oRef.get());
}
convert(oox_sheet->m_oSheetFormatPr.GetPointer());
convert(oox_sheet->m_oSheetPr.GetPointer());
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -344,10 +347,45 @@ void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
}
/////////////////////////////////////////////////////////////////////////
convert(oox_sheet->m_oSheetViews.GetPointer());
convert(oox_sheet->m_oHeaderFooter.GetPointer());
convert(oox_sheet->m_oPageSetup.GetPointer());
convert(oox_sheet->m_oPageMargins.GetPointer());
}
convert(oox_sheet->m_oPicture.GetPointer());
xlsx_current_container = old_container;
}
void XlsxConverter::convert(OOX::Spreadsheet::CHeaderFooter * oox_header_footer)
{
if (!oox_header_footer) return;
}
void XlsxConverter::convert(OOX::Spreadsheet::CPictureWorksheet *oox_background)
{
if (!oox_background) return;
if (!oox_background->m_oId.IsInit())return;
std::wstring sID, pathImage, href;
sID = oox_background->m_oId->GetValue();
pathImage = find_link_by_id(sID, 1);
href = ods_context->add_image(pathImage);
if (href.empty()) return;
odf_writer::office_element_ptr fill_image_element;
odf_writer::create_element(L"style", L"background-image", fill_image_element, ods_context);
odf_writer::style_background_image * fill_image = dynamic_cast<odf_writer::style_background_image*>(fill_image_element.get());
if (!fill_image) return;
fill_image->xlink_attlist_ = odf_types::common_xlink_attlist();
fill_image->xlink_attlist_->type_ = odf_types::xlink_type::Simple;
fill_image->xlink_attlist_->actuate_ = odf_types::xlink_actuate::OnLoad;
fill_image->xlink_attlist_->href_ = href;
odf_writer::style_page_layout_properties* page_props = ods_context->page_layout_context()->last_layout()->get_properties();
page_props->add_child_element(fill_image_element);
}
void XlsxConverter::convert(OOX::Spreadsheet::CTable *oox_table_part)
{
if (!oox_table_part) return;
@ -1012,7 +1050,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
//nullable<SimpleTypes::COnOff<>> m_oDefaultGridColor;
//nullable<SimpleTypes::COnOff<>> m_oShowRuler;
//nullable<SimpleTypes::COnOff<>> m_oShowWhiteSpace;
//nullable<std::wstring> m_oTopLeftCell;
//nullable<std::wstring> m_oTopLeftCell;
//nullable<SimpleTypes::Spreadsheet::CSheetViewType<>> m_oView;
//nullable<SimpleTypes::COnOff<>> m_oWindowProtection;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScaleNormal;
@ -1026,15 +1064,67 @@ void XlsxConverter::convert(OOX::Spreadsheet::CPageSetup *oox_page)
if (!oox_page) return;
int type = 1;
if (oox_page->m_oOrientation.IsInit())
{
type = (int)oox_page->m_oOrientation->GetValue();
}
ods_context->page_layout_context()->set_page_orientation(type);
_CP_OPT(odf_types::length) width, height;
if (oox_page->m_oPaperWidth.IsInit() && oox_page->m_oPaperHeight.IsInit())
{
double w = oox_page->m_oPaperWidth->GetValue();
double h = oox_page->m_oPaperHeight->GetValue();
int unit = oox_page->m_oPaperUnits.IsInit() ? oox_page->m_oPaperUnits->GetValue() : 0;
switch(unit)
{
case 1:
width = odf_types::length(w, odf_types::length::cm);
height = odf_types::length(h, odf_types::length::cm);
case 2:
width = odf_types::length(w, odf_types::length::inch);
height = odf_types::length(h, odf_types::length::inch);
case 3:
width = odf_types::length(w, odf_types::length::pt);
height = odf_types::length(h, odf_types::length::pt);
case 4:
width = odf_types::length(w, odf_types::length::px);
height = odf_types::length(h, odf_types::length::px);
case 0:
default:
width = odf_types::length(w, odf_types::length::mm);
height = odf_types::length(h, odf_types::length::mm);
}
}
else if (oox_page->m_oPaperSize.IsInit())
{
switch(oox_page->m_oPaperSize->GetValue())
{
case SimpleTypes::Spreadsheet::pagesizeLetterPaper:
width = odf_types::length(8.5, odf_types::length::inch);
height = odf_types::length(11, odf_types::length::inch);
break;
case SimpleTypes::Spreadsheet::pagesizeA3Paper:
width = odf_types::length(210, odf_types::length::mm);
height = odf_types::length(297, odf_types::length::mm);
break;
case SimpleTypes::Spreadsheet::pagesizeA4Paper:
width = odf_types::length(297, odf_types::length::mm);
height = odf_types::length(420, odf_types::length::mm);
break;
//todooo
}
}
ods_context->page_layout_context()->set_page_size(width, height);
}
void XlsxConverter::convert(OOX::Spreadsheet::CPageMargins *oox_page)
void XlsxConverter::convert(OOX::Spreadsheet::CPageMargins *oox_page)
{
if (!oox_page) return;
_CP_OPT(double) top, left,right,header,footer,bottom;
ods_context->page_layout_context()->set_page_margin(top,left,bottom, right,header,footer);
ods_context->page_layout_context()->set_page_margin(top, left, bottom, right, header, footer);
}
void XlsxConverter::convert(OOX::Spreadsheet::CSheetFormatPr *oox_sheet_format_pr)
@ -1736,6 +1826,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
{
if (!oox_drawing)return;
OOX::IFileContainer* old_container = xlsx_current_container;
xlsx_current_container = dynamic_cast<OOX::IFileContainer*>(oox_drawing);
for (unsigned int dr = 0 ; dr < oox_drawing->m_arrItems.size(); dr++)
@ -1745,7 +1836,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CDrawing *oox_drawing)
ods_context->end_drawings();
}
xlsx_current_container = NULL;
xlsx_current_container = old_container;
}

View File

@ -88,6 +88,8 @@ namespace OOX
class CPageMargins;
class CSi;
class CWorkbookView;
class CPictureWorksheet;
class CHeaderFooter;
}
}
@ -151,6 +153,8 @@ namespace Oox2Odf
void convert(OOX::Spreadsheet::CWorksheet *oox_sheet);
void convert(OOX::Spreadsheet::CDefinedName *oox_defined);
void convert(OOX::Spreadsheet::CTable *oox_table_part);
void convert(OOX::Spreadsheet::CPictureWorksheet *oox_background);
void convert(OOX::Spreadsheet::CHeaderFooter *oox_header_footer);
void convert(OOX::Spreadsheet::CCol *oox_column);
void convert(OOX::Spreadsheet::CRow *oox_row);

View File

@ -145,19 +145,21 @@ namespace PPTX
lColorIndex._set(node.GetAttribute(_T("w:followedHyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("folHlink"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("w:hyperlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("hlink"), lColorIndex));
}
lColorIndex._set(node.GetAttribute(_T("accent1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent3"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent3"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent4"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent4"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent5"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent5"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent6"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent6"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("bg1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("bg2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("tx1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("tx2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("folHlink")));ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("folHlink"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("hlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("hlink"), lColorIndex));
else
{
lColorIndex._set(node.GetAttribute(_T("accent1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent3"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent3"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent4"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent4"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent5"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent5"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("accent6"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("accent6"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("bg1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("bg2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("bg2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("tx1"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx1"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("tx2"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("tx2"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("folHlink")));ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("folHlink"), lColorIndex));
lColorIndex._set(node.GetAttribute(_T("hlink"))); ColorMap.insert(std::pair<std::wstring,Limit::ColorSchemeIndex>(_T("hlink"), lColorIndex));
}
}
virtual std::wstring toXML() const

View File

@ -37,6 +37,7 @@
#include "./../Limit/TextCaps.h"
#include "./../Limit/TextStrike.h"
#include "./../Limit/TextUnderline.h"
#include "Ln.h"
#include "UniFill.h"
#include "TextFont.h"
@ -89,6 +90,194 @@ namespace PPTX
virtual void FillParentPointersForChilds(){};
};
class UFillTx : public WrapperWritingElement
{
public:
WritingElement_AdditionConstructors(UFillTx)
UFillTx(std::wstring name = L"a:uFillTx")
{
m_name = name;
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_uFillTx;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
m_name = node.GetName();
Fill.GetFillFrom(node);
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
m_name = oReader.GetName();
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
Fill.fromXML(oReader);
}
FillParentPointersForChilds();
}
void Merge(nullable<UFillTx>& uFillTx)const
{
if(!uFillTx.is_init())
uFillTx = UFillTx();
uFillTx->m_name = m_name;
if(Fill.is_init())
uFillTx->Fill = Fill;
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecord1(0, Fill);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // start attributes
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
Fill.fromPPTY(pReader);
break;
}
default:
{
pReader->SkipRecord();
}
}
}
pReader->Seek(_end_rec);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(m_name);
Fill.toXmlWriter(pWriter);
pWriter->EndNode(m_name);
}
UniFill Fill;
std::wstring m_name;
protected:
virtual void FillParentPointersForChilds()
{
Fill.SetParentPointer(this);
}
};
class Highlight : public WrapperWritingElement
{
public:
WritingElement_AdditionConstructors(Highlight)
Highlight()
{
}
virtual OOX::EElementType getType () const
{
return OOX::et_a_highlight;
}
virtual void fromXML(XmlUtils::CXmlNode& node)
{
Color.GetColorFrom(node);
FillParentPointersForChilds();
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
if ( oReader.IsEmptyNode() )
return;
int nParentDepth = oReader.GetDepth();
while( oReader.ReadNextSiblingNode( nParentDepth ) )
{
std::wstring sName = XmlUtils::GetNameNoNS(oReader.GetName());
Color.fromXML(oReader);
}
FillParentPointersForChilds();
}
void Merge(nullable<Highlight>& highlight)const
{
if(!highlight.is_init())
highlight = Highlight();
if(Color.is_init())
highlight->Color = Color;
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
pWriter->WriteRecord1(0, Color);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
{
LONG _end_rec = pReader->GetPos() + pReader->GetLong() + 4;
pReader->Skip(1); // start attributes
while (pReader->GetPos() < _end_rec)
{
BYTE _at = pReader->GetUChar();
switch (_at)
{
case 0:
{
Color.fromPPTY(pReader);
break;
}
default:
{
pReader->SkipRecord();
}
}
}
pReader->Seek(_end_rec);
}
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
{
pWriter->StartNode(L"a:highlight");
Color.toXmlWriter(pWriter);
pWriter->EndNode(L"a:highlight");
}
UniColor Color;
protected:
virtual void FillParentPointersForChilds()
{
Color.SetParentPointer(this);
}
};
class RunProperties : public WrapperWritingElement
{
public:
@ -125,21 +314,27 @@ namespace PPTX
{
Fill.fromXML(oReader);
}
else if ( _T("ln") == sName )
else if ( L"ln" == sName )
ln = oReader;
else if ( _T("cs") == sName )
else if ( L"cs" == sName )
cs = oReader;
else if ( _T("ea") == sName )
else if ( L"ea" == sName )
ea = oReader;
else if ( _T("latin") == sName )
else if ( L"latin" == sName )
latin = oReader;
else if ( _T("sym") == sName )
else if ( L"sym" == sName )
sym = oReader;
else if ( _T("hlinkClick") == sName )
else if ( L"uFill" == sName )
uFill = oReader;
else if ( L"uFillTx" == sName )
uFillTx = oReader;
else if ( L"hlinkClick" == sName )
hlinkClick = oReader;
else if (_T("hlinkMouseOver") == sName)
else if (L"hlinkMouseOver" == sName)
hlinkMouseOver = oReader;
else if ( _T("rtl") == sName )
else if ( L"rtl" == sName )
rtl = oReader;
else if ( L"rtl" == sName )
rtl = oReader;
else if ( L"effectDag" == sName ||
L"effectLst" == sName ||
@ -175,7 +370,7 @@ namespace PPTX
node.ReadAttributeBase(L"spc", spc);
XmlUtils::CXmlNodes oNodes;
if (node.GetNodes(_T("*"), oNodes))
if (node.GetNodes(L"*", oNodes))
{
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
@ -185,22 +380,28 @@ namespace PPTX
std::wstring strName = XmlUtils::GetNameNoNS(oNode.GetName());
if (_T("ln") == strName)
if (L"ln" == strName)
ln = oNode;
else if (_T("latin") == strName)
else if (L"latin" == strName)
latin = oNode;
else if (_T("ea") == strName)
else if (L"ea" == strName)
ea = oNode;
else if (_T("cs") == strName)
else if (L"cs" == strName)
cs = oNode;
else if (_T("sym") == strName)
else if (L"sym" == strName)
sym = oNode;
else if (_T("hlinkClick") == strName)
else if (L"hlinkClick" == strName)
hlinkClick = oNode;
else if (_T("hlinkMouseOver") == strName)
else if (L"hlinkMouseOver" == strName)
hlinkMouseOver = oNode;
else if (_T("rtl") == strName)
else if (L"rtl" == strName)
rtl = oNode;
else if (L"uFill" == strName)
uFill = oNode;
else if (L"uFillTx" == strName)
uFillTx = oNode;
else if (L"highlight" == strName)
highlight = oNode;
}
}
@ -214,25 +415,25 @@ namespace PPTX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start ( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("altLang"), altLang)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("b"), b)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("bmk"), bmk)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("cap"), cap)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("dirty"), dirty)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("err"), err)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("i"), i)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kern"), kern)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("kumimoji"), kumimoji)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("lang"), lang)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("noProof"), noProof)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("normalizeH"), normalizeH)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("smtClean"), smtClean)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("smtId"), smtId)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("strike"), strike)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("sz"), sz)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("u"), u)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("baseline"), baseline)
WritingElement_ReadAttributes_Read_else_if( oReader, _T("spc"), spc)
WritingElement_ReadAttributes_Read_if ( oReader, L"altLang", altLang)
WritingElement_ReadAttributes_Read_else_if( oReader, L"b", b)
WritingElement_ReadAttributes_Read_else_if( oReader, L"bmk", bmk)
WritingElement_ReadAttributes_Read_else_if( oReader, L"cap", cap)
WritingElement_ReadAttributes_Read_else_if( oReader, L"dirty", dirty)
WritingElement_ReadAttributes_Read_else_if( oReader, L"err", err)
WritingElement_ReadAttributes_Read_else_if( oReader, L"i", i)
WritingElement_ReadAttributes_Read_else_if( oReader, L"kern", kern)
WritingElement_ReadAttributes_Read_else_if( oReader, L"kumimoji", kumimoji)
WritingElement_ReadAttributes_Read_else_if( oReader, L"lang", lang)
WritingElement_ReadAttributes_Read_else_if( oReader, L"noProof", noProof)
WritingElement_ReadAttributes_Read_else_if( oReader, L"normalizeH", normalizeH)
WritingElement_ReadAttributes_Read_else_if( oReader, L"smtClean", smtClean)
WritingElement_ReadAttributes_Read_else_if( oReader, L"smtId", smtId)
WritingElement_ReadAttributes_Read_else_if( oReader, L"strike", strike)
WritingElement_ReadAttributes_Read_else_if( oReader, L"sz", sz)
WritingElement_ReadAttributes_Read_else_if( oReader, L"u", u)
WritingElement_ReadAttributes_Read_else_if( oReader, L"baseline", baseline)
WritingElement_ReadAttributes_Read_else_if( oReader, L"spc", spc)
WritingElement_ReadAttributes_End ( oReader )
Normalize();
@ -244,25 +445,25 @@ namespace PPTX
pWriter->StartAttributes();
pWriter->WriteAttribute(_T("kumimoji"), kumimoji);
pWriter->WriteAttribute(_T("lang"), lang);
pWriter->WriteAttribute(_T("altLang"), altLang);
pWriter->WriteAttribute(_T("sz"), sz);
pWriter->WriteAttribute(_T("b"), b);
pWriter->WriteAttribute(_T("i"), i);
pWriter->WriteAttribute(_T("u"), u);
pWriter->WriteAttribute(_T("strike"), strike);
pWriter->WriteAttribute(_T("kern"), kern);
pWriter->WriteAttribute(_T("cap"), cap);
pWriter->WriteAttribute(_T("spc"), spc);
pWriter->WriteAttribute(_T("normalizeH"), normalizeH);
pWriter->WriteAttribute(_T("baseline"), baseline);
pWriter->WriteAttribute(_T("noProof"), noProof);
pWriter->WriteAttribute(_T("dirty"), dirty);
pWriter->WriteAttribute(_T("err"), err);
pWriter->WriteAttribute(_T("smtClean"), smtClean);
pWriter->WriteAttribute(_T("smtId"), smtId);
pWriter->WriteAttribute(_T("bmk"), bmk);
pWriter->WriteAttribute(L"kumimoji", kumimoji);
pWriter->WriteAttribute(L"lang", lang);
pWriter->WriteAttribute(L"altLang", altLang);
pWriter->WriteAttribute(L"sz", sz);
pWriter->WriteAttribute(L"b", b);
pWriter->WriteAttribute(L"i", i);
pWriter->WriteAttribute(L"u", u);
pWriter->WriteAttribute(L"strike", strike);
pWriter->WriteAttribute(L"kern", kern);
pWriter->WriteAttribute(L"cap", cap);
pWriter->WriteAttribute(L"spc", spc);
pWriter->WriteAttribute(L"normalizeH", normalizeH);
pWriter->WriteAttribute(L"baseline", baseline);
pWriter->WriteAttribute(L"noProof", noProof);
pWriter->WriteAttribute(L"dirty", dirty);
pWriter->WriteAttribute(L"err", err);
pWriter->WriteAttribute(L"smtClean", smtClean);
pWriter->WriteAttribute(L"smtId", smtId);
pWriter->WriteAttribute(L"bmk", bmk);
pWriter->EndAttributes();
@ -276,6 +477,10 @@ namespace PPTX
pWriter->Write(hlinkClick);
pWriter->Write(hlinkMouseOver);
pWriter->Write(rtl);
pWriter->Write(uFill);
pWriter->Write(uFillTx);
pWriter->Write(uFillTx);
pWriter->Write(highlight);
pWriter->EndNode(m_name);
}
@ -289,13 +494,18 @@ namespace PPTX
if(ln.is_init())
ln->Merge(props->ln);
if(Fill.is_init())
props->Fill = Fill;//.fromXML(Fill.toXML());
props->Fill = Fill;
if(uFill.is_init())
uFill->Merge(props->uFill);
if(uFillTx.is_init())
uFillTx->Merge(props->uFillTx);
if (highlight.is_init())
highlight->Merge(props->highlight);
// EffectProperties EffectList;
//highlight (Highlight Color) §21.1.2.3.4
//uLn (Underline Stroke) §21.1.2.3.14
//uLnTx (Underline Follows Text) §21.1.2.3.15
//uFill (Underline Fill) §21.1.2.3.12
//uFillTx (Underline Fill Properties Follow Text) §21.1.2.3.13
if(latin.is_init()) latin->Merge(props->latin);
if(ea.is_init()) ea->Merge(props->ea);
@ -304,53 +514,52 @@ namespace PPTX
/*
nullable_property<Hyperlink> hlinkClick;
nullable_property<Hyperlink> hlinkMouseOver;
//rtl (Right to Left Run) §21.1.2.2.8
*/
// Attributes
if(altLang.is_init()) props->altLang = *altLang;
if(b.is_init()) props->b = *b;
if(baseline.is_init()) props->baseline = *baseline;
if(bmk.is_init()) props->bmk = *bmk;
if(cap.is_init()) props->cap = *cap;
if(dirty.is_init()) props->dirty = *dirty;
if(err.is_init()) props->err = *err;
if(i.is_init()) props->i = *i;
if(kern.is_init()) props->kern = *kern;
if(kumimoji.is_init()) props->kumimoji = *kumimoji;
if(lang.is_init()) props->lang = *lang;
if(noProof.is_init()) props->noProof = *noProof;
if(normalizeH.is_init()) props->normalizeH = *normalizeH;
if(smtClean.is_init()) props->smtClean = *smtClean;
if(smtId.is_init()) props->smtId = *smtId;
if(spc.is_init()) props->spc = *spc;
if(strike.is_init()) props->strike = *strike;
if(sz.is_init()) props->sz = *sz;
if(u.is_init()) props->u = *u;
if(rtl.is_init()) props->rtl = new Logic::Rtl();
if(altLang.is_init()) props->altLang = *altLang;
if(b.is_init()) props->b = *b;
if(baseline.is_init()) props->baseline = *baseline;
if(bmk.is_init()) props->bmk = *bmk;
if(cap.is_init()) props->cap = *cap;
if(dirty.is_init()) props->dirty = *dirty;
if(err.is_init()) props->err = *err;
if(i.is_init()) props->i = *i;
if(kern.is_init()) props->kern = *kern;
if(kumimoji.is_init()) props->kumimoji = *kumimoji;
if(lang.is_init()) props->lang = *lang;
if(noProof.is_init()) props->noProof = *noProof;
if(normalizeH.is_init())props->normalizeH = *normalizeH;
if(smtClean.is_init()) props->smtClean = *smtClean;
if(smtId.is_init()) props->smtId = *smtId;
if(spc.is_init()) props->spc = *spc;
if(strike.is_init()) props->strike = *strike;
if(sz.is_init()) props->sz = *sz;
if(u.is_init()) props->u = *u;
}
virtual void toPPTY(NSBinPptxRW::CBinaryFileWriter* pWriter) const
{
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeStart);
pWriter->WriteString2(0, altLang);
pWriter->WriteBool2(1, b);
pWriter->WriteInt2(2, baseline);
pWriter->WriteString2(3, bmk);
pWriter->WriteLimit2(4, cap);
pWriter->WriteBool2(5, dirty);
pWriter->WriteBool2(6, err);
pWriter->WriteBool2(7, i);
pWriter->WriteInt2(8, kern);
pWriter->WriteBool2(9, kumimoji);
pWriter->WriteString2(10, lang);
pWriter->WriteBool2(11, noProof);
pWriter->WriteBool2(12, normalizeH);
pWriter->WriteBool2(13, smtClean);
pWriter->WriteInt2(14, smtId);
pWriter->WriteInt2(15, spc);
pWriter->WriteLimit2(16, strike);
pWriter->WriteInt2(17, sz);
pWriter->WriteLimit2(18, u);
pWriter->WriteString2(0, altLang);
pWriter->WriteBool2 (1, b);
pWriter->WriteInt2 (2, baseline);
pWriter->WriteString2(3, bmk);
pWriter->WriteLimit2(4, cap);
pWriter->WriteBool2 (5, dirty);
pWriter->WriteBool2 (6, err);
pWriter->WriteBool2 (7, i);
pWriter->WriteInt2 (8, kern);
pWriter->WriteBool2 (9, kumimoji);
pWriter->WriteString2(10, lang);
pWriter->WriteBool2 (11, noProof);
pWriter->WriteBool2 (12, normalizeH);
pWriter->WriteBool2 (13, smtClean);
pWriter->WriteInt2 (14, smtId);
pWriter->WriteInt2 (15, spc);
pWriter->WriteLimit2(16, strike);
pWriter->WriteInt2 (17, sz);
pWriter->WriteLimit2(18, u);
pWriter->WriteBYTE(NSBinPptxRW::g_nodeAttributeEnd);
@ -366,6 +575,11 @@ namespace PPTX
pWriter->WriteRecord2(7, hlinkClick);
pWriter->WriteRecord2(8, hlinkMouseOver);
pWriter->WriteRecord2(9, rtl);
pWriter->WriteRecord2(10, uFill);
pWriter->WriteRecord2(11, uFillTx);
pWriter->WriteRecord2(12, highlight);
}
virtual void fromPPTY(NSBinPptxRW::CBinaryFileReader* pReader)
@ -503,35 +717,34 @@ namespace PPTX
}
case 2:
{
// TODO:
pReader->SkipRecord();
EffectList.fromPPTY(pReader);
break;
}
case 3:
{
latin = new Logic::TextFont();
latin->m_name = _T("a:latin");
latin->m_name = L"a:latin";
latin->fromPPTY(pReader);
break;
}
case 4:
{
ea = new Logic::TextFont();
ea->m_name = _T("a:ea");
ea->m_name = L"a:ea";
ea->fromPPTY(pReader);
break;
}
case 5:
{
cs = new Logic::TextFont();
cs->m_name = _T("a:cs");
cs->m_name = L"a:cs";
cs->fromPPTY(pReader);
break;
}
case 6:
{
sym = new Logic::TextFont();
sym->m_name = _T("a:sym");
sym->m_name = L"a:sym";
sym->fromPPTY(pReader);
break;
}
@ -546,6 +759,26 @@ namespace PPTX
hlinkMouseOver = new Logic::Hyperlink(L"hlinkMouseOver");
hlinkMouseOver->fromPPTY(pReader);
}
case 9:
{
rtl = new Logic::Rtl();
rtl->fromPPTY(pReader);
}
case 10:
{
uFill = new Logic::UFillTx(L"a:uFill");
uFill->fromPPTY(pReader);
}
case 11:
{
uFillTx = new Logic::UFillTx(L"a:uFillTx");
uFillTx->fromPPTY(pReader);
}
case 12:
{
highlight = new Logic::Highlight();
highlight->fromPPTY(pReader);
}
default:
{
pReader->SkipRecord();
@ -556,16 +789,15 @@ namespace PPTX
pReader->Seek(_end_rec);
}
public:
//Childs
//Childs
//uLn (Underline Stroke) §21.1.2.3.14
//uLnTx (Underline Follows Text) §21.1.2.3.15
nullable<Ln> ln;
UniFill Fill;
EffectProperties EffectList;
//highlight (Highlight Color) §21.1.2.3.4
//uLn (Underline Stroke) §21.1.2.3.14
//uLnTx (Underline Follows Text) §21.1.2.3.15
//uFill (Underline Fill) §21.1.2.3.12
//uFillTx (Underline Fill Properties Follow Text) §21.1.2.3.13
nullable<Highlight> highlight;
nullable<UFillTx> uFill;
nullable<UFillTx> uFillTx;
nullable<TextFont> latin;
nullable<TextFont> ea;
nullable<TextFont> cs;
@ -574,7 +806,7 @@ namespace PPTX
nullable<Hyperlink> hlinkMouseOver;
nullable<Rtl> rtl;
// Attributes
// Attributes
nullable_string altLang;
nullable_bool b;
nullable_int baseline;
@ -594,6 +826,7 @@ namespace PPTX
nullable_limit<Limit::TextStrike> strike;
nullable_int sz;
nullable_limit<Limit::TextUnderline> u;
std::wstring m_name;
protected:
virtual void FillParentPointersForChilds()
@ -614,6 +847,14 @@ namespace PPTX
hlinkClick->SetParentPointer(this);
if(hlinkMouseOver.is_init())
hlinkMouseOver->SetParentPointer(this);
if(rtl.is_init())
rtl->SetParentPointer(this);
if(uFill.is_init())
uFill->SetParentPointer(this);
if(uFillTx.is_init())
uFillTx->SetParentPointer(this);
if (highlight.is_init())
highlight->SetParentPointer(this);
}
AVSINLINE void Normalize()

View File

@ -330,6 +330,8 @@ namespace OOX
et_a_txDef, // <a:txDef>
et_a_up, // <a:up>
et_a_xfrm, // <a:xfrm>
et_a_uFillTx,
et_a_highlight,
et_a_groupSpPr, // <a:groupSpPr>
et_a_Shape, // <a:sp>

View File

@ -1681,27 +1681,73 @@ namespace SimpleTypes
return this->m_eValue;
}
virtual std::wstring ToString () const
virtual std::wstring ToString () const
{
return std::to_wstring(this->m_eValue );
}
SimpleType_FromString (EPageSize)
SimpleType_Operator_Equal (CPageSize)
SimpleType_Operator_Equal (CPageSize)
};
enum EPageUnits
{
mm = 0,
cm = 1,
inch = 2,
pt = 3,
px = 4,
emu = 5
};
template<EPageUnits eDefValue = mm>
class CPageUnits : public CSimpleType<EPageUnits, eDefValue>
{
public:
CPageUnits() {}
virtual EPageUnits FromString(std::wstring &sValue)
{
if (sValue == L"in") this->m_eValue = inch;
else if (sValue == L"mm") this->m_eValue = mm;
else if (sValue == L"cm") this->m_eValue = cm;
else if (sValue == L"pt") this->m_eValue = pt;
else if (sValue == L"px") this->m_eValue = px;
return this->m_eValue;
}
virtual std::wstring ToString () const
{
std::wstring sResult;
switch(this->m_eValue)
{
case mm: sResult = L"mm";break;
case cm: sResult = L"cm";break;
case pt: sResult = L"pt";break;
case px: sResult = L"px";break;
case inch: sResult = L"in";break;
}
return sResult;
}
SimpleType_FromString (EPageUnits)
SimpleType_Operator_Equal (CPageUnits)
};
enum ETotalsRowFunction
{
totalrowfunctionAverage = 1,
totalrowfunctionCount = 2,
totalrowfunctionCountNums = 3,
totalrowfunctionCustom = 4,
totalrowfunctionMax = 5,
totalrowfunctionMin = 6,
totalrowfunctionNone = 7,
totalrowfunctionStdDev = 8,
totalrowfunctionSum = 9,
totalrowfunctionVar = 10
totalrowfunctionAverage = 1,
totalrowfunctionCount = 2,
totalrowfunctionCountNums = 3,
totalrowfunctionCustom = 4,
totalrowfunctionMax = 5,
totalrowfunctionMin = 6,
totalrowfunctionNone = 7,
totalrowfunctionStdDev = 8,
totalrowfunctionSum = 9,
totalrowfunctionVar = 10
};
template<ETotalsRowFunction eDefValue = totalrowfunctionNone>
class CTotalsRowFunction : public CSimpleType<ETotalsRowFunction, eDefValue>
{

View File

@ -87,17 +87,14 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("left"), m_oLeft)
WritingElement_ReadAttributes_Read_if ( oReader, _T("top"), m_oTop)
WritingElement_ReadAttributes_Read_if ( oReader, _T("right"), m_oRight)
WritingElement_ReadAttributes_Read_if ( oReader, _T("bottom"), m_oBottom)
WritingElement_ReadAttributes_Read_if ( oReader, _T("header"), m_oHeader)
WritingElement_ReadAttributes_Read_if ( oReader, _T("footer"), m_oFooter)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("left"), m_oLeft)
WritingElement_ReadAttributes_Read_if ( oReader, _T("top"), m_oTop)
WritingElement_ReadAttributes_Read_if ( oReader, _T("right"), m_oRight)
WritingElement_ReadAttributes_Read_if ( oReader, _T("bottom"), m_oBottom)
WritingElement_ReadAttributes_Read_if ( oReader, _T("header"), m_oHeader)
WritingElement_ReadAttributes_Read_if ( oReader, _T("footer"), m_oFooter)
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -121,7 +118,7 @@ namespace OOX
virtual void fromXML(XmlUtils::CXmlNode& node)
{
}
virtual std::wstring toXML() const
virtual std::wstring toXML() const
{
return _T("");
}
@ -138,10 +135,14 @@ namespace OOX
writer.WriteString(sOrientation.c_str());
writer.WriteString(L"\"");
}
if (m_oRId.IsInit())
{
WritingStringAttrString(L"r:id", m_oRId->ToString());
}
writer.WriteString(L"/>");
}
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -153,23 +154,23 @@ namespace OOX
{
return et_x_PageSetup;
}
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("orientation"), m_oOrientation)
WritingElement_ReadAttributes_Read_if ( oReader, _T("paperSize"), m_oPaperSize)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("orientation"), m_oOrientation)
WritingElement_ReadAttributes_Read_if ( oReader, _T("paperSize"), m_oPaperSize)
WritingElement_ReadAttributes_Read_if ( oReader, _T("paperUnits"), m_oPaperUnits)
WritingElement_ReadAttributes_Read_if ( oReader, _T("paperWidth"), m_oPaperWidth)
WritingElement_ReadAttributes_Read_if ( oReader, _T("paperHeight"), m_oPaperHeight)
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_oRId)
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CPageOrientation<>> m_oOrientation;
nullable<SimpleTypes::Spreadsheet::CPageSize<>> m_oPaperSize;
nullable<SimpleTypes::CRelationshipId> m_oRId;
nullable<SimpleTypes::CPageOrientation<>> m_oOrientation;
nullable<SimpleTypes::Spreadsheet::CPageSize<>> m_oPaperSize;
nullable<SimpleTypes::Spreadsheet::CPageUnits<>> m_oPaperUnits;
nullable<SimpleTypes::CDouble> m_oPaperWidth;
nullable<SimpleTypes::CDouble> m_oPaperHeight;
};
class CPrintOptions : public WritingElement
{
@ -193,8 +194,8 @@ namespace OOX
if(m_oGridLines.IsInit() || m_oGridLinesSet.IsInit() || m_oHeadings.IsInit())
{
writer.WriteString(L"<printOptions");
WritingStringNullableAttrBool(L"headings", m_oHeadings);
WritingStringNullableAttrBool(L"gridLines", m_oGridLines);
WritingStringNullableAttrBool(L"headings", m_oHeadings);
WritingStringNullableAttrBool(L"gridLines", m_oGridLines);
WritingStringNullableAttrBool(L"gridLinesSet", m_oGridLinesSet);
writer.WriteString(L"/>");
}
@ -216,16 +217,13 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("gridLines"), m_oGridLines)
WritingElement_ReadAttributes_Read_if ( oReader, _T("gridLinesSet"), m_oGridLinesSet)
WritingElement_ReadAttributes_Read_if ( oReader, _T("headings"), m_oHeadings)
WritingElement_ReadAttributes_Read_if ( oReader, _T("horizontalCentered"), m_oHorizontalCentered)
WritingElement_ReadAttributes_Read_if ( oReader, _T("verticalCentered"), m_oVerticalCentered)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("gridLines"), m_oGridLines)
WritingElement_ReadAttributes_Read_if ( oReader, _T("gridLinesSet"), m_oGridLinesSet)
WritingElement_ReadAttributes_Read_if ( oReader, _T("headings"), m_oHeadings)
WritingElement_ReadAttributes_Read_if ( oReader, _T("horizontalCentered"), m_oHorizontalCentered)
WritingElement_ReadAttributes_Read_if ( oReader, _T("verticalCentered"), m_oVerticalCentered)
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -272,12 +270,9 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("ref"), m_oRef)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -315,7 +310,7 @@ namespace OOX
WritingStringNullableAttrBool(L"zeroHeight", m_oZeroHeight);
writer.WriteString(_T("/>"));
}
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
virtual void fromXML(XmlUtils::CXmlLiteReader& oReader)
{
ReadAttributes( oReader );
@ -332,20 +327,17 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("baseColWidth"), m_oBaseColWidth) // ToDo Excel не воспринимает значения не uint (мы приводим к uint)
WritingElement_ReadAttributes_Read_if ( oReader, _T("customHeight"), m_oCustomHeight )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultColWidth"), m_oDefaultColWidth )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultRowHeight"), m_oDefaultRowHeight )
WritingElement_ReadAttributes_Read_if ( oReader, _T("outlineLevelCol"), m_oOutlineLevelCol )
WritingElement_ReadAttributes_Read_if ( oReader, _T("outlineLevelRow"), m_oOutlineLevelRow )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thickBottom"), m_oThickBottom )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thickTop"), m_oThickTop )
WritingElement_ReadAttributes_Read_if ( oReader, _T("zeroHeight"), m_oZeroHeight )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("baseColWidth"), m_oBaseColWidth) // ToDo Excel не воспринимает значения не uint (мы приводим к uint)
WritingElement_ReadAttributes_Read_if ( oReader, _T("customHeight"), m_oCustomHeight )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultColWidth"), m_oDefaultColWidth )
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultRowHeight"), m_oDefaultRowHeight )
WritingElement_ReadAttributes_Read_if ( oReader, _T("outlineLevelCol"), m_oOutlineLevelCol )
WritingElement_ReadAttributes_Read_if ( oReader, _T("outlineLevelRow"), m_oOutlineLevelRow )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thickBottom"), m_oThickBottom )
WritingElement_ReadAttributes_Read_if ( oReader, _T("thickTop"), m_oThickTop )
WritingElement_ReadAttributes_Read_if ( oReader, _T("zeroHeight"), m_oZeroHeight )
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -402,22 +394,19 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("activePane") , m_oActivePane)
WritingElement_ReadAttributes_Read_if ( oReader, _T("state") , m_oState)
WritingElement_ReadAttributes_Read_if ( oReader, _T("topLeftCell") , m_oTopLeftCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("xSplit") , m_oXSplit)
WritingElement_ReadAttributes_Read_if ( oReader, _T("ySplit") , m_oYSplit)
WritingElement_ReadAttributes_Read_if ( oReader, _T("activePane") , m_oActivePane)
WritingElement_ReadAttributes_Read_if ( oReader, _T("state") , m_oState)
WritingElement_ReadAttributes_Read_if ( oReader, _T("topLeftCell") , m_oTopLeftCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("xSplit") , m_oXSplit)
WritingElement_ReadAttributes_Read_if ( oReader, _T("ySplit") , m_oYSplit)
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::Spreadsheet::CActivePane<>> m_oActivePane;
nullable<SimpleTypes::Spreadsheet::CPaneState<>> m_oState;
nullable<std::wstring> m_oTopLeftCell;
nullable<std::wstring> m_oTopLeftCell;
nullable<SimpleTypes::CDouble> m_oXSplit;
nullable<SimpleTypes::CDouble> m_oYSplit;
};
@ -464,21 +453,18 @@ namespace OOX
private:
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCell") , m_oActiveCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCellId") , m_oActiveCellId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("sqref") , m_oSqref)
WritingElement_ReadAttributes_Read_if ( oReader, _T("pane") , m_oPane)
WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCell") , m_oActiveCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("activeCellId") , m_oActiveCellId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("sqref") , m_oSqref)
WritingElement_ReadAttributes_Read_if ( oReader, _T("pane") , m_oPane)
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<std::wstring> m_oActiveCell;
nullable<std::wstring> m_oActiveCell;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oActiveCellId;
nullable<std::wstring> m_oSqref;
nullable<std::wstring> m_oSqref;
nullable<SimpleTypes::Spreadsheet::CActivePane<>> m_oPane;
};
@ -566,30 +552,27 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
// Читаем атрибуты
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("colorId"), m_oColorId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultGridColor"), m_oDefaultGridColor)
WritingElement_ReadAttributes_Read_if ( oReader, _T("rightToLeft"), m_oRightToLeft)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showFormulas"), m_oShowFormulas)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showGridLines"), m_oShowGridLines)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showOutlineSymbols"), m_oShowOutlineSymbols)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showRowColHeaders"), m_oShowRowColHeaders)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showRuler"), m_oShowRuler)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showWhiteSpace"), m_oShowWhiteSpace)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showZeros"), m_oShowZeros)
WritingElement_ReadAttributes_Read_if ( oReader, _T("tabSelected"), m_oTabSelected)
WritingElement_ReadAttributes_Read_if ( oReader, _T("topLeftCell"), m_oTopLeftCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("view"), m_oView)
WritingElement_ReadAttributes_Read_if ( oReader, _T("windowProtection"), m_oWindowProtection)
WritingElement_ReadAttributes_Read_if ( oReader, _T("workbookViewId"), m_oWorkbookViewId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScale"), m_oZoomScale)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScaleNormal"), m_oZoomScaleNormal)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScalePageLayoutView"), m_oZoomScalePageLayoutView)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScaleSheetLayoutView"), m_oZoomScaleSheetLayoutView)
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("colorId"), m_oColorId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("defaultGridColor"), m_oDefaultGridColor)
WritingElement_ReadAttributes_Read_if ( oReader, _T("rightToLeft"), m_oRightToLeft)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showFormulas"), m_oShowFormulas)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showGridLines"), m_oShowGridLines)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showOutlineSymbols"), m_oShowOutlineSymbols)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showRowColHeaders"), m_oShowRowColHeaders)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showRuler"), m_oShowRuler)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showWhiteSpace"), m_oShowWhiteSpace)
WritingElement_ReadAttributes_Read_if ( oReader, _T("showZeros"), m_oShowZeros)
WritingElement_ReadAttributes_Read_if ( oReader, _T("tabSelected"), m_oTabSelected)
WritingElement_ReadAttributes_Read_if ( oReader, _T("topLeftCell"), m_oTopLeftCell)
WritingElement_ReadAttributes_Read_if ( oReader, _T("view"), m_oView)
WritingElement_ReadAttributes_Read_if ( oReader, _T("windowProtection"), m_oWindowProtection)
WritingElement_ReadAttributes_Read_if ( oReader, _T("workbookViewId"), m_oWorkbookViewId)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScale"), m_oZoomScale)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScaleNormal"), m_oZoomScaleNormal)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScalePageLayoutView"), m_oZoomScalePageLayoutView)
WritingElement_ReadAttributes_Read_if ( oReader, _T("zoomScaleSheetLayoutView"), m_oZoomScaleSheetLayoutView)
WritingElement_ReadAttributes_End( oReader )
}
public:
@ -606,7 +589,7 @@ namespace OOX
nullable<SimpleTypes::COnOff<>> m_oShowWhiteSpace;
nullable<SimpleTypes::COnOff<>> m_oShowZeros;
nullable<SimpleTypes::COnOff<>> m_oTabSelected;
nullable<std::wstring> m_oTopLeftCell;
nullable<std::wstring> m_oTopLeftCell;
nullable<SimpleTypes::Spreadsheet::CSheetViewType<>>m_oView;
nullable<SimpleTypes::COnOff<>> m_oWindowProtection;
nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oWorkbookViewId;
@ -746,12 +729,12 @@ namespace OOX
public:
nullable<CColor> m_oTabColor;
nullable<std::wstring> m_oCodeName;
nullable<std::wstring> m_oCodeName;
nullable<SimpleTypes::COnOff<>> m_oEnableFormatConditionsCalculation;
nullable<SimpleTypes::COnOff<>> m_oFilterMode;
nullable<SimpleTypes::COnOff<>> m_oPublished;
nullable<SimpleTypes::COnOff<>> m_oSyncHorizontal;
nullable<std::wstring> m_oSyncRef;
nullable<std::wstring> m_oSyncRef;
nullable<SimpleTypes::COnOff<>> m_oSyncVertical;
nullable<SimpleTypes::COnOff<>> m_oTransitionEntry;
nullable<SimpleTypes::COnOff<>> m_oTransitionEvaluation;
@ -1070,10 +1053,8 @@ namespace OOX
void ReadAttributes(XmlUtils::CXmlLiteReader& oReader)
{
WritingElement_ReadAttributes_Start( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_oId )
WritingElement_ReadAttributes_End( oReader )
WritingElement_ReadAttributes_Read_if ( oReader, _T("r:id"), m_oId )
WritingElement_ReadAttributes_End( oReader )
}
public:
nullable<SimpleTypes::CRelationshipId > m_oId;

View File

@ -694,6 +694,25 @@ namespace NSStringUtils
return 1;
}
};
static void string_replace(std::wstring& text, const std::wstring& replaceFrom, const std::wstring& replaceTo)
{
size_t posn = 0;
while (std::wstring::npos != (posn = text.find(replaceFrom, posn)))
{
text.replace(posn, replaceFrom.length(), replaceTo);
posn += replaceTo.length();
}
}
static void string_replaceA(std::string& text, const std::string& replaceFrom, const std::string& replaceTo)
{
size_t posn = 0;
while (std::string::npos != (posn = text.find(replaceFrom, posn)))
{
text.replace(posn, replaceFrom.length(), replaceTo);
posn += replaceTo.length();
}
}
}
#endif // _BUILD_STRING_BUILDER_CROSSPLATFORM_H_

View File

@ -336,7 +336,7 @@ void MyHandleError(char *s);
bool Sign(PCCERT_CONTEXT pCertContext, std::wstring sFileXml, std::wstring sSignatureFile);
bool Verify(PCCERT_CONTEXT pCertContext, std::wstring sFileXml, std::wstring sSignatureFile);
bool SignDocument(std::wstring sFolderOOXML, PCCERT_CONTEXT pCertContext);
bool SignDocument(std::wstring sFolderOOXML, PCCERT_CONTEXT pCertContext, std::wstring sign_id);
void main(void)
{
@ -655,7 +655,8 @@ void main(void)
std::string sCertHash = oSigner.GetCertificateHash();
}
SignDocument(NSFile::GetProcessDirectory() + L"/ImageStamp", pCertContext);
//SignDocument(NSFile::GetProcessDirectory() + L"/ImageStamp", pCertContext, L"{39B6B9C7-60AD-45A2-9F61-40C74A24042E}");
SignDocument(L"D:\\555", pCertContext, L"{9792D33F-AB37-4E5B-A465-481B9465818B}");
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -708,10 +709,184 @@ bool Verify(PCCERT_CONTEXT pCertContext, std::wstring sFileXml, std::wstring sSi
class COOXMLSigner
{
public:
PCCERT_CONTEXT m_context;
std::wstring m_sFolder;
PCCERT_CONTEXT m_context;
std::wstring m_sFolder;
CXmlSigner* m_signer;
CXmlSigner* m_signer;
std::wstring m_date;
std::map<std::wstring, std::wstring> m_content_types;
std::vector<std::wstring> m_rels;
std::vector<std::wstring> m_files;
NSStringUtils::CStringBuilderA m_signed_info;
std::wstring m_image_valid;
std::wstring m_image_invalid;
std::wstring m_guid;
public:
class COOXMLRelationship
{
public:
std::wstring rid;
std::wstring type;
std::wstring target;
std::wstring target_mode;
public:
COOXMLRelationship()
{
}
COOXMLRelationship(XmlUtils::CXmlNode& node)
{
rid = node.GetAttribute("Id");
type = node.GetAttribute("Type");
target = node.GetAttribute("Target");
CheckTargetMode();
}
std::wstring GetXml()
{
NSStringUtils::CStringBuilder builder;
builder.WriteString(L"<Relationship Id=\"");
builder.WriteEncodeXmlString(rid);
builder.WriteString(L"\" Type=\"");
builder.WriteEncodeXmlString(type);
builder.WriteString(L"\" Target=\"");
builder.WriteEncodeXmlString(target);
builder.WriteString(L"\" TargetMode=\"");
builder.WriteEncodeXmlString(target_mode);
builder.WriteString(L"\" />");
return builder.GetData();
}
static bool Compare(const COOXMLRelationship& i, const COOXMLRelationship& j)
{
return i.rid < j.rid;
}
protected:
void CheckTargetMode()
{
if (0 == target.find(L"http") || 0 == target.find(L"www") || 0 == target.find(L"ftp"))
target_mode = L"External";
else
target_mode = L"Internal";
}
};
class COOXMLRelationships
{
public:
std::vector<COOXMLRelationship> rels;
public:
COOXMLRelationships()
{
}
COOXMLRelationships(std::wstring& file)
{
XmlUtils::CXmlNode oNode;
if (!oNode.FromXmlFile(file))
return;
XmlUtils::CXmlNodes oNodes;
if (!oNode.GetNodes(L"Relationship", oNodes))
return;
int nCount = oNodes.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode oRel;
oNodes.GetAt(i, oRel);
rels.push_back(COOXMLRelationship(oRel));
}
}
std::wstring GetXml()
{
NSStringUtils::CStringBuilder builder;
builder.WriteString(L"<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">");
// sort by rId
std::sort(rels.begin(), rels.end(), COOXMLRelationship::Compare);
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
builder.WriteString(i->GetXml());
builder.WriteString(L"</Relationships>");
return builder.GetData();
}
std::wstring GetTransforms()
{
NSStringUtils::CStringBuilder builder;
builder.WriteString(L"<Transforms><Transform Algorithm=\"http://schemas.openxmlformats.org/package/2006/RelationshipTransform\">");
for (std::vector<COOXMLRelationship>::iterator i = rels.begin(); i != rels.end(); i++)
{
builder.WriteString(L"<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"");
builder.WriteEncodeXmlString(i->rid);
builder.WriteString(L"\" />");
}
builder.WriteString(L"</Transform><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>");
return builder.GetData();
}
void CheckOriginSigs(std::wstring& file)
{
int rId = 0;
std::vector<COOXMLRelationship>::iterator i = rels.begin();
while (i != rels.end())
{
if (0 == i->target.find(L"_xmlsignatures/"))
return;
std::wstring rid = i->rid;
rid = rid.substr(3);
int nTemp = std::stoi(rid);
if (nTemp > rId)
rId = nTemp;
i++;
}
std::string sXmlA;
NSFile::CFileBinary::ReadAllTextUtf8A(file, sXmlA);
std::string::size_type pos = sXmlA.rfind("</Relationships>");
if (pos == std::string::npos)
return;
rId++;
std::string sRet = sXmlA.substr(0, pos);
sRet += ("<Relationship Id=\"rId" + std::to_string(rId) + "\" \
Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin\" Target=\"_xmlsignatures/origin.sigs\"/>\
</Relationships>");
NSFile::CFileBinary::Remove(file);
NSFile::CFileBinary oFile;
oFile.CreateFileW(file);
oFile.WriteFile((BYTE*)sRet.c_str(), (DWORD)sRet.length());
oFile.CloseFile();
}
};
public:
COOXMLSigner(const std::wstring& sFolder, PCCERT_CONTEXT pContext)
@ -719,6 +894,11 @@ public:
m_sFolder = sFolder;
m_context = pContext;
m_signer = new CXmlSigner(pContext);
m_date = L"2017-04-21T08:30:21Z";
m_signed_info.WriteString("<CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/>");
m_signed_info.WriteString("<SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/>");
}
~COOXMLSigner()
{
@ -782,89 +962,328 @@ public:
return sReturn;
}
};
bool SignDocument(std::wstring sFolderOOXML, PCCERT_CONTEXT pCertContext)
{
std::wstring sFolder = NSFile::GetProcessDirectory();
COOXMLSigner oOOXMLSigner(sFolderOOXML, pCertContext);
std::string sSignedData;
std::wstring sXmlData;
std::wstring sDataSign = L"2017-04-21T08:30:21Z";
sSignedData += "<CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/>\
<SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\"/>";
if (true)
std::wstring GetRelsReference(const std::wstring& file)
{
// idPackageObject
std::wstring sXml = L"<Manifest>";
COOXMLRelationships oRels(m_sFolder + file);
// TODO: rels
if (true)
if (L"/_rels/.rels" == file)
{
sXml += L"<Reference URI=\"/_rels/.rels?ContentType=application/vnd.openxmlformats-package.relationships+xml\">\
<Transforms><Transform Algorithm=\"http://schemas.openxmlformats.org/package/2006/RelationshipTransform\">\
<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"rId1\"/>\
</Transform><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>\
<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>\
<DigestValue>1vWU/YTF/7t6ZjnE44gAFTbZvvA=</DigestValue>\
</Reference>";
oRels.CheckOriginSigs(m_sFolder + file);
sXml += L"<Reference URI=\"/word/_rels/document.xml.rels?ContentType=application/vnd.openxmlformats-package.relationships+xml\">\
<Transforms><Transform Algorithm=\"http://schemas.openxmlformats.org/package/2006/RelationshipTransform\">\
<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"rId3\"/>\
<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"rId2\"/>\
<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"rId1\"/>\
<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"rId6\"/>\
<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"rId5\"/>\
<mdssi:RelationshipReference xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\" SourceId=\"rId4\"/>\
</Transform><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>\
<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/>\
<DigestValue>kVYCpjZZG3SU5+sOsB1PRnQSCzk=</DigestValue>\
</Reference>";
// удалим все лишнее
std::vector<COOXMLRelationship>::iterator i = oRels.rels.begin();
while (i != oRels.rels.end())
{
if (0 == i->target.find(L"docProps/"))
i = oRels.rels.erase(i);
else if (0 == i->target.find(L"_xmlsignatures/"))
i = oRels.rels.erase(i);
else
i++;
}
}
NSStringUtils::CStringBuilder builder;
builder.WriteString(L"<Reference URI=\"");
builder.WriteString(file);
builder.WriteString(L"?ContentType=application/vnd.openxmlformats-package.relationships+xml\">");
builder.WriteString(oRels.GetTransforms());
builder.WriteString(L"<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>");
sXml += oOOXMLSigner.GetReference(L"/word/document.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml");
sXml += oOOXMLSigner.GetReference(L"/word/fontTable.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml");
sXml += oOOXMLSigner.GetReference(L"/word/media/image1.emf", L"image/x-emf");
sXml += oOOXMLSigner.GetReference(L"/word/settings.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml");
sXml += oOOXMLSigner.GetReference(L"/word/styles.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml");
sXml += oOOXMLSigner.GetReference(L"/word/theme/theme1.xml", L"application/vnd.openxmlformats-officedocument.theme+xml");
sXml += oOOXMLSigner.GetReference(L"/word/webSettings.xml", L"application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml");
std::wstring sXml = oRels.GetXml();
std::string sHash = GetHashXml(sXml);
sXml += L"</Manifest>";
std::wstring sHashW = UTF8_TO_U(sHash);
builder.WriteString(sHashW);
sXml += L"<SignatureProperties><SignatureProperty Id=\"idSignatureTime\" Target=\"#idPackageSignature\">";
sXml += (L"<mdssi:SignatureTime xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\">\
<mdssi:Format>YYYY-MM-DDThh:mm:ssTZD</mdssi:Format>\
<mdssi:Value>" + sDataSign + L"</mdssi:Value>\
</mdssi:SignatureTime></SignatureProperty></SignatureProperties>");
builder.WriteString(L"</DigestValue></Reference>");
sXmlData += (L"<Object Id=\"idPackageObject\">" + sXml + L"</Object>");
sSignedData += ("<Reference Type=\"http://www.w3.org/2000/09/xmldsig#Object\" URI=\"#idPackageObject\">" +
oOOXMLSigner.GetReferenceMain(sXml, L"idPackageObject", false) + "</Reference>");
return builder.GetData();
}
std::wstring sImageValid = oOOXMLSigner.GetImageBase64(sFolder + L"/../../../resources/valid.png");
std::wstring sImageInValid = oOOXMLSigner.GetImageBase64(sFolder + L"/../../../resources/invalid.png");
if (true)
int GetCountSigns(const std::wstring& file)
{
// idOfficeObject
std::wstring sXml = L"<SignatureProperties>\
<SignatureProperty Id=\"idOfficeV1Details\" Target=\"#idPackageSignature\">\
<SignatureInfoV1 xmlns=\"http://schemas.microsoft.com/office/2006/digsig\">\
<SetupID>{39B6B9C7-60AD-45A2-9F61-40C74A24042E}</SetupID>\
<SignatureText></SignatureText>\
<SignatureImage>" + sImageValid + L"</SignatureImage>\
<SignatureComments/>\
if (!NSFile::CFileBinary::Exists(file))
{
std::wstring sRels = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\
<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature\" Target=\"sig1.xml\"/>\
</Relationships>";
NSFile::CFileBinary::SaveToFile(file, sRels, false);
return 1;
}
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile(file);
XmlUtils::CXmlNodes oNodes;
oNode.GetNodes(L"Relationship", oNodes);
int rId = oNodes.GetCount() + 1;
std::string sXmlA;
NSFile::CFileBinary::ReadAllTextUtf8A(file, sXmlA);
std::string::size_type pos = sXmlA.rfind("</Relationships>");
if (pos == std::string::npos)
return 1;
std::string sRet = sXmlA.substr(0, pos);
sRet += ("<Relationship Id=\"rId" + std::to_string(rId) + "\" \
Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature\" Target=\"sig" + std::to_string(rId) + ".xml\"/>\
</Relationships>");
NSFile::CFileBinary::Remove(file);
NSFile::CFileBinary oFile;
oFile.CreateFileW(file);
oFile.WriteFile((BYTE*)sRet.c_str(), (DWORD)sRet.length());
oFile.CloseFile();
return rId;
}
void ParseContentTypes()
{
std::wstring file = m_sFolder + L"/[Content_Types].xml";
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile(file);
XmlUtils::CXmlNodes nodesDefaults;
oNode.GetNodes(L"Default", nodesDefaults);
XmlUtils::CXmlNodes nodesOverrides;
oNode.GetNodes(L"Override", nodesOverrides);
int nCount = nodesDefaults.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode node;
nodesDefaults.GetAt(i, node);
m_content_types.insert(std::pair<std::wstring, std::wstring>(node.GetAttribute("Extension"), node.GetAttribute("ContentType")));
}
nCount = nodesOverrides.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode node;
nodesOverrides.GetAt(i, node);
m_content_types.insert(std::pair<std::wstring, std::wstring>(node.GetAttribute("PartName"), node.GetAttribute("ContentType")));
}
}
void Parse()
{
// 1) Parse Content_Types.xml
ParseContentTypes();
// 2) Parse files in directory
std::vector<std::wstring> files = NSDirectory::GetFiles(m_sFolder, true);
// 3) Check each file
std::wstring sFolder = m_sFolder;
NSStringUtils::string_replace(sFolder, L"\\", L"/");
for (std::vector<std::wstring>::iterator i = files.begin(); i != files.end(); i++)
{
std::wstring sCheckFile = *i;
NSStringUtils::string_replace(sCheckFile, L"\\", L"/");
if (0 != sCheckFile.find(sFolder))
continue;
// make cool filename
sCheckFile = sCheckFile.substr(sFolder.length());
// check needed file
if (0 == sCheckFile.find(L"/_xmlsignatures") ||
0 == sCheckFile.find(L"/docProps") ||
0 == sCheckFile.find(L"/[Content_Types].xml"))
continue;
// check rels and add to needed array
std::wstring::size_type posExt = sCheckFile.rfind(L".");
if (std::wstring::npos == posExt)
continue;
std::wstring sExt = sCheckFile.substr(posExt + 1);
if (sExt == L"rels")
m_rels.push_back(sCheckFile);
else
m_files.push_back(sCheckFile);
}
std::sort(m_rels.begin(), m_rels.end());
std::sort(m_files.begin(), m_files.end());
}
void WriteRelsReferences(NSStringUtils::CStringBuilder& builder)
{
for (std::vector<std::wstring>::iterator i = m_rels.begin(); i != m_rels.end(); i++)
{
builder.WriteString(GetRelsReference(*i));
}
}
void WriteFilesReferences(NSStringUtils::CStringBuilder& builder)
{
for (std::vector<std::wstring>::iterator i = m_files.begin(); i != m_files.end(); i++)
{
std::wstring sFile = *i;
std::wstring sContentType = L"application/xml";
std::map<std::wstring, std::wstring>::iterator _find = m_content_types.find(sFile);
if (_find != m_content_types.end())
{
sContentType = _find->second;
}
else
{
std::wstring::size_type posExt = sFile.rfind(L".");
if (std::wstring::npos != posExt)
{
std::wstring sExt = sFile.substr(posExt + 1);
_find = m_content_types.find(sExt);
if (_find != m_content_types.end())
sContentType = _find->second;
}
}
builder.WriteString(GetReference(sFile, sContentType));
}
}
void WriteManifest(NSStringUtils::CStringBuilder& builder)
{
builder.WriteString(L"<Manifest>");
WriteRelsReferences(builder);
WriteFilesReferences(builder);
builder.WriteString(L"</Manifest>");
}
void CorrectContentTypes(int nCountSigsNeeds)
{
std::wstring file = m_sFolder + L"/[Content_Types].xml";
XmlUtils::CXmlNode oNode;
oNode.FromXmlFile(file);
XmlUtils::CXmlNodes nodesDefaults;
oNode.GetNodes(L"Default", nodesDefaults);
XmlUtils::CXmlNodes nodesOverrides;
oNode.GetNodes(L"Override", nodesOverrides);
std::string sAddition = "";
bool bIsSigsExist = false;
int nCount = nodesDefaults.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode node;
nodesDefaults.GetAt(i, node);
if ("sigs" == node.GetAttributeA("Extension") &&
"application/vnd.openxmlformats-package.digital-signature-origin" == node.GetAttributeA("ContentType"))
{
bIsSigsExist = true;
break;
}
}
if (!bIsSigsExist)
sAddition += "<Default Extension=\"sigs\" ContentType=\"application/vnd.openxmlformats-package.digital-signature-origin\"/>";
int nCountSigs = 0;
nCount = nodesOverrides.GetCount();
for (int i = 0; i < nCount; ++i)
{
XmlUtils::CXmlNode node;
nodesOverrides.GetAt(i, node);
if ("application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml" == node.GetAttributeA("ContentType"))
{
++nCountSigs;
}
}
for (int i = nCountSigs; i < nCountSigsNeeds; ++i)
{
sAddition += "<Override PartName=\"/_xmlsignatures/sig";
sAddition += std::to_string(i + 1);
sAddition += ".xml\" ContentType=\"application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml\"/>";
}
std::string sXmlA;
NSFile::CFileBinary::ReadAllTextUtf8A(file, sXmlA);
std::string::size_type pos = sXmlA.rfind("</Types>");
if (pos == std::string::npos)
return;
std::string sRet = sXmlA.substr(0, pos);
sRet += sAddition;
sRet += "</Types>";
NSFile::CFileBinary::Remove(file);
NSFile::CFileBinary oFile;
oFile.CreateFileW(file);
oFile.WriteFile((BYTE*)sRet.c_str(), (DWORD)sRet.length());
oFile.CloseFile();
}
void SetGuid(const std::wstring& guid)
{
m_guid = guid;
}
void SetImageValid(const std::wstring& file)
{
m_image_valid = GetImageBase64(file);
}
void SetImageInvalid(const std::wstring& file)
{
m_image_invalid = GetImageBase64(file);
}
std::wstring GeneratePackageObject()
{
NSStringUtils::CStringBuilder builder;
WriteManifest(builder);
builder.WriteString(L"<SignatureProperties><SignatureProperty Id=\"idSignatureTime\" Target=\"#idPackageSignature\">");
builder.WriteString(L"<mdssi:SignatureTime xmlns:mdssi=\"http://schemas.openxmlformats.org/package/2006/digital-signature\">");
builder.WriteString(L"<mdssi:Format>YYYY-MM-DDThh:mm:ssTZD</mdssi:Format>");
builder.WriteString(L"<mdssi:Value>");
builder.WriteString(m_date);
builder.WriteString(L"</mdssi:Value>");
builder.WriteString(L"</mdssi:SignatureTime></SignatureProperty></SignatureProperties>");
std::wstring sXml = builder.GetData();
m_signed_info.WriteString("<Reference Type=\"http://www.w3.org/2000/09/xmldsig#Object\" URI=\"#idPackageObject\">");
m_signed_info.WriteString(GetReferenceMain(sXml, L"idPackageObject", false));
m_signed_info.WriteString("</Reference>");
return (L"<Object Id=\"idPackageObject\">" + sXml + L"</Object>");
}
std::wstring GenerateOfficeObject()
{
NSStringUtils::CStringBuilder builder;
builder.WriteString(L"<SignatureProperties><SignatureProperty Id=\"idOfficeV1Details\" Target=\"#idPackageSignature\">");
builder.WriteString(L"<SignatureInfoV1 xmlns=\"http://schemas.microsoft.com/office/2006/digsig\">");
builder.WriteString(L"<SetupID>");
builder.WriteString(m_guid);
builder.WriteString(L"</SetupID>");
builder.WriteString(L"<SignatureText></SignatureText>");
builder.WriteString(L"<SignatureImage>");
builder.WriteString(m_image_valid);
builder.WriteString(L"</SignatureImage>");
builder.WriteString(L"<SignatureComments/>\
<WindowsVersion>10.0</WindowsVersion>\
<OfficeVersion>16.0</OfficeVersion>\
<ApplicationVersion>16.0</ApplicationVersion>\
@ -878,33 +1297,50 @@ bool SignDocument(std::wstring sFolderOOXML, PCCERT_CONTEXT pCertContext)
<SignatureType>2</SignatureType>\
</SignatureInfoV1>\
</SignatureProperty>\
</SignatureProperties>";
</SignatureProperties>");
sXmlData += (L"<Object Id=\"idOfficeObject\">" + sXml + L"</Object>");
m_signed_info.WriteString("<Reference Type=\"http://www.w3.org/2000/09/xmldsig#Object\" URI=\"#idOfficeObject\">");
m_signed_info.WriteString(GetReferenceMain(builder.GetData(), L"idOfficeObject", false));
m_signed_info.WriteString("</Reference>");
sSignedData += ("<Reference Type=\"http://www.w3.org/2000/09/xmldsig#Object\" URI=\"#idOfficeObject\">" +
oOOXMLSigner.GetReferenceMain(sXml, L"idOfficeObject", false) + "</Reference>");
return (L"<Object Id=\"idOfficeObject\">" + builder.GetData() + L"</Object>");
}
if (true)
std::wstring GenerateImageObject()
{
DWORD dwNameLen = CertGetNameStringW(pCertContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, CERT_NAME_ISSUER_FLAG, NULL, NULL, 0);
if (m_image_valid.empty())
return L"";
m_signed_info.WriteString("<Reference Type=\"http://www.w3.org/2000/09/xmldsig#Object\" URI=\"#idValidSigLnImg\">");
m_signed_info.WriteString(GetReferenceMain(m_image_valid, L"idValidSigLnImg", false));
m_signed_info.WriteString("</Reference>");
m_signed_info.WriteString("<Reference Type=\"http://www.w3.org/2000/09/xmldsig#Object\" URI=\"#idInvalidSigLnImg\">");
m_signed_info.WriteString(GetReferenceMain(m_image_invalid, L"idInvalidSigLnImg", false));
m_signed_info.WriteString("</Reference>");
return (L"<Object Id=\"idValidSigLnImg\">" + m_image_valid + L"</Object><Object Id=\"idInvalidSigLnImg\">" + m_image_invalid + L"</Object>");
}
std::wstring GenerateSignPropertiesObject()
{
DWORD dwNameLen = CertGetNameStringW(m_context, CERT_NAME_SIMPLE_DISPLAY_TYPE, CERT_NAME_ISSUER_FLAG, NULL, NULL, 0);
wchar_t* pNameData = new wchar_t[dwNameLen];
CertGetNameStringW(pCertContext, CERT_NAME_SIMPLE_DISPLAY_TYPE, CERT_NAME_ISSUER_FLAG, NULL, pNameData, dwNameLen);
CertGetNameStringW(m_context, CERT_NAME_SIMPLE_DISPLAY_TYPE, CERT_NAME_ISSUER_FLAG, NULL, pNameData, dwNameLen);
std::wstring sName(pNameData);
RELEASEARRAYOBJECTS(pNameData);
int nNumberLen = (int)pCertContext->pCertInfo->SerialNumber.cbData;
int nNumberLen = (int)m_context->pCertInfo->SerialNumber.cbData;
BYTE* pNumberData = new BYTE[nNumberLen];
CXmlSigner::ConvertEndian(pCertContext->pCertInfo->SerialNumber.pbData, pNumberData, (DWORD)nNumberLen);
CXmlSigner::ConvertEndian(m_context->pCertInfo->SerialNumber.pbData, pNumberData, (DWORD)nNumberLen);
CBigInteger oInteger(pNumberData, nNumberLen);
delete[] pNumberData;
std::string sKeyA = oInteger.ToString();
std::wstring sKey = NSFile::CUtf8Converter::GetUnicodeStringFromUTF8((BYTE*)sKeyA.c_str(), (LONG)sKeyA.length());
std::wstring sKey = UTF8_TO_U(sKeyA);
std::wstring sXml = (L"<xd:SignedSignatureProperties>\
<xd:SigningTime>" + sDataSign + L"</xd:SigningTime>\
<xd:SigningTime>" + m_date + L"</xd:SigningTime>\
<xd:SigningCertificate>\
<xd:Cert>\
<xd:CertDigest>\
@ -926,72 +1362,88 @@ bool SignDocument(std::wstring sFolderOOXML, PCCERT_CONTEXT pCertContext)
sSignedXml += sXml;
sSignedXml += L"</xd:SignedProperties>";
sXmlData += L"<Object><xd:QualifyingProperties xmlns:xd=\"http://uri.etsi.org/01903/v1.3.2#\" Target=\"#idPackageSignature\">\
<xd:SignedProperties Id=\"idSignedProperties\">";
sXmlData += sXml;
sXmlData += L"</xd:SignedProperties></xd:QualifyingProperties></Object>";
sSignedData += "<Reference Type=\"http://uri.etsi.org/01903#SignedProperties\" URI=\"#idSignedProperties\">\
<Transforms><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>\
<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>";
std::string sXmlTmp = CXmlCanonicalizator::Execute(U_TO_UTF8(sSignedXml), XML_C14N_1_0);
sSignedData += oOOXMLSigner.m_signer->GetHash(sXmlTmp);
sSignedData += "</DigestValue></Reference>";
m_signed_info.WriteString("<Reference Type=\"http://uri.etsi.org/01903#SignedProperties\" URI=\"#idSignedProperties\">");
m_signed_info.WriteString("<Transforms><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\"/></Transforms>");
m_signed_info.WriteString("<DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\"/><DigestValue>");
m_signed_info.WriteString(m_signer->GetHash(sXmlTmp));
m_signed_info.WriteString("</DigestValue></Reference>");
return (L"<Object><xd:QualifyingProperties xmlns:xd=\"http://uri.etsi.org/01903/v1.3.2#\" Target=\"#idPackageSignature\">\
<xd:SignedProperties Id=\"idSignedProperties\">" + sXml + L"</xd:SignedProperties></xd:QualifyingProperties></Object>");
}
if (true)
int AddSignatureReference()
{
std::wstring sXml = sImageValid;
std::wstring sDirectory = m_sFolder + L"/_xmlsignatures";
sXmlData += (L"<Object Id=\"idValidSigLnImg\">" + sXml + L"</Object>");
if (!NSDirectory::Exists(sDirectory))
NSDirectory::CreateDirectory(sDirectory);
sSignedData += ("<Reference Type=\"http://www.w3.org/2000/09/xmldsig#Object\" URI=\"#idValidSigLnImg\">" +
oOOXMLSigner.GetReferenceMain(sXml, L"idValidSigLnImg", false) + "</Reference>");
if (!NSFile::CFileBinary::Exists(sDirectory + L"/origin.sigs"))
{
NSFile::CFileBinary oFile;
oFile.CreateFileW(sDirectory + L"/origin.sigs");
oFile.CloseFile();
}
if (!NSDirectory::Exists(sDirectory + L"/_rels"))
NSDirectory::CreateDirectory(sDirectory + L"/_rels");
int nSignNum = GetCountSigns(sDirectory + L"/_rels/origin.sigs.rels");
CorrectContentTypes(nSignNum);
return nSignNum;
}
if (true)
void Sign()
{
std::wstring sXml = sImageInValid;
Parse();
sXmlData += (L"<Object Id=\"idInvalidSigLnImg\">" + sXml + L"</Object>");
std::string sSignedData;
sSignedData += ("<Reference Type=\"http://www.w3.org/2000/09/xmldsig#Object\" URI=\"#idInvalidSigLnImg\">" +
oOOXMLSigner.GetReferenceMain(sXml, L"idInvalidSigLnImg", false) + "</Reference>");
NSStringUtils::CStringBuilder builderMain;
builderMain.WriteString(GeneratePackageObject());
builderMain.WriteString(GenerateOfficeObject());
builderMain.WriteString(GenerateSignPropertiesObject());
builderMain.WriteString(GenerateImageObject());
std::string sSignedInfoData = m_signed_info.GetData();
std::string sSignedXml = "<SignedInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">" + sSignedInfoData + "</SignedInfo>";
sSignedXml = CXmlCanonicalizator::Execute(sSignedXml, XML_C14N_1_0);
sSignedXml = m_signer->Sign(sSignedXml);
NSStringUtils::CStringBuilder builderResult;
builderResult.WriteString(L"<?xml version=\"1.0\" encoding=\"UTF-8\"?><Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\" Id=\"idPackageSignature\"><SignedInfo>");
builderResult.WriteString(UTF8_TO_U(sSignedInfoData));
builderResult.WriteString(L"</SignedInfo>");
builderResult.WriteString(L"<SignatureValue>");
builderResult.WriteString(UTF8_TO_U(sSignedXml));
builderResult.WriteString(L"</SignatureValue>");
builderResult.WriteString(L"<KeyInfo><X509Data><X509Certificate>");
builderResult.WriteString(UTF8_TO_U(m_signer->GetCertificateBase64()));
builderResult.WriteString(L"</X509Certificate></X509Data></KeyInfo>");
builderResult.Write(builderMain);
builderResult.WriteString(L"</Signature>");
int nSignNum = AddSignatureReference();
NSFile::CFileBinary::SaveToFile(m_sFolder + L"/_xmlsignatures/sig" + std::to_wstring(nSignNum) + L".xml", builderResult.GetData(), false);
}
};
std::string sXmlPrepend = ("<?xml version=\"1.0\" encoding=\"UTF-8\"?><Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\" Id=\"idPackageSignature\"><SignedInfo>");
sXmlPrepend += sSignedData;
sXmlPrepend += "</SignedInfo>";
bool SignDocument(std::wstring sFolderOOXML, PCCERT_CONTEXT pCertContext, std::wstring sign_id)
{
COOXMLSigner oOOXMLSigner(sFolderOOXML, pCertContext);
sXmlPrepend += "<SignatureValue>";
std::string sSignedInfo = "<SignedInfo xmlns=\"http://www.w3.org/2000/09/xmldsig#\">" + sSignedData + "</SignedInfo>";
sSignedInfo = CXmlCanonicalizator::Execute(sSignedInfo, XML_C14N_1_0);
sXmlPrepend += oOOXMLSigner.m_signer->Sign(sSignedInfo);
sXmlPrepend += "</SignatureValue>";
sXmlPrepend += ("<KeyInfo><X509Data><X509Certificate>" + oOOXMLSigner.m_signer->GetCertificateBase64() + "</X509Certificate></X509Data></KeyInfo>");
sXmlData = (UTF8_TO_U(sXmlPrepend) + sXmlData);
sXmlData += L"</Signature>";
std::wstring sDirectory = sFolderOOXML + L"/_xmlsignatures";
NSDirectory::CreateDirectory(sDirectory);
NSFile::CFileBinary oFile;
oFile.CreateFileW(sDirectory + L"/origin.sigs");
oFile.CloseFile();
NSFile::CFileBinary::SaveToFile(sDirectory + L"/sig1.xml", sXmlData, false);
NSDirectory::CreateDirectory(sDirectory + L"/_rels");
std::wstring sRels = L"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\
<Relationships xmlns=\"http://schemas.openxmlformats.org/package/2006/relationships\">\
<Relationship Id=\"rId1\" Type=\"http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature\" Target=\"sig1.xml\"/>\
</Relationships>";
NSFile::CFileBinary::SaveToFile(sDirectory + L"/_rels/origin.sigs.rels", sRels, false);
oOOXMLSigner.SetGuid(sign_id);
oOOXMLSigner.SetImageValid(NSFile::GetProcessDirectory() + L"/../../../resources/valid.png");
oOOXMLSigner.SetImageInvalid(NSFile::GetProcessDirectory() + L"/../../../resources/invalid.png");
oOOXMLSigner.Sign();
return true;
}

View File

@ -169,9 +169,7 @@ namespace codegen
{
sb.AppendFormat("{0}.prototype.toXml = function(writer, name) {{\r\n", oGenClass.sName);
}
sb.AppendFormat("var res = \"\";\r\n");
ProcessToXml(sb, oGenClass);
sb.AppendFormat("return res;\r\n");
sb.AppendFormat("}};\r\n");
}
}
@ -708,7 +706,7 @@ namespace codegen
else
{
if (!bIsAttribute)
sb.AppendFormat("res += {0}.toXml(writer, \"{1}\");\r\n", sElemName, sElemXmlName);
sb.AppendFormat("{0}.toXml(writer, \"{1}\");\r\n", sElemName, sElemXmlName);
}
}
}

View File

@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.4.453.0
VERSION = 2.4.455.0
DEFINES += INTVER=$$VERSION
TARGET = x2t

View File

@ -2799,7 +2799,14 @@ namespace NExtractTools
//clean up v8
NSDoctRenderer::CDocBuilder::Dispose();
return result;
if (SUCCEEDED_X2T(result) && oInputParams.m_bOutputConvertCorrupted)
{
return AVS_FILEUTILS_ERROR_CONVERT_CORRUPTED;
}
else
{
return result;
}
}
int FromFile(const std::wstring& file)

File diff suppressed because it is too large Load Diff