mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-11 02:16:02 +08:00
Compare commits
11 Commits
core-windo
...
core/devel
| Author | SHA1 | Date | |
|---|---|---|---|
| bf33aed853 | |||
| 5869c7a02e | |||
| bbd429a994 | |||
| f4d636539e | |||
| 92e02257d7 | |||
| d2046d7ccb | |||
| 7bc35a157a | |||
| 903245e8a7 | |||
| 25ee9c3c1c | |||
| 9ead40d279 | |||
| e097379c21 |
@ -378,6 +378,7 @@
|
||||
MAC,
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
@ -414,6 +415,7 @@
|
||||
MAC,
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
|
||||
@ -55,7 +55,7 @@ int _tmain(int argc, _TCHAR* argv[])
|
||||
HRESULT hr = S_OK;
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
std::wstring srcFileName = argv[1];
|
||||
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.pptx"; //xlsx pptx
|
||||
std::wstring dstPath = argc > 2 ? argv[2] : srcFileName + L"-my.docx"; //xlsx pptx
|
||||
|
||||
std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
|
||||
|
||||
|
||||
@ -531,8 +531,8 @@ mso-position-vertical-relative:text;";
|
||||
strStyle += L"height:" + boost::lexical_cast<std::wstring>(val.cy / 12700.) + L"pt;";
|
||||
strStyle += L"z-index:" + boost::lexical_cast<std::wstring>(0xF000800 - val.id);
|
||||
|
||||
CP_XML_ATTR(L"id", L"Rect" + boost::lexical_cast<std::wstring>(val.id));
|
||||
CP_XML_ATTR(L"o:spid", L"_x0000_s" + boost::lexical_cast<std::wstring>(1024 + val.id));
|
||||
CP_XML_ATTR(L"id", L"Rect" + std::to_wstring(val.id));
|
||||
CP_XML_ATTR(L"o:spid", L"_x0000_s" + std::to_wstring(1024 + val.id));
|
||||
CP_XML_ATTR(L"style", strStyle);
|
||||
CP_XML_ATTR(L"fillcolor", L"#4f81bd [3204]");
|
||||
CP_XML_ATTR(L"strokecolor", L"#243f60 [1604]");
|
||||
|
||||
@ -66,7 +66,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double)
|
||||
{
|
||||
CP_XML_NODE(L"a:srgbClr")
|
||||
{
|
||||
CP_XML_ATTR(L"val",color);
|
||||
CP_XML_ATTR(L"val", color);
|
||||
if (opacity)
|
||||
{
|
||||
CP_XML_NODE(L"a:alpha")
|
||||
@ -101,11 +101,56 @@ void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
CP_XML_NODE(L"a:solidFill")
|
||||
{
|
||||
oox_serialize_srgb(CP_XML_STREAM(),val.solid->color,val.opacity);
|
||||
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void vml_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.solid)return;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"v:fill")
|
||||
{
|
||||
oox_serialize_srgb(CP_XML_STREAM(), val.solid->color, val.opacity);
|
||||
CP_XML_ATTR(L"v:fill", val.solid->color);
|
||||
if (val.opacity)
|
||||
{
|
||||
CP_XML_ATTR(L"v:opacity", *val.opacity);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
void vml_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.bitmap) return;
|
||||
if (!val.bitmap->isInternal) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"v:fill")
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", val.bitmap->rId );
|
||||
|
||||
if (val.opacity)
|
||||
{
|
||||
CP_XML_ATTR(L"opacity",(int)(*val.opacity));
|
||||
}
|
||||
|
||||
if (val.bitmap->bTile)
|
||||
{
|
||||
CP_XML_ATTR(L"type", L"pattern");
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_ATTR(L"type", L"frame");
|
||||
}
|
||||
CP_XML_ATTR(L"recolor", L"t");
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.bitmap) return;
|
||||
@ -164,20 +209,69 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
CP_XML_NODE(L"a:fillRect");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
void vml_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.gradient) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"v:fill")
|
||||
{
|
||||
if (!val.gradient->colors.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"color2", val.gradient->colors[val.gradient->colors.size() - 1].color_ref);
|
||||
|
||||
std::wstring colors_value;
|
||||
for (size_t i = 0; i < val.gradient->colors.size(); i++)
|
||||
{
|
||||
colors_value += std::to_wstring(val.gradient->colors[i].pos) + L"% #" +
|
||||
val.gradient->colors[i].color_ref + L",";
|
||||
}
|
||||
|
||||
if (!colors_value.empty())
|
||||
{
|
||||
CP_XML_ATTR(L"colors", colors_value.substr(0, colors_value.length() - 1));
|
||||
}
|
||||
}
|
||||
double angle =/*360 - */val.gradient->angle/* * 180./3.14159265358979323846*/;
|
||||
|
||||
CP_XML_ATTR(L"focus", L"100%");
|
||||
switch(val.gradient->style)
|
||||
{
|
||||
case 0:
|
||||
CP_XML_ATTR(L"type", L"gradient");
|
||||
CP_XML_ATTR(L"method", L"linear");
|
||||
CP_XML_ATTR(L"angle", angle);
|
||||
break;
|
||||
case 1:
|
||||
//CP_XML_ATTR(L"type", L"gradientRadial");
|
||||
//break;
|
||||
case 2:
|
||||
//CP_XML_ATTR(L"type", L"gradientCenter");
|
||||
//break;
|
||||
case 3:
|
||||
//CP_XML_ATTR(L"type", L"gradientUnscaled");
|
||||
//break;
|
||||
CP_XML_ATTR(L"type", L"gradientRadial");
|
||||
}
|
||||
if (val.gradient->style > 0)
|
||||
{
|
||||
double focus_x = ((val.gradient->rect[2] - val.gradient->rect[0]) /2. + val.gradient->rect[0]) / 100.;
|
||||
double focus_y = ((val.gradient->rect[3] - val.gradient->rect[1]) /2. + val.gradient->rect[1]) / 100.;
|
||||
|
||||
CP_XML_ATTR(L"focusposition", XmlUtils::DoubleToString(focus_x, L"%.2f") + L"," + XmlUtils::DoubleToString(focus_y, L"%.2f"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.gradient)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!val.gradient) return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
@ -233,6 +327,7 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
|
||||
void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
if (!val.hatch)return;
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"a:pattFill")
|
||||
@ -253,7 +348,38 @@ void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
|
||||
}
|
||||
}
|
||||
}
|
||||
void oox_serialize_fill(std::wostream & strm, const _oox_fill & val)
|
||||
|
||||
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring & color, int id)
|
||||
{
|
||||
if (val.type == 0) return;
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"v:background")
|
||||
{
|
||||
CP_XML_ATTR(L"id", L"_x0000_s" + std::to_wstring(1024 + id));
|
||||
CP_XML_ATTR(L"o:bwmode", L"white");
|
||||
CP_XML_ATTR(L"fillcolor", L"#" + color);
|
||||
CP_XML_ATTR(L"o:targetscreensize", L"1024,768");
|
||||
switch (val.type)
|
||||
{
|
||||
case 1:
|
||||
vml_serialize_solid_fill(CP_XML_STREAM(), val);
|
||||
break;
|
||||
case 2:
|
||||
vml_serialize_bitmap_fill(CP_XML_STREAM(), val);
|
||||
break;
|
||||
case 3:
|
||||
vml_serialize_gradient_fill(CP_XML_STREAM(), val);
|
||||
break;
|
||||
case 4:
|
||||
//vml_serialize_hatch_fill(CP_XML_STREAM(), val);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val)
|
||||
{
|
||||
switch (val.type)
|
||||
{
|
||||
|
||||
@ -143,9 +143,10 @@ namespace oox {
|
||||
}
|
||||
};
|
||||
|
||||
void oox_serialize_fill(std::wostream & strm, const _oox_fill & val);
|
||||
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
|
||||
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
|
||||
void vml_serialize_background (std::wostream & strm, const _oox_fill & val, const std::wstring & color, int id);
|
||||
void oox_serialize_fill (std::wostream & strm, const _oox_fill & val);
|
||||
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(double) opacity);
|
||||
void oox_serialize_srgb (std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,11 +109,11 @@ void common_draw_fill_attlist::add_attributes( const xml::attributes_wc_ptr & At
|
||||
}
|
||||
void common_draw_fill_attlist::serialize(CP_ATTR_NODE)
|
||||
{
|
||||
CP_XML_ATTR_OPT(L"draw:fill-color", draw_fill_color_);
|
||||
CP_XML_ATTR_OPT(L"draw:fill", draw_fill_);
|
||||
CP_XML_ATTR_OPT(L"draw:fill-color", draw_fill_color_);
|
||||
CP_XML_ATTR_OPT(L"draw:fill", draw_fill_);
|
||||
|
||||
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
|
||||
CP_XML_ATTR_OPT(L"draw:image-opacity", draw_image_opacity_);
|
||||
CP_XML_ATTR_OPT(L"draw:opacity", draw_opacity_);
|
||||
CP_XML_ATTR_OPT(L"draw:image-opacity", draw_image_opacity_);
|
||||
|
||||
CP_XML_ATTR_OPT(L"draw:fill-image-name", draw_fill_image_name_);
|
||||
CP_XML_ATTR_OPT(L"draw:fill-gradient-name", draw_fill_gradient_name_);
|
||||
|
||||
@ -216,10 +216,10 @@ int Compute_BorderWidth(const graphic_format_properties & graphicProperties, Bor
|
||||
|
||||
switch(borderSide)
|
||||
{
|
||||
case sideTop: borderValue = graphicProperties.common_border_attlist_.fo_border_top_; break;
|
||||
case sideBottom: borderValue = graphicProperties.common_border_attlist_.fo_border_bottom_; break;
|
||||
case sideLeft: borderValue = graphicProperties.common_border_attlist_.fo_border_left_; break;
|
||||
case sideRight: borderValue = graphicProperties.common_border_attlist_.fo_border_right_; break;
|
||||
case sideTop: borderValue = graphicProperties.common_border_attlist_.fo_border_top_; break;
|
||||
case sideBottom: borderValue = graphicProperties.common_border_attlist_.fo_border_bottom_; break;
|
||||
case sideLeft: borderValue = graphicProperties.common_border_attlist_.fo_border_left_; break;
|
||||
case sideRight: borderValue = graphicProperties.common_border_attlist_.fo_border_right_; break;
|
||||
}
|
||||
|
||||
if (!borderValue)
|
||||
@ -281,14 +281,14 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
fill->style = 0;
|
||||
|
||||
point.pos = 0;
|
||||
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
point.pos = 100;
|
||||
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
}break;
|
||||
@ -297,20 +297,20 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
fill->style = 0;
|
||||
|
||||
point.pos = 0;
|
||||
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
point.pos = 50;
|
||||
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
point.pos = 100;
|
||||
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
}break;
|
||||
@ -319,41 +319,35 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
|
||||
case gradient_style::square:
|
||||
case gradient_style::rectangular:
|
||||
{
|
||||
if (style == gradient_style::radial || style == gradient_style::ellipsoid) fill->style = 2;
|
||||
if (style == gradient_style::radial ||
|
||||
style == gradient_style::ellipsoid) fill->style = 2;
|
||||
if (style == gradient_style::square ) fill->style = 1;
|
||||
if (style == gradient_style::rectangular) fill->style = 3;
|
||||
|
||||
point.pos = 0;
|
||||
if (image_style->draw_end_color_)point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
point.pos = 100;
|
||||
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
if (image_style->draw_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
|
||||
if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
if (image_style->draw_cx_)//хохма - у мс в конвертилке из open-office перепутаны l & r !!!
|
||||
point.pos = 100;
|
||||
if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
|
||||
if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
|
||||
|
||||
fill->colors.push_back(point);
|
||||
|
||||
fill->rect[0] = fill->rect[1] = 0;
|
||||
fill->rect[2] = fill->rect[3] = 100;
|
||||
|
||||
if (image_style->draw_cx_)
|
||||
{
|
||||
fill->rect[0]=image_style->draw_cx_->get_value();
|
||||
fill->rect[2]=100-image_style->draw_cx_->get_value();
|
||||
}
|
||||
else
|
||||
{
|
||||
fill->rect[0]=0;
|
||||
fill->rect[2]=100;
|
||||
fill->rect[0] = 100 - image_style->draw_cx_->get_value();
|
||||
fill->rect[2] = image_style->draw_cx_->get_value();
|
||||
}
|
||||
if (image_style->draw_cy_)
|
||||
{
|
||||
fill->rect[1]=image_style->draw_cy_->get_value();
|
||||
fill->rect[3]=100-image_style->draw_cy_->get_value();
|
||||
}
|
||||
else
|
||||
{
|
||||
fill->rect[1]=0;
|
||||
fill->rect[3]=100;
|
||||
fill->rect[1] = 100 - image_style->draw_cy_->get_value();
|
||||
fill->rect[3] = image_style->draw_cy_->get_value();
|
||||
}
|
||||
}break;
|
||||
}
|
||||
@ -427,8 +421,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
|
||||
{
|
||||
switch(image->style_repeat_->get_type())
|
||||
{
|
||||
case style_repeat::Repeat : fill.bitmap->bTile = true; break;
|
||||
case style_repeat::Stretch : fill.bitmap->bStretch = true; break;
|
||||
case style_repeat::Repeat :
|
||||
fill.bitmap->bTile = true;
|
||||
fill.bitmap->bStretch = false;
|
||||
break;
|
||||
case style_repeat::Stretch :
|
||||
fill.bitmap->bStretch = true;
|
||||
fill.bitmap->bTile = false; //?? для background точно выключать
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (image->draw_opacity_)
|
||||
@ -445,8 +445,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
|
||||
{
|
||||
switch(props.style_repeat_->get_type())
|
||||
{
|
||||
case style_repeat::Repeat : fill.bitmap->bTile = true; break;
|
||||
case style_repeat::Stretch : fill.bitmap->bStretch = true; break;
|
||||
case style_repeat::Repeat :
|
||||
fill.bitmap->bTile = true;
|
||||
fill.bitmap->bStretch = false;
|
||||
break;
|
||||
case style_repeat::Stretch :
|
||||
fill.bitmap->bStretch = true;
|
||||
fill.bitmap->bTile = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@ -893,17 +893,17 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
|
||||
|
||||
Compute_GraphicFill(graphicProperties.common_draw_fill_attlist_, graphicProperties.style_background_image_, Context.root()->odf_context().drawStyles() ,drawing->fill, bTxbx);
|
||||
|
||||
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.length() < 1))
|
||||
if ((drawing->fill.bitmap) && (drawing->fill.bitmap->rId.empty()))
|
||||
{
|
||||
std::wstring href = drawing->fill.bitmap->xlink_href_;
|
||||
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
drawing->additional.push_back(odf_reader::_property(L"border_width_left", Compute_BorderWidth(graphicProperties, sideLeft)));
|
||||
drawing->additional.push_back(odf_reader::_property(L"border_width_left", Compute_BorderWidth(graphicProperties, sideLeft)));
|
||||
drawing->additional.push_back(odf_reader::_property(L"border_width_top", Compute_BorderWidth(graphicProperties, sideTop)));
|
||||
drawing->additional.push_back(odf_reader::_property(L"border_width_right", Compute_BorderWidth(graphicProperties, sideRight)));
|
||||
drawing->additional.push_back(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(graphicProperties, sideBottom)));
|
||||
drawing->additional.push_back(odf_reader::_property(L"border_width_right", Compute_BorderWidth(graphicProperties, sideRight)));
|
||||
drawing->additional.push_back(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(graphicProperties, sideBottom)));
|
||||
|
||||
if (graphicProperties.common_border_attlist_.fo_border_)
|
||||
{
|
||||
|
||||
@ -178,10 +178,10 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
////////////////////////////////////////////////////////////////////
|
||||
properties.apply_to(Context.get_drawing_context().get_properties());
|
||||
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_top", Compute_BorderWidth(properties, sideTop)));
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_right",Compute_BorderWidth(properties, sideRight)));
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_left", Compute_BorderWidth(properties, sideLeft)));
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_top", Compute_BorderWidth(properties, sideTop)));
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_right", Compute_BorderWidth(properties, sideRight)));
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"border_width_bottom", Compute_BorderWidth(properties, sideBottom)));
|
||||
|
||||
if (properties.fo_clip_)
|
||||
{
|
||||
|
||||
@ -41,7 +41,9 @@
|
||||
#include <cpdoccore/xml/attributes.h>
|
||||
|
||||
#include <cpdoccore/odf/odf_document.h>
|
||||
|
||||
#include "odfcontext.h"
|
||||
#include "draw_common.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
|
||||
@ -111,14 +113,29 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
|
||||
Context.add_page_properties(L""); //
|
||||
Context.add_page_properties(L"");
|
||||
}
|
||||
//backcolor (for all pages)
|
||||
//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 (prop->docx_back_serialize(Context.output_stream(), Context))
|
||||
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_,
|
||||
Context.root()->odf_context().drawStyles(), fill);
|
||||
|
||||
if (prop->style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_ || fill.type != 0)
|
||||
{
|
||||
Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape",true));
|
||||
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
|
||||
{
|
||||
std::wstring href = fill.bitmap->xlink_href_;
|
||||
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))
|
||||
{
|
||||
Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape", true));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -73,11 +73,11 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
_CP_OPT(odf_types::length_or_percent) fo_min_width_;
|
||||
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
|
||||
_CP_OPT(odf_types::length_or_percent) fo_min_width_;
|
||||
_CP_OPT(odf_types::length_or_percent) fo_min_height_;
|
||||
|
||||
_CP_OPT(odf_types::length_or_percent) fo_max_width_;
|
||||
_CP_OPT(odf_types::length_or_percent) fo_max_height_;
|
||||
_CP_OPT(odf_types::length_or_percent) fo_max_width_;
|
||||
_CP_OPT(odf_types::length_or_percent) fo_max_height_;
|
||||
|
||||
///////////////////////////////
|
||||
_CP_OPT(odf_types::color) svg_stroke_color_;
|
||||
|
||||
@ -98,17 +98,17 @@ private:
|
||||
virtual void add_text(const std::wstring & Text);
|
||||
|
||||
private:
|
||||
odf_types::length style_position_;
|
||||
_CP_OPT(odf_types::style_type) style_type_;
|
||||
_CP_OPT(wchar_t) style_char_;
|
||||
odf_types::length style_position_;
|
||||
_CP_OPT(odf_types::style_type) style_type_;
|
||||
_CP_OPT(wchar_t) style_char_;
|
||||
|
||||
_CP_OPT(odf_types::line_type) style_leader_type_;
|
||||
_CP_OPT(odf_types::line_style) style_leader_style_;
|
||||
_CP_OPT(odf_types::line_width) style_leader_width_;
|
||||
_CP_OPT(odf_types::style_leader_color) style_leader_color_;
|
||||
_CP_OPT(odf_types::line_type) style_leader_type_;
|
||||
_CP_OPT(odf_types::line_style) style_leader_style_;
|
||||
_CP_OPT(odf_types::line_width) style_leader_width_;
|
||||
_CP_OPT(odf_types::style_leader_color) style_leader_color_;
|
||||
|
||||
_CP_OPT( std::wstring ) style_leader_text_;
|
||||
_CP_OPT( odf_types::style_ref ) style_leader_text_style_;
|
||||
_CP_OPT( std::wstring ) style_leader_text_;
|
||||
_CP_OPT( odf_types::style_ref ) style_leader_text_style_;
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -54,7 +54,6 @@
|
||||
|
||||
#include "serialize_elements.h"
|
||||
#include "odfcontext.h"
|
||||
|
||||
#include "draw_common.h"
|
||||
|
||||
namespace cpdoccore {
|
||||
@ -904,12 +903,12 @@ 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_);
|
||||
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_);
|
||||
CP_APPLY_ATTR(L"style:paper-tray-name", style_paper_tray_name_);
|
||||
CP_APPLY_ATTR(L"style:print-orientation", style_print_orientation_);
|
||||
|
||||
common_horizontal_margin_attlist_.add_attributes(Attributes);
|
||||
common_vertical_margin_attlist_.add_attributes(Attributes);
|
||||
@ -919,7 +918,8 @@ void style_page_layout_properties_attlist::add_attributes( const xml::attributes
|
||||
common_padding_attlist_.add_attributes(Attributes);
|
||||
common_shadow_attlist_.add_attributes(Attributes);
|
||||
common_background_color_attlist_.add_attributes(Attributes);
|
||||
|
||||
common_draw_fill_attlist_.add_attributes(Attributes);
|
||||
|
||||
CP_APPLY_ATTR(L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
|
||||
CP_APPLY_ATTR(L"style:print", style_print_);
|
||||
CP_APPLY_ATTR(L"style:print-page-order", style_print_page_order_);
|
||||
@ -1260,18 +1260,26 @@ void style_page_layout_properties::add_child_element( xml::sax * Reader, const s
|
||||
{
|
||||
style_page_layout_properties_elements_.add_child_element(Reader, Ns, Name, getContext());
|
||||
}
|
||||
bool style_page_layout_properties::docx_back_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
|
||||
{
|
||||
if (!style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_)return false;
|
||||
|
||||
if (style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_type() == background_color::Transparent) return true;
|
||||
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)
|
||||
return true; //??
|
||||
//прозрачный фон
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(L"w:background")
|
||||
{
|
||||
std::wstring color = style_page_layout_properties_attlist_.common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
|
||||
CP_XML_ATTR(L"w:color",color);
|
||||
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();
|
||||
|
||||
CP_XML_ATTR(L"w:color", color);
|
||||
|
||||
oox::vml_serialize_background(CP_XML_STREAM(), fill, color, id);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
@ -892,54 +892,26 @@ public:
|
||||
odf_types::common_padding_attlist common_padding_attlist_;
|
||||
odf_types::common_shadow_attlist common_shadow_attlist_;
|
||||
|
||||
// 15.2.10
|
||||
odf_types::common_background_color_attlist common_background_color_attlist_;
|
||||
// 15.2.12
|
||||
_CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_;
|
||||
// 15.2.13 TODO
|
||||
_CP_OPT(std::wstring) style_print_;
|
||||
|
||||
// 15.2.14
|
||||
_CP_OPT(odf_types::direction) style_print_page_order_;
|
||||
|
||||
// 15.2.15 TODO
|
||||
_CP_OPT(std::wstring) style_first_page_number_;
|
||||
|
||||
// 15.2.16
|
||||
_CP_OPT(odf_types::percent) style_scale_to_;
|
||||
_CP_OPT(unsigned int) style_scale_to_pages_;
|
||||
|
||||
// 15.2.17
|
||||
_CP_OPT(odf_types::table_centering) style_table_centering_;
|
||||
// 15.2.18
|
||||
_CP_OPT(odf_types::length) style_footnote_max_height_;
|
||||
|
||||
// 15.2.19
|
||||
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
|
||||
|
||||
// 15.2.21
|
||||
_CP_OPT(odf_types::layout_grid_mode) style_layout_grid_mode_;
|
||||
|
||||
// 15.2.22
|
||||
_CP_OPT(odf_types::length) style_layout_grid_base_height_;
|
||||
|
||||
// 15.2.23
|
||||
_CP_OPT(odf_types::length) style_layout_grid_ruby_height_;
|
||||
|
||||
// 15.2.24
|
||||
_CP_OPT(unsigned int) style_layout_grid_lines_;
|
||||
|
||||
// 15.2.25
|
||||
_CP_OPT(odf_types::color) style_layout_grid_color_;
|
||||
|
||||
// 15.2.26
|
||||
_CP_OPT(bool) style_layout_grid_ruby_below_;
|
||||
|
||||
// 15.2.27
|
||||
_CP_OPT(bool) style_layout_grid_print_;
|
||||
|
||||
// 15.2.28
|
||||
_CP_OPT(bool) style_layout_grid_display_;
|
||||
odf_types::common_background_color_attlist common_background_color_attlist_;
|
||||
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
|
||||
|
||||
_CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_;
|
||||
_CP_OPT(std::wstring) style_print_;
|
||||
_CP_OPT(odf_types::direction) style_print_page_order_;
|
||||
_CP_OPT(std::wstring) style_first_page_number_;
|
||||
_CP_OPT(odf_types::percent) style_scale_to_;
|
||||
_CP_OPT(unsigned int) style_scale_to_pages_;
|
||||
_CP_OPT(odf_types::table_centering) style_table_centering_;
|
||||
_CP_OPT(odf_types::length) style_footnote_max_height_;
|
||||
odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
|
||||
_CP_OPT(odf_types::layout_grid_mode) style_layout_grid_mode_;
|
||||
_CP_OPT(odf_types::length) style_layout_grid_base_height_;
|
||||
_CP_OPT(odf_types::length) style_layout_grid_ruby_height_;
|
||||
_CP_OPT(unsigned int) style_layout_grid_lines_;
|
||||
_CP_OPT(odf_types::color) style_layout_grid_color_;
|
||||
_CP_OPT(bool) style_layout_grid_ruby_below_;
|
||||
_CP_OPT(bool) style_layout_grid_print_;
|
||||
_CP_OPT(bool) style_layout_grid_display_;
|
||||
|
||||
};
|
||||
|
||||
@ -992,7 +964,7 @@ public:
|
||||
|
||||
};
|
||||
|
||||
// style:page-layout-properties
|
||||
// style:page-layout-properties
|
||||
class style_page_layout_properties : public office_element_impl<style_page_layout_properties>
|
||||
{
|
||||
public:
|
||||
@ -1005,7 +977,7 @@ public:
|
||||
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
bool docx_back_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
|
||||
bool docx_background_serialize(std::wostream & strm, oox::docx_conversion_context & Context, oox::_oox_fill & fill, int id);
|
||||
|
||||
style_page_layout_properties() { }
|
||||
|
||||
@ -1020,7 +992,7 @@ private:
|
||||
|
||||
CP_REGISTER_OFFICE_ELEMENT2(style_page_layout_properties);
|
||||
|
||||
// text:notes-configuration
|
||||
// text:notes-configuration
|
||||
class text_notes_configuration : public office_element_impl<text_notes_configuration>
|
||||
{
|
||||
public:
|
||||
|
||||
@ -55,8 +55,7 @@
|
||||
#include "style_text_properties.h"
|
||||
#include "style_paragraph_properties.h"
|
||||
#include "style_graphic_properties.h"
|
||||
|
||||
|
||||
#include "style_page_layout_properties.h"
|
||||
|
||||
namespace cpdoccore
|
||||
{
|
||||
@ -175,6 +174,7 @@ struct odf_drawing_state
|
||||
svg_y_ = boost::none;
|
||||
svg_height_ = boost::none;
|
||||
svg_width_ = boost::none;
|
||||
fill_color_ = boost::none;
|
||||
|
||||
name_ = L"";
|
||||
description_ = L"";
|
||||
@ -208,7 +208,8 @@ struct odf_drawing_state
|
||||
int z_order_;
|
||||
bool hidden_;
|
||||
|
||||
_CP_OPT(double) rotateAngle;
|
||||
_CP_OPT(double) rotateAngle;
|
||||
_CP_OPT(unsigned int) fill_color_;
|
||||
|
||||
bool flipH;
|
||||
bool flipV;
|
||||
@ -238,8 +239,9 @@ public:
|
||||
|
||||
width = height = x = y = 0;
|
||||
|
||||
is_header_ = false;
|
||||
is_footer_ = false;
|
||||
is_header_ = false;
|
||||
is_footer_ = false;
|
||||
is_background_ = false;
|
||||
//некоторые свойства для объектов графики не поддерживаюися в редакторах Liber && OpenOffice.net
|
||||
//в MS Office и в нашем - проблем таких нет.
|
||||
}
|
||||
@ -254,6 +256,7 @@ public:
|
||||
|
||||
bool is_footer_;
|
||||
bool is_header_;
|
||||
bool is_background_;
|
||||
|
||||
void create_draw_base(int type);
|
||||
office_element_ptr create_draw_element(int type);
|
||||
@ -309,10 +312,18 @@ void odf_drawing_context::set_header_state(bool Val)
|
||||
{
|
||||
impl_->is_header_ = Val;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_background_state(bool Val)
|
||||
{
|
||||
impl_->is_background_ = Val;
|
||||
|
||||
impl_->current_graphic_properties = new style_graphic_properties();
|
||||
}
|
||||
|
||||
void odf_drawing_context::check_anchor()
|
||||
{
|
||||
return;
|
||||
if ((impl_->is_footer_ || impl_->is_header_) && (impl_->anchor_settings_.run_through_) && (impl_->anchor_settings_.run_through_->get_type() == run_through::Background))
|
||||
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) && (impl_->anchor_settings_.run_through_) && (impl_->anchor_settings_.run_through_->get_type() == run_through::Background))
|
||||
{
|
||||
set_anchor(anchor_type::Char);
|
||||
//подозрительно на подложку страницы
|
||||
@ -444,7 +455,18 @@ void odf_drawing_context::start_drawing()
|
||||
}
|
||||
void odf_drawing_context::end_drawing()
|
||||
{
|
||||
if (impl_->current_drawing_state_.elements_.empty()) return;
|
||||
if (impl_->current_drawing_state_.elements_.empty())
|
||||
{
|
||||
if (impl_->is_background_ && impl_->current_graphic_properties)
|
||||
{
|
||||
style_page_layout_properties * current_layout_properties = impl_->odf_context_->page_layout_context()->last_layout()->get_properties();
|
||||
current_layout_properties->style_page_layout_properties_attlist_.common_draw_fill_attlist_.apply_from(impl_->current_graphic_properties->content().common_draw_fill_attlist_);
|
||||
delete impl_->current_graphic_properties;
|
||||
impl_->current_graphic_properties = NULL;
|
||||
impl_->current_drawing_state_.clear();
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
|
||||
@ -570,12 +592,13 @@ void odf_drawing_context::end_drawing()
|
||||
{
|
||||
impl_->tops_elements_.push_back(impl_->current_drawing_state_.elements_[0].elm);
|
||||
}
|
||||
|
||||
///////////////
|
||||
impl_->current_drawing_state_.clear();
|
||||
|
||||
impl_->current_graphic_properties = NULL;
|
||||
impl_->current_paragraph_properties = NULL;
|
||||
impl_->current_text_properties = NULL;
|
||||
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
@ -629,7 +652,7 @@ void odf_drawing_context::Impl::create_draw_base(int type)
|
||||
draw_base* draw = dynamic_cast<draw_base*>(draw_elm.get());
|
||||
if (draw == NULL)return;
|
||||
//////////
|
||||
styles_context_->create_style(L"",style_family::Graphic, true, false, -1);
|
||||
styles_context_->create_style(L"", style_family::Graphic, true, false, -1);
|
||||
|
||||
office_element_ptr & style_shape_elm = styles_context_->last_state()->get_office_element();
|
||||
std::wstring style_name;
|
||||
@ -1068,7 +1091,7 @@ void odf_drawing_context::set_no_fill()
|
||||
switch(impl_->current_drawing_part_)
|
||||
{
|
||||
case Area:
|
||||
if ((impl_->is_footer_ || impl_->is_header_) &&
|
||||
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) &&
|
||||
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_) &&
|
||||
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
|
||||
{
|
||||
@ -1088,6 +1111,17 @@ void odf_drawing_context::set_type_fill(int type)
|
||||
|
||||
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = (draw_fill::type)type;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_fill_color(unsigned int Color)
|
||||
{
|
||||
impl_->current_drawing_state_.fill_color_ = Color;
|
||||
}
|
||||
|
||||
_CP_OPT(unsigned int) odf_drawing_context::get_fill_color()
|
||||
{
|
||||
return impl_->current_drawing_state_.fill_color_;
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_solid_fill(std::wstring hexColor)
|
||||
{
|
||||
if (!impl_->current_graphic_properties)return;
|
||||
@ -1097,28 +1131,29 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
|
||||
|
||||
switch(impl_->current_drawing_part_)
|
||||
{
|
||||
case Area:
|
||||
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_ = hexColor;
|
||||
impl_->current_graphic_properties->content().common_background_color_attlist_.fo_background_color_ = color(hexColor);
|
||||
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
|
||||
|
||||
if ((impl_->is_footer_ || impl_->is_header_) &&
|
||||
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_) &&
|
||||
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
|
||||
{
|
||||
}
|
||||
else
|
||||
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill::solid;
|
||||
break;
|
||||
case Line:
|
||||
impl_->current_graphic_properties->content().svg_stroke_color_ = hexColor;
|
||||
if (!impl_->current_graphic_properties->content().draw_stroke_)
|
||||
impl_->current_graphic_properties->content().draw_stroke_=line_style(line_style::Solid);//default
|
||||
if (!impl_->current_graphic_properties->content().svg_stroke_width_)
|
||||
impl_->current_graphic_properties->content().svg_stroke_width_ = length(length(1,length::pt).get_value_unit(length::cm),length::cm);//default
|
||||
break;
|
||||
case Area:
|
||||
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_ = hexColor;
|
||||
impl_->current_graphic_properties->content().common_background_color_attlist_.fo_background_color_ = color(hexColor);
|
||||
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
|
||||
|
||||
if ((impl_->is_footer_ || impl_->is_header_ || impl_->is_background_) &&
|
||||
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_) &&
|
||||
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
|
||||
{
|
||||
}
|
||||
else
|
||||
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill::solid;
|
||||
break;
|
||||
case Line:
|
||||
impl_->current_graphic_properties->content().svg_stroke_color_ = hexColor;
|
||||
if (!impl_->current_graphic_properties->content().draw_stroke_)
|
||||
impl_->current_graphic_properties->content().draw_stroke_=line_style(line_style::Solid);//default
|
||||
if (!impl_->current_graphic_properties->content().svg_stroke_width_)
|
||||
impl_->current_graphic_properties->content().svg_stroke_width_ = length(length(1,length::pt).get_value_unit(length::cm),length::cm);//default
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void odf_drawing_context::set_z_order(int id)
|
||||
{
|
||||
if (id < 0)
|
||||
@ -1243,7 +1278,7 @@ void odf_drawing_context::set_object_foreground(bool Val)
|
||||
{
|
||||
if (Val)
|
||||
{
|
||||
if (impl_->is_footer_|| impl_->is_header_)
|
||||
if (impl_->is_footer_|| impl_->is_header_ || impl_->is_background_)
|
||||
{
|
||||
impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
|
||||
}
|
||||
@ -1273,7 +1308,7 @@ void odf_drawing_context::set_margin_bottom (double valPt)
|
||||
}
|
||||
void odf_drawing_context::set_anchor(int type)
|
||||
{
|
||||
if ((impl_->is_footer_|| impl_->is_header_) && type == anchor_type::Page)
|
||||
if ((impl_->is_footer_|| impl_->is_header_ || impl_->is_background_) && type == anchor_type::Page)
|
||||
{
|
||||
type = anchor_type::Paragraph;
|
||||
}
|
||||
@ -1369,7 +1404,7 @@ void odf_drawing_context::set_horizontal_pos(double offset_pt)
|
||||
}
|
||||
void odf_drawing_context::set_default_wrap_style()
|
||||
{
|
||||
if (impl_->is_header_ || impl_->is_footer_ )
|
||||
if (impl_->is_header_ || impl_->is_footer_ || impl_->is_background_)
|
||||
{
|
||||
impl_->anchor_settings_.style_wrap_ = style_wrap::RunThrough;
|
||||
}
|
||||
@ -1879,7 +1914,7 @@ void odf_drawing_context::set_textarea_padding(_CP_OPT(double) & left, _CP_OPT(d
|
||||
//вложенные элементы
|
||||
void odf_drawing_context::start_image(std::wstring odf_path)
|
||||
{
|
||||
if (impl_->is_footer_ || impl_->is_header_)
|
||||
if (impl_->is_footer_ || impl_->is_header_ || impl_->is_background_)
|
||||
{
|
||||
start_shape(142/*SimpleTypes::shapetypeRect*/);
|
||||
start_bitmap_style();
|
||||
@ -2011,7 +2046,7 @@ void odf_drawing_context::set_text_box_parent_style(std::wstring style_name)
|
||||
|
||||
void odf_drawing_context::end_image()
|
||||
{
|
||||
if (impl_->is_footer_ || impl_->is_header_)
|
||||
if (impl_->is_footer_ || impl_->is_header_ || impl_->is_background_)
|
||||
{
|
||||
end_bitmap_style();
|
||||
end_shape();
|
||||
@ -2179,9 +2214,11 @@ void odf_drawing_context::start_gradient_style()
|
||||
gradient->draw_start_color_ = impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_color_;
|
||||
if (gradient->draw_start_color_) gradient->draw_start_intensity_ = 100.;
|
||||
|
||||
gradient->draw_border_ = 0;
|
||||
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_gradient_name_ = gradient->draw_name_;
|
||||
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient);
|
||||
|
||||
|
||||
}
|
||||
void odf_drawing_context::set_gradient_type(gradient_style::type style)
|
||||
{
|
||||
@ -2198,7 +2235,7 @@ void odf_drawing_context::set_gradient_start(std::wstring hexColor, _CP_OPT(doub
|
||||
int res = 0;
|
||||
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
|
||||
|
||||
gradient->draw_start_color_ = hexColor;
|
||||
gradient->draw_start_color_ = hexColor;
|
||||
gradient->draw_start_intensity_ = 100.;
|
||||
}
|
||||
void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(double) & intensiv)
|
||||
@ -2209,15 +2246,15 @@ void odf_drawing_context::set_gradient_end (std::wstring hexColor, _CP_OPT(doub
|
||||
int res = 0;
|
||||
if ((res = hexColor.find(L"#")) < 0) hexColor = std::wstring(L"#") + hexColor;
|
||||
|
||||
gradient->draw_end_color_ = hexColor;
|
||||
gradient->draw_end_intensity_ = 100.;
|
||||
gradient->draw_end_color_ = hexColor;
|
||||
gradient->draw_end_intensity_ = 100.;
|
||||
}
|
||||
void odf_drawing_context::set_gradient_angle(double angle)
|
||||
{
|
||||
draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state(style_family::Gradient)->get_office_element().get());
|
||||
if (!gradient) return;
|
||||
|
||||
gradient->draw_angle_ = (270-angle)*10;//(int)((360 - angle)/180. * 3.14159265358979323846);
|
||||
gradient->draw_angle_ = (270- angle) * 10;//(int)((360 - angle)/180. * 3.14159265358979323846);
|
||||
}
|
||||
void odf_drawing_context::set_gradient_rect(double l, double t, double r,double b)
|
||||
{
|
||||
@ -2721,7 +2758,7 @@ void odf_drawing_context::set_image_client_rect_inch(double l, double t, double
|
||||
void odf_drawing_context::set_bitmap_link(std::wstring file_path)
|
||||
{
|
||||
std::wstring odf_ref_name ;
|
||||
impl_->odf_context_->mediaitems()->add_or_find(file_path,_mediaitems::typeImage,odf_ref_name);
|
||||
impl_->odf_context_->mediaitems()->add_or_find(file_path, _mediaitems::typeImage, odf_ref_name);
|
||||
|
||||
if (impl_->current_drawing_state_.oox_shape_preset == 3000)
|
||||
{
|
||||
|
||||
@ -64,8 +64,10 @@ public:
|
||||
void clear ();
|
||||
void set_styles_context (odf_style_context* styles_context);//для embedded
|
||||
|
||||
void set_header_state (bool Val);
|
||||
void set_footer_state (bool Val);
|
||||
void set_header_state (bool Val);
|
||||
void set_footer_state (bool Val);
|
||||
void set_background_state (bool Val);
|
||||
|
||||
void check_anchor ();
|
||||
|
||||
void set_margin_left (double valPt);
|
||||
@ -173,6 +175,7 @@ public:
|
||||
void set_type_fill (int type);//for area - temp for objects
|
||||
void set_solid_fill (std::wstring hexColor);
|
||||
void set_opacity (double percent);
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
void start_area_properties();
|
||||
void end_area_properties();
|
||||
@ -187,6 +190,8 @@ public:
|
||||
std::wstring add_marker_style(int type);
|
||||
void end_line_properties ();
|
||||
|
||||
_CP_OPT(unsigned int) get_fill_color ();
|
||||
void set_fill_color (unsigned int color);
|
||||
//void start_shadow_properties();
|
||||
//void end_shadow_properties();
|
||||
// пока одной функией ..
|
||||
|
||||
@ -170,6 +170,7 @@ private:
|
||||
|
||||
bool is_header_;
|
||||
bool is_footer_;
|
||||
bool is_background_;
|
||||
|
||||
std::vector<odf_drawing_context_ptr> drawing_context_;
|
||||
std::vector<odf_text_context_ptr> text_context_; //for embedded
|
||||
|
||||
@ -122,42 +122,47 @@ void style_page_layout_properties_attlist::serialize(CP_ATTR_NODE)
|
||||
}
|
||||
}
|
||||
|
||||
CP_XML_ATTR_OPT (L"fo:page-width", fo_page_width_);
|
||||
CP_XML_ATTR_OPT (L"fo:page-height", fo_page_height_);
|
||||
common_num_format_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_num_format_prefix_suffix_attlist_.serialize(CP_GET_XML_NODE());
|
||||
CP_XML_ATTR_OPT (L"style:paper-tray-name", style_paper_tray_name_);
|
||||
CP_XML_ATTR_OPT (L"style:print-orientation", style_print_orientation_);
|
||||
CP_XML_ATTR_OPT (L"fo:page-width", fo_page_width_);
|
||||
CP_XML_ATTR_OPT (L"fo:page-height", fo_page_height_);
|
||||
|
||||
common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_vertical_margin_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_margin_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_border_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_border_line_width_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_padding_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_shadow_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_background_color_attlist_.serialize(CP_GET_XML_NODE());
|
||||
common_num_format_attlist_.serialize (CP_GET_XML_NODE());
|
||||
common_num_format_prefix_suffix_attlist_.serialize (CP_GET_XML_NODE());
|
||||
|
||||
CP_XML_ATTR_OPT (L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
|
||||
CP_XML_ATTR_OPT (L"style:print", style_print_);
|
||||
CP_XML_ATTR_OPT (L"style:print-page-order", style_print_page_order_);
|
||||
CP_XML_ATTR_OPT (L"style:first-page-number", style_first_page_number_);
|
||||
CP_XML_ATTR_OPT (L"style:scale-to", style_scale_to_);
|
||||
CP_XML_ATTR_OPT (L"style:scale-to_pages", style_scale_to_pages_);
|
||||
CP_XML_ATTR_OPT (L"style:table-centering", style_table_centering_);
|
||||
CP_XML_ATTR_OPT (L"style:footnote-max-height", style_footnote_max_height_);
|
||||
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE());
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-mode", style_layout_grid_mode_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-base-height", style_layout_grid_base_height_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-height", style_layout_grid_ruby_height_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-lines", style_layout_grid_lines_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-color", style_layout_grid_color_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-below", style_layout_grid_ruby_below_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-print", style_layout_grid_print_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-display", style_layout_grid_display_);
|
||||
CP_XML_ATTR_OPT (L"style:paper-tray-name", style_paper_tray_name_);
|
||||
CP_XML_ATTR_OPT (L"style:print-orientation", style_print_orientation_);
|
||||
|
||||
common_horizontal_margin_attlist_.serialize (CP_GET_XML_NODE());
|
||||
common_vertical_margin_attlist_.serialize (CP_GET_XML_NODE());
|
||||
common_margin_attlist_.serialize (CP_GET_XML_NODE());
|
||||
common_border_attlist_.serialize (CP_GET_XML_NODE());
|
||||
common_border_line_width_attlist_.serialize (CP_GET_XML_NODE());
|
||||
common_padding_attlist_.serialize (CP_GET_XML_NODE());
|
||||
common_shadow_attlist_.serialize (CP_GET_XML_NODE());
|
||||
common_background_color_attlist_.serialize (CP_GET_XML_NODE());
|
||||
common_draw_fill_attlist_.serialize (CP_GET_XML_NODE());
|
||||
|
||||
CP_XML_ATTR_OPT (L"style:register-truth-ref-style-name", style_register_truth_ref_style_name_);
|
||||
CP_XML_ATTR_OPT (L"style:print", style_print_);
|
||||
CP_XML_ATTR_OPT (L"style:print-page-order", style_print_page_order_);
|
||||
CP_XML_ATTR_OPT (L"style:first-page-number", style_first_page_number_);
|
||||
CP_XML_ATTR_OPT (L"style:scale-to", style_scale_to_);
|
||||
CP_XML_ATTR_OPT (L"style:scale-to_pages", style_scale_to_pages_);
|
||||
CP_XML_ATTR_OPT (L"style:table-centering", style_table_centering_);
|
||||
CP_XML_ATTR_OPT (L"style:footnote-max-height", style_footnote_max_height_);
|
||||
|
||||
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE());
|
||||
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-mode", style_layout_grid_mode_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-base-height", style_layout_grid_base_height_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-height", style_layout_grid_ruby_height_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-lines", style_layout_grid_lines_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-color", style_layout_grid_color_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-ruby-below", style_layout_grid_ruby_below_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-print", style_layout_grid_print_);
|
||||
CP_XML_ATTR_OPT (L"style:layout-grid-display", style_layout_grid_display_);
|
||||
}
|
||||
const wchar_t * style_page_layout_properties::ns = L"style";
|
||||
const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
|
||||
const wchar_t * style_page_layout_properties::ns = L"style";
|
||||
const wchar_t * style_page_layout_properties::name = L"page-layout-properties";
|
||||
|
||||
void style_page_layout_properties::create_child_element( const std::wstring & Ns, const std::wstring & Name)
|
||||
{
|
||||
|
||||
@ -62,6 +62,7 @@ public:
|
||||
_CP_OPT(odf_types::length) fo_page_width_;
|
||||
_CP_OPT(odf_types::length) fo_page_height_;
|
||||
|
||||
odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
|
||||
odf_types::common_num_format_attlist common_num_format_attlist_;
|
||||
odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
|
||||
|
||||
|
||||
@ -159,8 +159,8 @@ public:
|
||||
|
||||
std::wstring get_style_name(){return draw_name_.get_value_or(L"");}
|
||||
|
||||
_CP_OPT(odf_types::color) draw_start_color_;
|
||||
_CP_OPT(odf_types::color) draw_end_color_;
|
||||
_CP_OPT(odf_types::color) draw_start_color_;
|
||||
_CP_OPT(odf_types::color) draw_end_color_;
|
||||
|
||||
_CP_OPT(odf_types::percent) draw_end_intensity_;
|
||||
_CP_OPT(odf_types::percent) draw_start_intensity_;
|
||||
@ -169,11 +169,11 @@ public:
|
||||
_CP_OPT(odf_types::percent) draw_cx_;
|
||||
|
||||
_CP_OPT(odf_types::percent) draw_border_;
|
||||
_CP_OPT(int) draw_angle_;
|
||||
_CP_OPT(odf_types::gradient_style) draw_style_;
|
||||
_CP_OPT(int) draw_angle_;
|
||||
_CP_OPT(odf_types::gradient_style) draw_style_;
|
||||
|
||||
_CP_OPT(std::wstring) draw_name_;
|
||||
_CP_OPT(std::wstring) draw_display_name_;
|
||||
_CP_OPT(std::wstring) draw_name_;
|
||||
_CP_OPT(std::wstring) draw_display_name_;
|
||||
|
||||
virtual void create_child_element( const std::wstring & Ns, const std::wstring & Name);
|
||||
virtual void serialize(std::wostream & strm);
|
||||
|
||||
@ -48,8 +48,6 @@
|
||||
#include "../OdfFormat/style_text_properties.h"
|
||||
#include "../OdfFormat/style_paragraph_properties.h"
|
||||
|
||||
#define ARGB(a, r, g, b) ((unsigned int)( ( (unsigned char)(a) )| ( ( (unsigned char)(r) ) << 8 ) | ( ( (unsigned char)(g) ) << 16 ) | ( (unsigned char)(b) << 24 ) ) )
|
||||
|
||||
using namespace cpdoccore;
|
||||
|
||||
namespace Oox2Odf
|
||||
@ -305,9 +303,80 @@ void OoxConverter::convert(PPTX::Logic::PathBase *oox_path)
|
||||
|
||||
}
|
||||
|
||||
void OoxConverter::convert(PPTX::Logic::BlipFill *oox_fill)
|
||||
void OoxConverter::convert(PPTX::Logic::BlipFill *oox_bitmap_fill)
|
||||
{
|
||||
if (!oox_fill) return;
|
||||
if (oox_bitmap_fill == NULL)return;
|
||||
|
||||
odf_context()->drawing_context()->start_bitmap_style();
|
||||
{
|
||||
double Width=0, Height = 0;
|
||||
if (oox_bitmap_fill->blip.IsInit())
|
||||
{
|
||||
std::wstring sID, pathImage;
|
||||
if (oox_bitmap_fill->blip->embed.IsInit())
|
||||
{
|
||||
sID = oox_bitmap_fill->blip->embed->get();
|
||||
pathImage = find_link_by_id(sID,1);
|
||||
|
||||
if (!pathImage.empty())
|
||||
{
|
||||
odf_context()->drawing_context()->set_bitmap_link(pathImage);
|
||||
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
|
||||
}
|
||||
}
|
||||
else if (oox_bitmap_fill->blip->link.IsInit())
|
||||
{
|
||||
sID = pathImage = oox_bitmap_fill->blip->link->get();
|
||||
|
||||
odf_context()->drawing_context()->set_bitmap_link(pathImage);
|
||||
//...
|
||||
}
|
||||
//for (size_t i = 0 ; i < oox_bitmap_fill->blip->m_arrEffects.size(); i++)
|
||||
//{
|
||||
// convert(oox_bitmap_fill->blip->m_arrEffects[i]);
|
||||
//}
|
||||
}
|
||||
if (oox_bitmap_fill->srcRect.IsInit() && Width >0 && Height >0)//часть изображения
|
||||
{
|
||||
odf_context()->drawing_context()->set_image_client_rect_inch(
|
||||
(oox_bitmap_fill->srcRect->l.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->l.get()) : 0 ) /100. * Width / currentSystemDPI,
|
||||
(oox_bitmap_fill->srcRect->t.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->t.get()) : 0 ) /100. * Height/ currentSystemDPI,
|
||||
(oox_bitmap_fill->srcRect->r.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->r.get()) : 0 ) /100. * Width / currentSystemDPI,
|
||||
(oox_bitmap_fill->srcRect->b.IsInit() ? XmlUtils::GetInteger(oox_bitmap_fill->srcRect->b.get()) : 0 ) /100. * Height/ currentSystemDPI);
|
||||
}
|
||||
if (oox_bitmap_fill->tile.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->set_image_style_repeat(2);
|
||||
|
||||
if (oox_bitmap_fill->tile->algn.IsInit())
|
||||
odf_context()->drawing_context()->set_bitmap_tile_align(oox_bitmap_fill->tile->algn->GetBYTECode());
|
||||
|
||||
if (oox_bitmap_fill->tile->flip.IsInit()) {}
|
||||
|
||||
if (oox_bitmap_fill->tile->sx.IsInit() && Width >0)
|
||||
{
|
||||
odf_context()->drawing_context()->set_bitmap_tile_scale_x(*oox_bitmap_fill->tile->sx / 100. * Width);
|
||||
}
|
||||
if (oox_bitmap_fill->tile->sy.IsInit()&& Height >0)
|
||||
{
|
||||
odf_context()->drawing_context()->set_bitmap_tile_scale_y(*oox_bitmap_fill->tile->sy / 100. * Height);
|
||||
}
|
||||
if (oox_bitmap_fill->tile->tx.IsInit() && Width >0)
|
||||
{
|
||||
odf_context()->drawing_context()->set_bitmap_tile_translate_x(*oox_bitmap_fill->tile->tx * 100. / Width );
|
||||
}
|
||||
if (oox_bitmap_fill->tile->ty.IsInit() && Height >0)
|
||||
{
|
||||
odf_context()->drawing_context()->set_bitmap_tile_translate_y(*oox_bitmap_fill->tile->ty * 100. / Height );
|
||||
}
|
||||
}
|
||||
if (oox_bitmap_fill->stretch.IsInit())
|
||||
{
|
||||
odf_context()->drawing_context()->set_image_style_repeat(1);
|
||||
if (oox_bitmap_fill->stretch->fillRect.IsInit()){} //заполнение неполного объема
|
||||
}
|
||||
}
|
||||
odf_context()->drawing_context()->end_bitmap_style();
|
||||
}
|
||||
void OoxConverter::convert(PPTX::Logic::GradFill *oox_grad_fill)
|
||||
{
|
||||
|
||||
@ -44,6 +44,7 @@
|
||||
#include "../OdfFormat/style_paragraph_properties.h"
|
||||
|
||||
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
|
||||
#include "../../../DesktopEditor/raster/BgraFrame.h"
|
||||
|
||||
#include "VmlShapeTypes2Oox.h"
|
||||
|
||||
@ -386,6 +387,9 @@ void OoxConverter::convert(OOX::Vml::CArc *vml_arc)
|
||||
void OoxConverter::convert(OOX::Vml::CBackground *vml_background)
|
||||
{
|
||||
if (vml_background == NULL) return;
|
||||
|
||||
OOX::Vml::CVmlCommonElements *vml_common = static_cast<OOX::Vml::CVmlCommonElements *>(vml_background);
|
||||
convert(vml_common);
|
||||
}
|
||||
|
||||
void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
|
||||
@ -394,6 +398,28 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
|
||||
|
||||
odf_context()->drawing_context()->start_area_properties();
|
||||
|
||||
std::wstring sImagePath;
|
||||
|
||||
_CP_OPT(unsigned int) nRgbColor1, nRgbColor2;
|
||||
_CP_OPT(std::wstring) sRgbColor1, sRgbColor2;
|
||||
|
||||
if (vml_fill->m_oColor.IsInit())
|
||||
{
|
||||
nRgbColor1 = ((unsigned int)(((BYTE)(vml_fill->m_oColor->Get_B())
|
||||
| ((unsigned int)((BYTE)(vml_fill->m_oColor->Get_G()))<<8))
|
||||
| (((unsigned int)(BYTE)(vml_fill->m_oColor->Get_R()))<<16)));
|
||||
|
||||
sRgbColor1 = XmlUtils::IntToString(*nRgbColor1, L"%06X");
|
||||
}
|
||||
|
||||
if (vml_fill->m_oColor2.IsInit())
|
||||
{
|
||||
nRgbColor2 = ((unsigned int)(((BYTE)(vml_fill->m_oColor2->Get_B())
|
||||
| ((unsigned int)((BYTE)(vml_fill->m_oColor2->Get_G()))<<8))
|
||||
| (((unsigned int)(BYTE)(vml_fill->m_oColor2->Get_R()))<<16)));
|
||||
sRgbColor2 = XmlUtils::IntToString(*nRgbColor2, L"%06X");
|
||||
}
|
||||
|
||||
if (vml_fill->m_rId.IsInit())
|
||||
{
|
||||
//bitmap fill
|
||||
@ -401,37 +427,37 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
|
||||
{
|
||||
double Width=0, Height = 0;
|
||||
std::wstring sID = vml_fill->m_rId->GetValue();
|
||||
std::wstring pathImage = find_link_by_id(sID,1);
|
||||
|
||||
sImagePath = find_link_by_id(sID, 1);
|
||||
|
||||
if (!pathImage.empty())
|
||||
if (!sImagePath.empty())
|
||||
{
|
||||
odf_context()->drawing_context()->set_bitmap_link(pathImage);
|
||||
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height);
|
||||
odf_context()->drawing_context()->set_bitmap_link( sImagePath );
|
||||
_graphics_utils_::GetResolution( sImagePath.c_str(), Width, Height );
|
||||
}
|
||||
odf_context()->drawing_context()->set_image_style_repeat(1);
|
||||
}
|
||||
odf_context()->drawing_context()->end_bitmap_style();
|
||||
}
|
||||
else
|
||||
|
||||
switch (vml_fill->m_oType.GetValue())
|
||||
{
|
||||
switch (vml_fill->m_oType.GetValue())
|
||||
{
|
||||
case SimpleTypes::filltypeGradient :
|
||||
case SimpleTypes::filltypeGradientCenter :
|
||||
case SimpleTypes::filltypeGradientRadial :
|
||||
case SimpleTypes::filltypeGradientUnscaled:
|
||||
{
|
||||
odf_context()->drawing_context()->start_gradient_style();
|
||||
if (SimpleTypes::filltypeGradient == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::linear);
|
||||
if (SimpleTypes::filltypeGradientRadial == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::radial);
|
||||
if (SimpleTypes::filltypeGradientCenter == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::axial);
|
||||
if (SimpleTypes::filltypeGradientUnscaled == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::square);
|
||||
if (SimpleTypes::filltypeGradient == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::linear);
|
||||
if (SimpleTypes::filltypeGradientRadial == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::radial);
|
||||
if (SimpleTypes::filltypeGradientCenter == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::axial);
|
||||
if (SimpleTypes::filltypeGradientUnscaled == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::square);
|
||||
|
||||
_CP_OPT(double) no_set;
|
||||
if (vml_fill->m_oColor.IsInit())
|
||||
odf_context()->drawing_context()->set_gradient_start(vml_fill->m_oColor->ToString(), no_set);
|
||||
if (vml_fill->m_oColor2.IsInit())
|
||||
odf_context()->drawing_context()->set_gradient_end(vml_fill->m_oColor2->ToString(), no_set);
|
||||
if (sRgbColor1)
|
||||
odf_context()->drawing_context()->set_gradient_start(*sRgbColor1, no_set);
|
||||
if (sRgbColor2)
|
||||
odf_context()->drawing_context()->set_gradient_end(*sRgbColor2, no_set);
|
||||
|
||||
if (vml_fill->m_oFocusPosition.IsInit())
|
||||
odf_context()->drawing_context()->set_gradient_center(vml_fill->m_oFocusPosition->GetX(), vml_fill->m_oFocusPosition->GetY());
|
||||
@ -440,23 +466,35 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
|
||||
}break;
|
||||
case SimpleTypes::filltypePattern:
|
||||
{
|
||||
if (!sImagePath.empty())
|
||||
{
|
||||
odf_context()->drawing_context()->set_image_style_repeat(2);
|
||||
|
||||
if (!nRgbColor1)
|
||||
nRgbColor1 = odf_context()->drawing_context()->get_fill_color();
|
||||
|
||||
CBgraFrame bgraFrame;
|
||||
|
||||
bgraFrame.ReColorPatternImage(sImagePath, nRgbColor1.get_value_or(0xffffff), nRgbColor2.get_value_or(0x000000));
|
||||
}
|
||||
else
|
||||
{
|
||||
odf_context()->drawing_context()->start_hatch_style();
|
||||
if (vml_fill->m_oColor2.IsInit())
|
||||
odf_context()->drawing_context()->set_hatch_line_color(vml_fill->m_oColor2->ToString());
|
||||
if (vml_fill->m_oColor.IsInit())
|
||||
odf_context()->drawing_context()->set_hatch_area_color(vml_fill->m_oColor->ToString());
|
||||
if (sRgbColor2)
|
||||
odf_context()->drawing_context()->set_hatch_line_color(*sRgbColor2);
|
||||
if (sRgbColor1)
|
||||
odf_context()->drawing_context()->set_hatch_area_color(*sRgbColor1);
|
||||
else
|
||||
odf_context()->drawing_context()->set_hatch_area_color(L"#ffffff");
|
||||
|
||||
odf_context()->drawing_context()->end_hatch_style();
|
||||
|
||||
}
|
||||
}break;
|
||||
case SimpleTypes::filltypeSolid:
|
||||
default:
|
||||
if (vml_fill->m_oColor.IsInit())
|
||||
odf_context()->drawing_context()->set_solid_fill(vml_fill->m_oColor->ToString());
|
||||
if (sImagePath.empty() && sRgbColor1)
|
||||
odf_context()->drawing_context()->set_solid_fill(*sRgbColor1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
//--------------------------------------------------------------------------------------------------------------------
|
||||
if (vml_fill->m_oOpacity.IsInit() && vml_fill->m_oOpacity2.IsInit() )
|
||||
@ -588,7 +626,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
|
||||
if (vml_stroke->m_oColor.IsInit())
|
||||
{
|
||||
std::wstring hexColor = vml_stroke->m_oColor->ToString();
|
||||
if (hexColor.length() < 1)hexColor = L"000000";
|
||||
if (hexColor.empty()) hexColor = L"000000";
|
||||
odf_context()->drawing_context()->set_solid_fill(hexColor);
|
||||
}
|
||||
|
||||
@ -818,9 +856,16 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
|
||||
|
||||
if (oRgbColor)
|
||||
{
|
||||
odf_context()->drawing_context()->start_area_properties();
|
||||
unsigned int nRgbColor = ((unsigned int)(((BYTE)( oRgbColor->Get_B())
|
||||
| ((unsigned int)((BYTE)( oRgbColor->Get_G()))<<8))
|
||||
| (((unsigned int)(BYTE)( oRgbColor->Get_R()))<<16)));
|
||||
|
||||
odf_context()->drawing_context()->set_fill_color(nRgbColor);
|
||||
|
||||
odf_context()->drawing_context()->start_area_properties();
|
||||
odf_context()->drawing_context()->set_solid_fill(oRgbColor->ToString().substr(2));//.Right(6));
|
||||
odf_context()->drawing_context()->end_area_properties();
|
||||
|
||||
delete oRgbColor;
|
||||
}
|
||||
}
|
||||
|
||||
@ -215,11 +215,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
|
||||
OOX::Vml::CTextbox *vml = static_cast<OOX::Vml::CTextbox*>(oox_unknown);
|
||||
convert(vml);
|
||||
}break;
|
||||
//case OOX::et_v_background:
|
||||
//{
|
||||
// OOX::Vml::CBackground *vml = static_cast<OOX::Vml::CBackground*>(oox_unknown);
|
||||
// convert(vml);
|
||||
//}break;
|
||||
case OOX::et_v_background:
|
||||
{
|
||||
OOX::Vml::CBackground *vml = static_cast<OOX::Vml::CBackground*>(oox_unknown);
|
||||
convert(vml);
|
||||
}break;
|
||||
case OOX::et_v_path:
|
||||
{
|
||||
OOX::Vml::CPath *vml = static_cast<OOX::Vml::CPath*>(oox_unknown);
|
||||
|
||||
@ -1684,6 +1684,10 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
|
||||
|
||||
odt_context->set_background(color, type);
|
||||
|
||||
odt_context->start_drawings();
|
||||
odt_context->drawing_context()->set_background_state(true);
|
||||
odt_context->drawing_context()->start_drawing();
|
||||
|
||||
if (oox_background->m_oDrawing.IsInit())
|
||||
{
|
||||
convert(oox_background->m_oDrawing.GetPointer());
|
||||
@ -1692,6 +1696,8 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
|
||||
{
|
||||
convert(oox_background->m_oBackground.GetPointer());
|
||||
}
|
||||
odt_context->drawing_context()->end_drawing();
|
||||
odt_context->end_drawings();
|
||||
}
|
||||
|
||||
void DocxConverter::convert(ComplexTypes::Word::CFramePr *oox_frame_pr, odf_writer::style_paragraph_properties * paragraph_properties)
|
||||
|
||||
@ -395,7 +395,6 @@ public:
|
||||
SetPen (root);
|
||||
SetBrush (root);
|
||||
|
||||
//return m_pShape->LoadFromXML(xml);
|
||||
return ((CPPTShape*)m_pShape)->LoadFromXML(root);
|
||||
}
|
||||
#endif
|
||||
@ -439,20 +438,20 @@ public:
|
||||
XmlUtils::CXmlNode oNodeTemplate;
|
||||
if (oNodePict.GetNode(_T("stroke"), oNodeTemplate))
|
||||
{
|
||||
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("strokecolor"));
|
||||
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("strokecolor"));
|
||||
//if (strColor != _T(""))
|
||||
// m_oPen.Color.FromString(strColor);
|
||||
//std::wstring strSize = oNodeTemplate.GetAttributeOrValue(_T("strokeweight"));
|
||||
//std::wstring strSize = oNodeTemplate.GetAttributeOrValue(_T("strokeweight"));
|
||||
//if (strSize != _T(""))
|
||||
// m_oPen.Size = XmlUtils::GetDouble(strSize);
|
||||
//std::wstring strStroke = oNodeTemplate.GetAttributeOrValue(_T("stroked"));
|
||||
//std::wstring strStroke = oNodeTemplate.GetAttributeOrValue(_T("stroked"));
|
||||
//if (strStroke != _T(""))
|
||||
// m_oPen.Alpha = 0;
|
||||
|
||||
}
|
||||
if (oNodePict.GetNode(_T("v:stroke"), oNodeTemplate))
|
||||
{
|
||||
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("dashstyle"));
|
||||
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("dashstyle"));
|
||||
//if (strColor != _T(""))
|
||||
// m_oPen.DashStyle = XmlUtils::GetInteger(strColor);
|
||||
}
|
||||
@ -463,7 +462,7 @@ public:
|
||||
XmlUtils::CXmlNode oNodeTemplate;
|
||||
if (oNodePict.GetNode(_T("fillcolor"), oNodeTemplate))
|
||||
{
|
||||
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("val"));
|
||||
std::wstring strColor = oNodeTemplate.GetAttributeOrValue(_T("val"));
|
||||
//if (strColor != _T(""))
|
||||
// m_oBrush.Color1.FromString(strColor);
|
||||
}
|
||||
@ -476,19 +475,19 @@ public:
|
||||
XmlUtils::CXmlNode oNodeTemplate;
|
||||
if (oNodePict.GetNode(_T("coordsize"), oNodeTemplate))
|
||||
{
|
||||
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(_T("val"));
|
||||
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(_T("val"));
|
||||
if (strCoordSize != _T(""))
|
||||
{
|
||||
std::vector<std::wstring> oArray;
|
||||
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
std::vector<std::wstring> oArray;
|
||||
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
|
||||
m_dWidthLogic = XmlUtils::GetInteger(oArray[0]);
|
||||
m_dWidthLogic = XmlUtils::GetInteger(oArray[0]);
|
||||
m_dHeightLogic = XmlUtils::GetInteger(oArray[1]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
|
||||
std::wstring id = oNodePict.GetAttributeOrValue(_T("type"));
|
||||
if (id != _T(""))
|
||||
{
|
||||
m_dWidthLogic = 21600;
|
||||
@ -499,11 +498,11 @@ public:
|
||||
XmlUtils::CXmlNode oNodeTemplate;
|
||||
if (oNodePict.GetNode(_T("template"), oNodeTemplate))
|
||||
{
|
||||
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(_T("coordsize"));
|
||||
std::wstring strCoordSize = oNodeTemplate.GetAttributeOrValue(_T("coordsize"));
|
||||
if (strCoordSize != _T(""))
|
||||
{
|
||||
std::vector<std::wstring> oArray;
|
||||
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
std::vector<std::wstring> oArray;
|
||||
boost::algorithm::split(oArray, strCoordSize, boost::algorithm::is_any_of(L","), boost::algorithm::token_compress_on);
|
||||
|
||||
m_dWidthLogic = XmlUtils::GetInteger(oArray[0]);
|
||||
m_dHeightLogic = XmlUtils::GetInteger(oArray[1]);
|
||||
|
||||
@ -158,8 +158,9 @@ namespace PPTX
|
||||
|
||||
std::map<std::wstring, smart_ptr<OOX::File>>::const_iterator pPair = map.find(normPath);
|
||||
|
||||
if (bIsSlide && (pRelation->Type() == OOX::Presentation::FileTypes::Slide))
|
||||
{
|
||||
if (bIsSlide && (pRelation->Type() == OOX::FileTypes::HyperLink))
|
||||
{// + external audio, video ...
|
||||
normPath = pRelation->Target();
|
||||
long percent = Event->GetPercent();
|
||||
|
||||
smart_ptr<OOX::File> file = smart_ptr<OOX::File>(new OOX::HyperLink(pRelation->Target()));
|
||||
|
||||
@ -532,13 +532,14 @@ namespace PPTX
|
||||
return (long) nvPicPr.cNvPr.id;
|
||||
}
|
||||
|
||||
void Pic::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap)
|
||||
void Pic::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap, bool in_group)
|
||||
{
|
||||
smart_ptr<PPTX::Theme> oTheme = _oTheme.smart_dynamic_cast<PPTX::Theme>();
|
||||
smart_ptr<PPTX::Logic::ClrMap> oClrMap = oTheme.smart_dynamic_cast<PPTX::Logic::ClrMap>();
|
||||
|
||||
bool bOle = oleObject.IsInit() && oleObject->isValid();
|
||||
std::wstring sOleNodeName;
|
||||
|
||||
if (XMLWRITER_DOC_TYPE_XLSX != pWriter->m_lDocType)
|
||||
{
|
||||
if(bOle && oleObject->m_oDxaOrig.IsInit() && oleObject->m_oDyaOrig.IsInit())
|
||||
@ -546,8 +547,8 @@ namespace PPTX
|
||||
sOleNodeName = L"w:object";
|
||||
pWriter->StartNode(sOleNodeName);
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("w:dxaOrig"), oleObject->m_oDxaOrig);
|
||||
pWriter->WriteAttribute(_T("w:dyaOrig"), oleObject->m_oDyaOrig);
|
||||
pWriter->WriteAttribute(L"w:dxaOrig", oleObject->m_oDxaOrig);
|
||||
pWriter->WriteAttribute(L"w:dyaOrig", oleObject->m_oDyaOrig);
|
||||
pWriter->EndAttributes();
|
||||
}
|
||||
else
|
||||
@ -559,38 +560,40 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
|
||||
int dL = 0;
|
||||
int dT = 0;
|
||||
int dW = 0;
|
||||
int dH = 0;
|
||||
|
||||
int nShapeId = pWriter->m_lObjectIdVML;
|
||||
std::wstring strId = L"_x0000_i" + std::to_wstring(nShapeId);
|
||||
std::wstring strSpid = L"_x" + std::to_wstring(0xFFFF & (pWriter->m_lObjectIdVML >> 16)) + L"_s" + std::to_wstring(0xFFFF & pWriter->m_lObjectIdVML);
|
||||
std::wstring strObjectid = L"_152504" + std::to_wstring(pWriter->m_lObjectIdVML);
|
||||
std::wstring strId = L"_x0000_i" + std::to_wstring(nShapeId);
|
||||
std::wstring strSpid = L"_x" + std::to_wstring(0xFFFF & (pWriter->m_lObjectIdVML >> 16)) + L"_s" + std::to_wstring(0xFFFF & pWriter->m_lObjectIdVML);
|
||||
std::wstring strObjectid = L"_152504" + std::to_wstring(pWriter->m_lObjectIdVML);
|
||||
pWriter->m_lObjectIdVML++;
|
||||
|
||||
int dL = 0, dT = 0, dW = 0, dH = 0;
|
||||
if (spPr.xfrm.is_init())
|
||||
{
|
||||
if (spPr.xfrm->offX.is_init()) dL = *spPr.xfrm->offX;
|
||||
if (spPr.xfrm->offY.is_init()) dT = *spPr.xfrm->offY;
|
||||
if (spPr.xfrm->extX.is_init()) dW = *spPr.xfrm->extX;
|
||||
if (spPr.xfrm->extY.is_init()) dH = *spPr.xfrm->extY;
|
||||
}
|
||||
|
||||
NSBinPptxRW::CXmlWriter oStylesWriter;
|
||||
|
||||
if(pWriter->m_strStyleMain.empty())
|
||||
{
|
||||
if (spPr.xfrm.is_init())
|
||||
oStylesWriter.WriteAttributeCSS (L"position", L"absolute");
|
||||
if (in_group)
|
||||
{
|
||||
if (spPr.xfrm->offX.is_init())
|
||||
dL = (*spPr.xfrm->offX) / 12700.;
|
||||
if (spPr.xfrm->offY.is_init())
|
||||
dT = (*spPr.xfrm->offY) / 12700.;
|
||||
if (spPr.xfrm->extX.is_init())
|
||||
dW = (*spPr.xfrm->extX) / 12700.;
|
||||
if (spPr.xfrm->extY.is_init())
|
||||
dH = (*spPr.xfrm->extY) / 12700.;
|
||||
oStylesWriter.WriteAttributeCSS_int(L"left", dL / 100);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"top", dT / 100);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"width", dW / 100);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"height", dH / 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL / 12700);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT / 12700);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW / 12700);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH / 12700);
|
||||
}
|
||||
|
||||
oStylesWriter.WriteAttributeCSS (_T("position"), _T("absolute"));
|
||||
oStylesWriter.WriteAttributeCSS_int_pt (_T("left"), dL);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt (_T("top"), dT);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt (_T("width"), dW);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt (_T("height"), dH);
|
||||
}
|
||||
|
||||
if (spPr.xfrm.is_init())
|
||||
@ -598,21 +601,21 @@ namespace PPTX
|
||||
if (spPr.xfrm->rot.is_init())
|
||||
{
|
||||
int nRot = (int)((double)(*(spPr.xfrm->rot)) / 60000.0);
|
||||
oStylesWriter.WriteAttributeCSS_int(_T("rotation"), nRot);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"rotation", nRot);
|
||||
}
|
||||
bool bIsFH = spPr.xfrm->flipH.get_value_or(false);
|
||||
bool bIsFV = spPr.xfrm->flipV.get_value_or(false);
|
||||
if (bIsFH && bIsFV)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("xy"));
|
||||
oStylesWriter.WriteAttributeCSS(L"flip", L"xy");
|
||||
}
|
||||
else if (bIsFH)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("x"));
|
||||
oStylesWriter.WriteAttributeCSS(L"flip", L"x");
|
||||
}
|
||||
else if (bIsFV)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("y"));
|
||||
oStylesWriter.WriteAttributeCSS(L"flip", L"y");
|
||||
}
|
||||
}
|
||||
|
||||
@ -631,32 +634,38 @@ namespace PPTX
|
||||
|
||||
spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH);
|
||||
|
||||
pWriter->StartNode(_T("v:shape"));
|
||||
pWriter->StartNode(L"v:shape");
|
||||
|
||||
if (XMLWRITER_DOC_TYPE_XLSX == pWriter->m_lDocType)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("id"), strSpid);
|
||||
pWriter->WriteAttribute(L"id", strSpid);
|
||||
}
|
||||
else
|
||||
{
|
||||
pWriter->WriteAttribute(_T("id"), strId);
|
||||
pWriter->WriteAttribute(_T("o:spid"), strSpid);
|
||||
pWriter->WriteAttribute(L"id", strId);
|
||||
pWriter->WriteAttribute(L"o:spid", strSpid);
|
||||
}
|
||||
|
||||
pWriter->StartAttributes();
|
||||
if (oStylesWriter.GetSize() == 0)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain);
|
||||
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain);
|
||||
}
|
||||
else
|
||||
{
|
||||
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
|
||||
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
|
||||
}
|
||||
|
||||
if(!bOle)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("coordsize"), (std::wstring)_T("100000,100000"));
|
||||
pWriter->WriteAttribute(_T("path"), strPath);
|
||||
oStylesWriter.ClearNoAttack();
|
||||
oStylesWriter.m_oWriter.AddSize(30);
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dW / 100);
|
||||
oStylesWriter.m_oWriter.AddCharNoCheck(WCHAR(','));
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dH / 100);
|
||||
pWriter->WriteAttribute(L"coordsize", oStylesWriter.GetXmlString());
|
||||
|
||||
pWriter->WriteAttribute(L"path", strPath);
|
||||
}
|
||||
|
||||
if (!pWriter->m_strAttributesMain.empty())
|
||||
@ -666,12 +675,12 @@ namespace PPTX
|
||||
}
|
||||
if(bOle)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("filled"), (std::wstring)L"f");
|
||||
pWriter->WriteAttribute(L"filled", L"f");
|
||||
}
|
||||
std::wstring strNodeVal = _T("");
|
||||
std::wstring strNodeVal;
|
||||
if (!spPr.ln.is_init())
|
||||
{
|
||||
pWriter->WriteAttribute(_T("stroked"), (std::wstring)_T("false"));
|
||||
pWriter->WriteAttribute(L"stroked", L"false");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -683,76 +692,76 @@ namespace PPTX
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(_T("v:path"));
|
||||
pWriter->StartNode(L"v:path");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("textboxrect"), strTextRect);
|
||||
pWriter->WriteAttribute(L"textboxrect", strTextRect);
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(_T("v:path"));
|
||||
pWriter->EndNode(L"v:path");
|
||||
|
||||
if (blipFill.blip.is_init() && blipFill.blip->embed.is_init())
|
||||
{
|
||||
pWriter->StartNode(_T("v:imagedata"));
|
||||
pWriter->StartNode(L"v:imagedata");
|
||||
pWriter->StartAttributes();
|
||||
if (XMLWRITER_DOC_TYPE_XLSX == pWriter->m_lDocType)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("o:relid"), blipFill.blip->embed->ToString());
|
||||
pWriter->WriteAttribute(L"o:relid", blipFill.blip->embed->ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
pWriter->WriteAttribute(_T("r:id"), blipFill.blip->embed->ToString());
|
||||
pWriter->WriteAttribute(L"r:id", blipFill.blip->embed->ToString());
|
||||
}
|
||||
pWriter->WriteAttribute(_T("o:title"), std::wstring(_T("")));
|
||||
pWriter->WriteAttribute(L"o:title", L"");
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(_T("v:imagedata"));
|
||||
pWriter->EndNode(L"v:imagedata");
|
||||
}
|
||||
|
||||
pWriter->EndNode(_T("v:shape"));
|
||||
pWriter->EndNode(L"v:shape");
|
||||
}
|
||||
else
|
||||
{
|
||||
pWriter->StartNode(_T("v:rect"));
|
||||
pWriter->StartNode(L"v:rect");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
|
||||
if (XMLWRITER_DOC_TYPE_XLSX == pWriter->m_lDocType)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("id"), strSpid);
|
||||
pWriter->WriteAttribute(L"id", strSpid);
|
||||
}
|
||||
else
|
||||
{
|
||||
pWriter->WriteAttribute(_T("id"), strId);
|
||||
pWriter->WriteAttribute(_T("o:spid"), strSpid);
|
||||
pWriter->WriteAttribute(L"id", strId);
|
||||
pWriter->WriteAttribute(L"o:spid", strSpid);
|
||||
}
|
||||
|
||||
if (oStylesWriter.GetSize() == 0)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain);
|
||||
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain);
|
||||
}
|
||||
else
|
||||
{
|
||||
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
|
||||
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
|
||||
}
|
||||
if(bOle)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("filled"), L"f");
|
||||
pWriter->WriteAttribute(_T("stroked"), L"f");
|
||||
pWriter->WriteAttribute(L"filled", L"f");
|
||||
pWriter->WriteAttribute(L"stroked", L"f");
|
||||
}
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
if (blipFill.blip.is_init() && blipFill.blip->embed.is_init())
|
||||
{
|
||||
pWriter->StartNode(_T("v:imagedata"));
|
||||
pWriter->StartNode(L"v:imagedata");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("r:id"), blipFill.blip->embed->ToString());
|
||||
pWriter->WriteAttribute(_T("o:title"), std::wstring(_T("")));
|
||||
pWriter->WriteAttribute(L"r:id", blipFill.blip->embed->ToString());
|
||||
pWriter->WriteAttribute(L"o:title", L"");
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(_T("v:imagedata"));
|
||||
pWriter->EndNode(L"v:imagedata");
|
||||
}
|
||||
|
||||
pWriter->EndNode(_T("v:rect"));
|
||||
pWriter->EndNode(L"v:rect");
|
||||
}
|
||||
pWriter->m_strStyleMain = _T("");
|
||||
pWriter->m_strStyleMain.clear();
|
||||
|
||||
if(bOle)
|
||||
{
|
||||
@ -783,12 +792,12 @@ namespace PPTX
|
||||
int imgW = node.GetAttributeInt(std::wstring(L"imgW"), 0);
|
||||
if(imgW > 0)
|
||||
{
|
||||
oleObject->m_oDxaOrig = Emu_To_Twips(imgW);
|
||||
oleObject->m_oDxaOrig = (int)Emu_To_Twips(imgW);
|
||||
}
|
||||
int imgH = node.GetAttributeInt(std::wstring(L"imgH"), 0);
|
||||
if(imgH > 0)
|
||||
{
|
||||
oleObject->m_oDyaOrig = Emu_To_Twips(imgH);
|
||||
oleObject->m_oDyaOrig = (int)Emu_To_Twips(imgH);
|
||||
}
|
||||
if(oleObject->m_oId.IsInit())
|
||||
{
|
||||
|
||||
@ -399,7 +399,7 @@ namespace PPTX
|
||||
pReader->Seek(_end_rec);
|
||||
}
|
||||
|
||||
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
|
||||
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group = false);
|
||||
void fromXMLOle(XmlUtils::CXmlNode& node);
|
||||
public:
|
||||
|
||||
|
||||
@ -569,24 +569,38 @@ namespace PPTX
|
||||
}
|
||||
}
|
||||
|
||||
void Shape::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap)
|
||||
void Shape::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group)
|
||||
{
|
||||
std::wstring strPath = _T("");
|
||||
std::wstring strTextRect = _T("");
|
||||
std::wstring strPath, strTextRect;
|
||||
bool bOle = false;
|
||||
OOX::Vml::SptType vmlPrst = OOX::Vml::sptNotPrimitive;
|
||||
|
||||
LONG lW = 43200, lH = 43200;
|
||||
int dL = 0, dT = 0, dW = 0, dH = 0;
|
||||
|
||||
if (spPr.Geometry.is<PrstGeom>())
|
||||
{
|
||||
const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as<PPTX::Logic::PrstGeom>();
|
||||
|
||||
SimpleTypes::CShapeType<> ooxPrst = SimpleTypes::CShapeType<>(lpGeom.prst.get());
|
||||
vmlPrst = Spt2ShapeType( ooxPrst.GetValue());
|
||||
}
|
||||
|
||||
LONG lW = 43200;
|
||||
LONG lH = 43200;
|
||||
if (spPr.xfrm.is_init())
|
||||
{
|
||||
if (spPr.xfrm->offX.is_init()) dL = *spPr.xfrm->offX;
|
||||
if (spPr.xfrm->offY.is_init()) dT = *spPr.xfrm->offY;
|
||||
if (spPr.xfrm->extX.is_init()) dW = *spPr.xfrm->extX;
|
||||
if (spPr.xfrm->extY.is_init()) dH = *spPr.xfrm->extY;
|
||||
|
||||
lW = spPr.xfrm->extX.get_value_or(43200);
|
||||
lH = spPr.xfrm->extY.get_value_or(43200);
|
||||
}
|
||||
bool bOle = false;
|
||||
|
||||
spPr.Geometry.ConvertToCustomVML(pWriter->m_pOOXToVMLRenderer, strPath, strTextRect, lW, lH);
|
||||
|
||||
std::wstring strId = L"shape " + std::to_wstring(pWriter->m_lObjectIdVML);
|
||||
std::wstring strSpid = L"_x" + std::to_wstring(0xFFFF & (pWriter->m_lObjectIdVML >> 16)) + L"_s" + std::to_wstring(0xFFFF & pWriter->m_lObjectIdVML);
|
||||
std::wstring strId = L"shape " + std::to_wstring(pWriter->m_lObjectIdVML);
|
||||
std::wstring strSpid = L"_x" + std::to_wstring(0xFFFF & (pWriter->m_lObjectIdVML >> 16)) + L"_s" + std::to_wstring(0xFFFF & pWriter->m_lObjectIdVML);
|
||||
pWriter->m_lObjectIdVML++;
|
||||
|
||||
std::wstring strFillAttr;
|
||||
@ -594,266 +608,143 @@ namespace PPTX
|
||||
std::wstring strFillNode;
|
||||
std::wstring strStrokeNode;;
|
||||
|
||||
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle);
|
||||
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, bOle);
|
||||
CalculateLine(spPr, style, oTheme, oClrMap, strStrokeAttr, strStrokeNode, bOle);
|
||||
|
||||
if (!pWriter->m_strStyleMain.empty())
|
||||
pWriter->StartNode(L"v:shape");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
|
||||
pWriter->WriteAttribute(L"id", strId);
|
||||
pWriter->WriteAttribute(L"o:spid", strSpid);
|
||||
|
||||
if (vmlPrst != OOX::Vml::sptNotPrimitive)
|
||||
pWriter->WriteAttribute(L"o:spt", (int)vmlPrst);
|
||||
|
||||
NSBinPptxRW::CXmlWriter oStylesWriter;
|
||||
if (pWriter->m_strStyleMain.empty())
|
||||
{
|
||||
pWriter->StartNode(L"v:shape");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
|
||||
pWriter->WriteAttribute(L"id", strId);
|
||||
pWriter->WriteAttribute(L"o:spid", strSpid);
|
||||
|
||||
if (spPr.Geometry.is<PrstGeom>())
|
||||
oStylesWriter.WriteAttributeCSS(L"position", L"absolute");
|
||||
if (in_group)
|
||||
{
|
||||
const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as<PPTX::Logic::PrstGeom>();
|
||||
|
||||
SimpleTypes::CShapeType<> ooxPrst = SimpleTypes::CShapeType<>(lpGeom.prst.get());
|
||||
OOX::Vml::SptType vmlPrst = Spt2ShapeType( ooxPrst.GetValue());
|
||||
|
||||
if (vmlPrst != OOX::Vml::sptNotPrimitive)
|
||||
pWriter->WriteAttribute(L"o:spt", (int)vmlPrst);
|
||||
}
|
||||
|
||||
NSBinPptxRW::CXmlWriter oStylesWriter;
|
||||
if (spPr.xfrm.is_init())
|
||||
{
|
||||
if (spPr.xfrm->rot.is_init())
|
||||
{
|
||||
int nRot = (int)((double)(*(spPr.xfrm->rot)) / 60000.0);
|
||||
oStylesWriter.WriteAttributeCSS_int(_T("rotation"), nRot);
|
||||
}
|
||||
bool bIsFH = spPr.xfrm->flipH.get_value_or(false);
|
||||
bool bIsFV = spPr.xfrm->flipV.get_value_or(false);
|
||||
if (bIsFH && bIsFV)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("xy"));
|
||||
}
|
||||
else if (bIsFH)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("x"));
|
||||
}
|
||||
else if (bIsFV)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("y"));
|
||||
}
|
||||
}
|
||||
|
||||
if (txBody.is_init())
|
||||
{
|
||||
if (txBody->bodyPr.anchor.is_init())
|
||||
{
|
||||
std::wstring _strAnchor = txBody->bodyPr.anchor->get();
|
||||
if (_strAnchor == _T("t"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("top"));
|
||||
else if (_strAnchor == _T("b"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("bottom"));
|
||||
else if (_strAnchor == _T("ctr"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("middle"));
|
||||
}
|
||||
}
|
||||
else if (TextBoxBodyPr.is_init())
|
||||
{
|
||||
if (TextBoxBodyPr->anchor.is_init())
|
||||
{
|
||||
std::wstring _strAnchor = TextBoxBodyPr->anchor->get();
|
||||
if (_strAnchor == _T("t"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("top"));
|
||||
else if (_strAnchor == _T("b"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("bottom"));
|
||||
else if (_strAnchor == _T("ctr"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("middle"));
|
||||
}
|
||||
}
|
||||
|
||||
if (oStylesWriter.GetSize() == 0)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"left", dL / 100);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"top", dT / 100);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"width", dW / 100);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"height", dH / 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
pWriter->WriteAttribute(_T("style"), pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL / 12700);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT / 12700);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW / 12700);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH / 12700);
|
||||
}
|
||||
if(!bOle)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("coordsize"), (std::wstring)_T("100000,100000"));
|
||||
pWriter->WriteAttribute(_T("path"), strPath);
|
||||
}
|
||||
|
||||
if (!pWriter->m_strAttributesMain.empty())
|
||||
{
|
||||
pWriter->WriteString(pWriter->m_strAttributesMain);
|
||||
pWriter->m_strAttributesMain.clear();
|
||||
}
|
||||
|
||||
pWriter->WriteString(strFillAttr);
|
||||
pWriter->WriteString(strStrokeAttr);
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(_T("v:path"));
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("textboxrect"), strTextRect);
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(_T("v:path"));
|
||||
|
||||
pWriter->WriteString(strFillNode);
|
||||
pWriter->WriteString(strStrokeNode);
|
||||
pWriter->WriteString(pWriter->m_strNodes);
|
||||
pWriter->m_strNodes = _T("");
|
||||
|
||||
if (TextBoxShape.is_init())
|
||||
{
|
||||
pWriter->StartNode(_T("v:textbox"));
|
||||
pWriter->EndAttributes();
|
||||
pWriter->WriteString(*TextBoxShape);
|
||||
pWriter->EndNode(_T("v:textbox"));
|
||||
}
|
||||
|
||||
pWriter->EndNode(_T("v:shape"));
|
||||
|
||||
pWriter->m_strStyleMain = _T("");
|
||||
}
|
||||
else
|
||||
if (spPr.xfrm.is_init())
|
||||
{
|
||||
int dL = 0;
|
||||
int dT = 0;
|
||||
int dW = 0;
|
||||
int dH = 0;
|
||||
|
||||
NSBinPptxRW::CXmlWriter oStylesWriter;
|
||||
if (spPr.xfrm.is_init())
|
||||
if (spPr.xfrm->rot.is_init())
|
||||
{
|
||||
if (spPr.xfrm->offX.is_init())
|
||||
dL = (*spPr.xfrm->offX) / 12700.;
|
||||
if (spPr.xfrm->offY.is_init())
|
||||
dT = (*spPr.xfrm->offY) / 12700.;
|
||||
if (spPr.xfrm->extX.is_init())
|
||||
dW = (*spPr.xfrm->extX) / 12700.;
|
||||
if (spPr.xfrm->extY.is_init())
|
||||
dH = (*spPr.xfrm->extY / 12700.);
|
||||
int nRot = (int)((double)(*(spPr.xfrm->rot)) / 60000.0);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"rotation", nRot);
|
||||
}
|
||||
oStylesWriter.WriteAttributeCSS(L"position", L"absolute");
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH);
|
||||
|
||||
if (spPr.xfrm.is_init())
|
||||
bool bIsFH = spPr.xfrm->flipH.get_value_or(false);
|
||||
bool bIsFV = spPr.xfrm->flipV.get_value_or(false);
|
||||
if (bIsFH && bIsFV)
|
||||
{
|
||||
if (spPr.xfrm->rot.is_init())
|
||||
{
|
||||
int nRot = (int)((double)(*(spPr.xfrm->rot)) / 60000.0);
|
||||
oStylesWriter.WriteAttributeCSS_int(_T("rotation"), nRot);
|
||||
}
|
||||
bool bIsFH = spPr.xfrm->flipH.get_value_or(false);
|
||||
bool bIsFV = spPr.xfrm->flipV.get_value_or(false);
|
||||
if (bIsFH && bIsFV)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("xy"));
|
||||
}
|
||||
else if (bIsFH)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("x"));
|
||||
}
|
||||
else if (bIsFV)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS(_T("flip"), _T("y"));
|
||||
}
|
||||
oStylesWriter.WriteAttributeCSS(L"flip", L"xy");
|
||||
}
|
||||
|
||||
if (txBody.is_init())
|
||||
else if (bIsFH)
|
||||
{
|
||||
if (txBody->bodyPr.anchor.is_init())
|
||||
{
|
||||
std::wstring _strAnchor = txBody->bodyPr.anchor->get();
|
||||
if (_strAnchor == _T("t"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("top"));
|
||||
else if (_strAnchor == _T("b"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("bottom"));
|
||||
else if (_strAnchor == _T("ctr"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("middle"));
|
||||
}
|
||||
oStylesWriter.WriteAttributeCSS(L"flip", L"x");
|
||||
}
|
||||
else if (TextBoxBodyPr.is_init())
|
||||
else if (bIsFV)
|
||||
{
|
||||
if (TextBoxBodyPr->anchor.is_init())
|
||||
{
|
||||
std::wstring _strAnchor = TextBoxBodyPr->anchor->get();
|
||||
if (_strAnchor == _T("t"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("top"));
|
||||
else if (_strAnchor == _T("b"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("bottom"));
|
||||
else if (_strAnchor == _T("ctr"))
|
||||
oStylesWriter.WriteAttributeCSS(_T("v-text-anchor"), _T("middle"));
|
||||
}
|
||||
oStylesWriter.WriteAttributeCSS(L"flip", L"y");
|
||||
}
|
||||
|
||||
pWriter->StartNode(_T("v:shape"));
|
||||
|
||||
pWriter->StartAttributes();
|
||||
|
||||
pWriter->WriteAttribute(_T("id"), strId);
|
||||
pWriter->WriteAttribute(_T("o:spid"), strSpid);
|
||||
|
||||
if (spPr.Geometry.is<PrstGeom>())
|
||||
{
|
||||
const PPTX::Logic::PrstGeom & lpGeom = spPr.Geometry.as<PPTX::Logic::PrstGeom>();
|
||||
|
||||
SimpleTypes::CShapeType<> ooxPrst = SimpleTypes::CShapeType<>(lpGeom.prst.get());
|
||||
OOX::Vml::SptType vmlPrst = Spt2ShapeType( ooxPrst.GetValue());
|
||||
|
||||
if (vmlPrst != OOX::Vml::sptNotPrimitive)
|
||||
pWriter->WriteAttribute(L"o:spt", (int)vmlPrst);
|
||||
}
|
||||
pWriter->WriteAttribute(_T("style"), oStylesWriter.GetXmlString());
|
||||
|
||||
if(!bOle)
|
||||
{
|
||||
pWriter->WriteAttribute(_T("coordsize"), (std::wstring)_T("100000,100000"));
|
||||
pWriter->WriteAttribute(_T("path"), strPath);
|
||||
}
|
||||
|
||||
if (!pWriter->m_strAttributesMain.empty())
|
||||
{
|
||||
pWriter->WriteString(pWriter->m_strAttributesMain);
|
||||
pWriter->m_strAttributesMain.clear();
|
||||
}
|
||||
|
||||
pWriter->WriteString(strFillAttr);
|
||||
pWriter->WriteString(strStrokeAttr);
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(_T("v:path"));
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(_T("textboxrect"), strTextRect);
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(_T("v:path"));
|
||||
|
||||
pWriter->WriteString(strFillNode);
|
||||
pWriter->WriteString(strStrokeNode);
|
||||
|
||||
if (TextBoxShape.is_init())
|
||||
{
|
||||
pWriter->StartNode(_T("v:textbox"));
|
||||
pWriter->EndAttributes();
|
||||
pWriter->WriteString(*TextBoxShape);
|
||||
pWriter->EndNode(_T("v:textbox"));
|
||||
}
|
||||
|
||||
pWriter->EndNode(_T("v:shape"));
|
||||
}
|
||||
|
||||
if (txBody.is_init())
|
||||
{
|
||||
if (txBody->bodyPr.anchor.is_init())
|
||||
{
|
||||
std::wstring _strAnchor = txBody->bodyPr.anchor->get();
|
||||
if (_strAnchor == L"t")
|
||||
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"top");
|
||||
else if (_strAnchor == L"b")
|
||||
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"bottom");
|
||||
else if (_strAnchor == L"ctr")
|
||||
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"middle");
|
||||
}
|
||||
}
|
||||
else if (TextBoxBodyPr.is_init())
|
||||
{
|
||||
if (TextBoxBodyPr->anchor.is_init())
|
||||
{
|
||||
std::wstring _strAnchor = TextBoxBodyPr->anchor->get();
|
||||
if (_strAnchor == L"t")
|
||||
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"top");
|
||||
else if (_strAnchor == L"b")
|
||||
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"bottom");
|
||||
else if (_strAnchor == _T("ctr"))
|
||||
oStylesWriter.WriteAttributeCSS(L"v-text-anchor", L"middle");
|
||||
}
|
||||
}
|
||||
|
||||
pWriter->WriteAttribute(L"style", pWriter->m_strStyleMain + oStylesWriter.GetXmlString());
|
||||
|
||||
if(!bOle)
|
||||
{
|
||||
oStylesWriter.ClearNoAttack();
|
||||
oStylesWriter.m_oWriter.AddSize(30);
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dW / 100);
|
||||
oStylesWriter.m_oWriter.AddCharNoCheck(WCHAR(','));
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dH / 100);
|
||||
pWriter->WriteAttribute(L"coordsize", oStylesWriter.GetXmlString());
|
||||
|
||||
pWriter->WriteAttribute(L"path", strPath);
|
||||
}
|
||||
|
||||
if (!pWriter->m_strAttributesMain.empty())
|
||||
{
|
||||
pWriter->WriteString(pWriter->m_strAttributesMain);
|
||||
pWriter->m_strAttributesMain.clear();
|
||||
}
|
||||
|
||||
pWriter->WriteString(strFillAttr);
|
||||
pWriter->WriteString(strStrokeAttr);
|
||||
|
||||
pWriter->EndAttributes();
|
||||
|
||||
pWriter->StartNode(L"v:path");
|
||||
pWriter->StartAttributes();
|
||||
pWriter->WriteAttribute(L"textboxrect", strTextRect);
|
||||
pWriter->EndAttributes();
|
||||
pWriter->EndNode(L"v:path");
|
||||
|
||||
pWriter->WriteString(strFillNode);
|
||||
pWriter->WriteString(strStrokeNode);
|
||||
|
||||
pWriter->WriteString(pWriter->m_strNodes);
|
||||
pWriter->m_strNodes.clear();
|
||||
|
||||
if (TextBoxShape.is_init())
|
||||
{
|
||||
pWriter->StartNode(L"v:textbox");
|
||||
pWriter->EndAttributes();
|
||||
pWriter->WriteString(*TextBoxShape);
|
||||
pWriter->EndNode(L"v:textbox");
|
||||
}
|
||||
|
||||
pWriter->EndNode(L"v:shape");
|
||||
|
||||
pWriter->m_strStyleMain.clear();
|
||||
}
|
||||
void Shape::toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap)
|
||||
{
|
||||
std::wstring strFillAttr = _T("");
|
||||
std::wstring strFillNode = _T("");
|
||||
std::wstring strFillAttr, strFillNode;
|
||||
CalculateFill(spPr, style, oTheme, oClrMap, strFillAttr, strFillNode, false);
|
||||
|
||||
pWriter->StartNode(_T("v:background"));
|
||||
pWriter->StartNode(L"v:background");
|
||||
|
||||
pWriter->StartAttributes();
|
||||
|
||||
@ -871,7 +762,7 @@ namespace PPTX
|
||||
|
||||
pWriter->WriteString(strFillNode);
|
||||
|
||||
pWriter->EndNode(_T("v:background"));
|
||||
pWriter->EndNode(L"v:background");
|
||||
}
|
||||
} // namespace Logic
|
||||
} // namespace PPTX
|
||||
|
||||
@ -136,7 +136,7 @@ namespace PPTX
|
||||
pWriter->EndRecord();
|
||||
}
|
||||
|
||||
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
|
||||
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group = false);
|
||||
void toXmlWriterVMLBackground(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
|
||||
@ -119,7 +119,8 @@ namespace PPTX
|
||||
if ((pDiagramDrawing) && (pDiagramDrawing->m_oShapeTree.IsInit()))
|
||||
{
|
||||
m_diag = pDiagramDrawing->m_oShapeTree;
|
||||
m_oCommonRels = smart_ptr<PPTX::CCommonRels>(dynamic_cast<PPTX::CCommonRels*>(pDiagramDrawing));
|
||||
m_oCommonRels = smart_ptr<PPTX::CCommonRels>( new PPTX::CCommonRels());
|
||||
m_oCommonRels->_read(pDiagramDrawing->m_oReadPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -41,7 +41,7 @@ namespace PPTX
|
||||
{
|
||||
namespace Logic
|
||||
{
|
||||
void SpTree::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap)
|
||||
void SpTree::toXmlWriterVML(NSBinPptxRW::CXmlWriter *pWriter, NSCommon::smart_ptr<PPTX::WrapperFile>& _oTheme, NSCommon::smart_ptr<PPTX::WrapperWritingElement>& _oClrMap, bool in_group)
|
||||
{
|
||||
smart_ptr<PPTX::Theme> oTheme = _oTheme.smart_dynamic_cast<PPTX::Theme>();
|
||||
smart_ptr<PPTX::Logic::ClrMap> oClrMap = oTheme.smart_dynamic_cast<PPTX::Logic::ClrMap>();
|
||||
@ -95,28 +95,31 @@ namespace PPTX
|
||||
}
|
||||
else
|
||||
{
|
||||
int dL = 0;
|
||||
int dT = 0;
|
||||
int dW = 0;
|
||||
int dH = 0;
|
||||
int dL = 0, dT = 0, dW = 0, dH = 0;
|
||||
if (grpSpPr.xfrm.is_init())
|
||||
{
|
||||
if (grpSpPr.xfrm->offX.is_init())
|
||||
dL = (*grpSpPr.xfrm->offX) / 12700.;
|
||||
if (grpSpPr.xfrm->offY.is_init())
|
||||
dT = (*grpSpPr.xfrm->offY) / 12700.;
|
||||
if (grpSpPr.xfrm->extX.is_init())
|
||||
dW = (*grpSpPr.xfrm->extX) / 12700.;
|
||||
if (grpSpPr.xfrm->extY.is_init())
|
||||
dH = (*grpSpPr.xfrm->extY) / 12700.;
|
||||
if (grpSpPr.xfrm->offX.is_init()) dL = *grpSpPr.xfrm->offX;
|
||||
if (grpSpPr.xfrm->offY.is_init()) dT = *grpSpPr.xfrm->offY;
|
||||
if (grpSpPr.xfrm->extX.is_init()) dW = *grpSpPr.xfrm->extX;
|
||||
if (grpSpPr.xfrm->extY.is_init()) dH = *grpSpPr.xfrm->extY;
|
||||
}
|
||||
|
||||
oStylesWriter.ClearNoAttack();
|
||||
oStylesWriter.WriteAttributeCSS(L"position", L"absolute");
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH);
|
||||
if (in_group)
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS_int(L"left", dL / 100.);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"top", dT / 100.);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"width", dW / 100.);
|
||||
oStylesWriter.WriteAttributeCSS_int(L"height", dH / 100.);
|
||||
}
|
||||
else
|
||||
{
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"left", dL / 12700.);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"top", dT / 12700.);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"width", dW / 12700.);
|
||||
oStylesWriter.WriteAttributeCSS_int_pt(L"height", dH / 12700.);
|
||||
}
|
||||
|
||||
if (grpSpPr.xfrm.is_init())
|
||||
{
|
||||
@ -150,33 +153,27 @@ namespace PPTX
|
||||
pWriter->m_strAttributesMain.clear();
|
||||
}
|
||||
|
||||
int dL = 0;
|
||||
int dT = 0;
|
||||
int dW = 0;
|
||||
int dH = 0;
|
||||
int dL = 0, dT = 0, dW = 0, dH = 0;
|
||||
|
||||
if (grpSpPr.xfrm.is_init())
|
||||
{
|
||||
if (grpSpPr.xfrm->chOffX.is_init())
|
||||
dL = (*grpSpPr.xfrm->chOffX) / 12700.;
|
||||
if (grpSpPr.xfrm->chOffY.is_init())
|
||||
dT = (*grpSpPr.xfrm->chOffY) / 12700.;
|
||||
if (grpSpPr.xfrm->chExtX.is_init())
|
||||
dW = (*grpSpPr.xfrm->chExtX) / 12700.;
|
||||
if (grpSpPr.xfrm->chExtY.is_init())
|
||||
dH = (*grpSpPr.xfrm->chExtY) / 12700.;
|
||||
if (grpSpPr.xfrm->chOffX.is_init()) dL = *grpSpPr.xfrm->chOffX;
|
||||
if (grpSpPr.xfrm->chOffY.is_init()) dT = *grpSpPr.xfrm->chOffY;
|
||||
if (grpSpPr.xfrm->chExtX.is_init()) dW = *grpSpPr.xfrm->chExtX;
|
||||
if (grpSpPr.xfrm->chExtY.is_init()) dH = *grpSpPr.xfrm->chExtY;
|
||||
}
|
||||
oStylesWriter.ClearNoAttack();
|
||||
oStylesWriter.m_oWriter.AddSize(30);
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dL);
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dL / 100.);
|
||||
oStylesWriter.m_oWriter.AddCharNoCheck(WCHAR(','));
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dT);
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dT / 100.);
|
||||
pWriter->WriteAttribute(_T("coordorigin"), oStylesWriter.GetXmlString());
|
||||
|
||||
oStylesWriter.ClearNoAttack();
|
||||
oStylesWriter.m_oWriter.AddSize(30);
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dW);
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dW / 100.);
|
||||
oStylesWriter.m_oWriter.AddCharNoCheck(WCHAR(','));
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dH);
|
||||
oStylesWriter.m_oWriter.AddIntNoCheck(dH / 100.);
|
||||
pWriter->WriteAttribute(_T("coordsize"), oStylesWriter.GetXmlString());
|
||||
|
||||
pWriter->EndAttributes();
|
||||
@ -186,15 +183,15 @@ namespace PPTX
|
||||
{
|
||||
if (SpTreeElems[i].is<PPTX::Logic::Shape>())
|
||||
{
|
||||
SpTreeElems[i].as<PPTX::Logic::Shape>().toXmlWriterVML(pWriter, _oTheme, _oClrMap);
|
||||
SpTreeElems[i].as<PPTX::Logic::Shape>().toXmlWriterVML(pWriter, _oTheme, _oClrMap, true);
|
||||
}
|
||||
else if (SpTreeElems[i].is<PPTX::Logic::Pic>())
|
||||
{
|
||||
SpTreeElems[i].as<PPTX::Logic::Pic>().toXmlWriterVML(pWriter, _oTheme, _oClrMap);
|
||||
SpTreeElems[i].as<PPTX::Logic::Pic>().toXmlWriterVML(pWriter, _oTheme, _oClrMap, true);
|
||||
}
|
||||
else if (SpTreeElems[i].is<PPTX::Logic::SpTree>())
|
||||
{
|
||||
SpTreeElems[i].as<PPTX::Logic::SpTree>().toXmlWriterVML(pWriter, _oTheme, _oClrMap);
|
||||
SpTreeElems[i].as<PPTX::Logic::SpTree>().toXmlWriterVML(pWriter, _oTheme, _oClrMap, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -121,7 +121,7 @@ namespace PPTX
|
||||
return XmlUtils::CreateNode(m_name, oValue);
|
||||
}
|
||||
|
||||
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap);
|
||||
void toXmlWriterVML(NSBinPptxRW::CXmlWriter* pWriter, smart_ptr<PPTX::WrapperFile>& oTheme, smart_ptr<PPTX::WrapperWritingElement>& oClrMap, bool in_group = false);
|
||||
|
||||
virtual void toXmlWriter(NSBinPptxRW::CXmlWriter* pWriter) const
|
||||
{
|
||||
|
||||
@ -2288,6 +2288,7 @@
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
CXIMAGE_DONT_DECLARE_TCHAR,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
@ -2329,6 +2330,7 @@
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
CXIMAGE_DONT_DECLARE_TCHAR,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
|
||||
@ -546,6 +546,7 @@
|
||||
USE_LITE_READER,
|
||||
PPT_DEF,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -577,6 +578,7 @@
|
||||
USE_LITE_READER,
|
||||
PPT_DEF,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
||||
@ -1140,7 +1140,7 @@ bool RtfTableCellPropsCommand::ExecuteCommand(RtfDocument& oDocument, RtfReader&
|
||||
}
|
||||
}
|
||||
COMMAND_RTF_INT ( "clwWidth", cellProps->m_nWidth, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clhidemark",cellProps->m_bHideMark, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_BOOL( "clhidemark", cellProps->m_bHideMark, sCommand, hasParameter, parameter )
|
||||
COMMAND_RTF_INT ( "clvertalt", cellProps->m_eAlign, sCommand, true, RtfCellProperty::ca_Top )
|
||||
COMMAND_RTF_INT ( "clvertalc", cellProps->m_eAlign, sCommand, true, RtfCellProperty::ca_Center )
|
||||
COMMAND_RTF_INT ( "clvertalb", cellProps->m_eAlign, sCommand, true, RtfCellProperty::ca_Bottom )
|
||||
@ -1930,13 +1930,13 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt
|
||||
else if ( L"fLine" == m_sPropName ) m_oShape.m_bLine = ( 0 == nValue ? false : true );
|
||||
else if ( L"lineStartArrowhead" == m_sPropName ) m_oShape.m_nLineStartArrow = nValue;
|
||||
else if ( L"lineColor" == m_sPropName ) m_oShape.m_nLineColor = nValue;
|
||||
else if ( L"lineStartArrowWidth" == m_sPropName ) m_oShape.m_nLineStartArrowWidth= nValue;
|
||||
else if ( L"lineStartArrowWidth" == m_sPropName ) m_oShape.m_nLineStartArrowWidth = nValue;
|
||||
else if ( L"lineStartArrowLength" == m_sPropName ) m_oShape.m_nLineStartArrowLength = nValue;
|
||||
else if ( L"lineEndArrowhead" == m_sPropName ) m_oShape.m_nLineEndArrow = nValue;
|
||||
else if ( L"lineEndArrowhead" == m_sPropName ) m_oShape.m_nLineEndArrow = nValue;
|
||||
else if ( L"lineEndArrowWidth" == m_sPropName ) m_oShape.m_nLineEndArrowWidth = nValue;
|
||||
else if ( L"lineEndArrowLength" == m_sPropName ) m_oShape.m_nLineEndArrowLength = nValue;
|
||||
else if ( L"lineWidth" == m_sPropName ) m_oShape.m_nLineWidth = nValue;
|
||||
else if ( L"lineDashing" == m_sPropName ) m_oShape.m_nLineDashing = nValue;
|
||||
else if ( L"lineDashing" == m_sPropName ) m_oShape.m_nLineDashing = nValue;
|
||||
else if (L"cxstyle" == m_sPropName ) m_oShape.m_nConnectorStyle = nValue;
|
||||
else if (L"cxk" == m_sPropName ) m_oShape.m_nConnectionType = nValue;
|
||||
else
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#include "OOXDrawingGraphicReader.h"
|
||||
|
||||
#include "../../../../ASCOfficePPTXFile/ASCOfficeDrawingConverter.h"
|
||||
#include "../../../../ASCOfficePPTXFile/PPTXFormat/Theme.h"
|
||||
|
||||
bool OOXPictureGraphicReader::Parse( ReaderParameter oParam , RtfShape& oOutput)
|
||||
{
|
||||
@ -89,6 +90,16 @@ OOX::Logic::CPicture * OOXDrawingGraphicReader::Parse( ReaderParameter oParam ,
|
||||
{
|
||||
NSBinPptxRW::CDrawingConverter drawingConverter;
|
||||
|
||||
OOX::CTheme *pTheme = oParam.oDocx->GetTheme();
|
||||
if (pTheme)
|
||||
{
|
||||
NSCommon::smart_ptr<PPTX::Theme> theme(new PPTX::Theme());
|
||||
PPTX::FileMap map;
|
||||
theme->read(pTheme->m_oReadPath, map);
|
||||
|
||||
(*drawingConverter.m_pTheme) = theme.smart_dynamic_cast<PPTX::WrapperFile>();
|
||||
}
|
||||
|
||||
drawingConverter.SetRelsPath(oParam.oDocx->m_pDocument->m_oReadPath.GetPath());
|
||||
|
||||
std::wstring sVmlXml = drawingConverter.ConvertObjectToVml(m_sXml);
|
||||
|
||||
@ -164,7 +164,9 @@ bool OOXTableReader::Parse( ReaderParameter oParam, RtfTable& oOutputTable )
|
||||
for( int i = 0; i < m_ooxTable->m_oTblGrid->m_arrGridCol.size(); i++ )
|
||||
{
|
||||
if (m_ooxTable->m_oTblGrid->m_arrGridCol[i] && m_ooxTable->m_oTblGrid->m_arrGridCol[i]->m_oW.IsInit())
|
||||
oOutputTable.m_aTableGrid.push_back( m_ooxTable->m_oTblGrid->m_arrGridCol[i]->m_oW->ToTwips() );
|
||||
{
|
||||
oOutputTable.m_aTableGrid.push_back( m_ooxTable->m_oTblGrid->m_arrGridCol[i]->m_oW->ToTwips() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -114,8 +114,19 @@ public:
|
||||
|
||||
if( m_ooxTableCellProps->m_oTcW.IsInit() && m_ooxTableCellProps->m_oTcW->m_oW.IsInit())
|
||||
{
|
||||
oOutputProperty.m_nWidth = m_ooxTableCellProps->m_oTcW->m_oW->GetValue();
|
||||
oOutputProperty.m_eWidthUnits = m_ooxTableCellProps->m_oTcW->m_oW->IsPercent() ? mu_Percent : mu_Twips;
|
||||
bool auto_ = false;
|
||||
if (m_ooxTableCellProps->m_oTcW->m_oType.IsInit() && m_ooxTableCellProps->m_oTcW->m_oType->GetValue() == SimpleTypes::tblwidthAuto)
|
||||
auto_ = true;
|
||||
|
||||
if (auto_)
|
||||
{
|
||||
oOutputProperty.m_eWidthUnits = mu_Auto;
|
||||
}
|
||||
else
|
||||
{
|
||||
oOutputProperty.m_nWidth = m_ooxTableCellProps->m_oTcW->m_oW->GetValue();
|
||||
oOutputProperty.m_eWidthUnits = m_ooxTableCellProps->m_oTcW->m_oW->IsPercent() ? mu_Percent : mu_Twips;
|
||||
}
|
||||
}
|
||||
if( m_ooxTableCellProps->m_oHideMark.IsInit())
|
||||
oOutputProperty.m_bHideMark = m_ooxTableCellProps->m_oHideMark->m_oVal.ToBool() ? 1 : 0;
|
||||
|
||||
@ -295,6 +295,7 @@
|
||||
MAC,
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -325,6 +326,7 @@
|
||||
MAC,
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace XLS
|
||||
{
|
||||
|
||||
@ -2417,44 +2417,12 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::
|
||||
|
||||
std::wstring image_path = context_.get_mediaitems().media_path() + drawing_state->fill.texture_target.substr(6);
|
||||
|
||||
int rgbColor1 = STR::hex_str2int(sRgbColor1);
|
||||
int rgbColor2 = STR::hex_str2int(sRgbColor2);
|
||||
size_t rgbColor1 = STR::hex_str2int(sRgbColor1);
|
||||
size_t rgbColor2 = STR::hex_str2int(sRgbColor2);
|
||||
|
||||
CBgraFrame bgraFrame;
|
||||
|
||||
if (bgraFrame.OpenFile(image_path))
|
||||
{
|
||||
int smpl = abs(bgraFrame.get_Stride() / bgraFrame.get_Width());
|
||||
|
||||
BYTE * rgb = bgraFrame.get_Data();
|
||||
|
||||
BYTE R1 = (BYTE)(rgbColor1);
|
||||
BYTE G1 = (BYTE)(rgbColor1 >> 8);
|
||||
BYTE B1 = (BYTE)(rgbColor1 >> 16);
|
||||
|
||||
BYTE R2 = (BYTE)(rgbColor2);
|
||||
BYTE G2 = (BYTE)(rgbColor2 >> 8);
|
||||
BYTE B2 = (BYTE)(rgbColor2 >> 16);
|
||||
|
||||
for (int i = 0 ; i < bgraFrame.get_Width() * bgraFrame.get_Height(); i++)
|
||||
{
|
||||
if (rgb[i * smpl + 0 ] == 0x00 && rgb[i * smpl + 1 ] == 0x00 && rgb[i * smpl + 2 ] == 0x00)
|
||||
{
|
||||
rgb[i * smpl + 0 ] = R1;
|
||||
rgb[i * smpl + 1 ] = G1;
|
||||
rgb[i * smpl + 2 ] = B1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rgb[i * smpl + 0 ] = R2;
|
||||
rgb[i * smpl + 1 ] = G2;
|
||||
rgb[i * smpl + 2 ] = B2;
|
||||
}
|
||||
}
|
||||
bgraFrame.SaveFile(image_path, 1);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return bgraFrame.ReColorPatternImage(image_path, rgbColor1, rgbColor2);
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
|
||||
|
||||
@ -1317,6 +1317,7 @@
|
||||
MAC,
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
@ -1356,6 +1357,7 @@
|
||||
MAC,
|
||||
unix,
|
||||
_IOS,
|
||||
DONT_WRITE_EMBEDDED_FONTS,
|
||||
);
|
||||
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
|
||||
HEADER_SEARCH_PATHS = (
|
||||
|
||||
@ -283,31 +283,31 @@ namespace SimpleTypes
|
||||
{
|
||||
if ( 0 == nType )
|
||||
{
|
||||
switch (this->m_eValue)
|
||||
switch (this->m_eValue)
|
||||
{
|
||||
case filltypeFrame : return _T("frame");
|
||||
case filltypeGradient : return _T("gradient");
|
||||
case filltypeGradientRadial : return _T("gradientRadial");
|
||||
case filltypePattern : return _T("pattern");
|
||||
case filltypeSolid : return _T("solid");
|
||||
case filltypeTile : return _T("tile");
|
||||
default : return _T("solid");
|
||||
case filltypeFrame : return _T("frame");
|
||||
case filltypeGradient : return _T("gradient");
|
||||
case filltypeGradientRadial : return _T("gradientRadial");
|
||||
case filltypePattern : return _T("pattern");
|
||||
case filltypeSolid : return _T("solid");
|
||||
case filltypeTile : return _T("tile");
|
||||
default : return _T("solid");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (this->m_eValue)
|
||||
switch (this->m_eValue)
|
||||
{
|
||||
case filltypeBackground : return _T("background");
|
||||
case filltypeFrame : return _T("frame");
|
||||
case filltypeGradient : return _T("gradient");
|
||||
case filltypeGradientCenter : return _T("gradientCenter");
|
||||
case filltypeGradientRadial : return _T("gradientRadial");
|
||||
case filltypeGradientUnscaled : return _T("gradientUnscaled");
|
||||
case filltypePattern : return _T("pattern");
|
||||
case filltypeSolid : return _T("solid");
|
||||
case filltypeTile : return _T("tile");
|
||||
default : return _T("solid");
|
||||
case filltypeBackground : return _T("background");
|
||||
case filltypeFrame : return _T("frame");
|
||||
case filltypeGradient : return _T("gradient");
|
||||
case filltypeGradientCenter : return _T("gradientCenter");
|
||||
case filltypeGradientRadial : return _T("gradientRadial");
|
||||
case filltypeGradientUnscaled : return _T("gradientUnscaled");
|
||||
case filltypePattern : return _T("pattern");
|
||||
case filltypeSolid : return _T("solid");
|
||||
case filltypeTile : return _T("tile");
|
||||
default : return _T("solid");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -438,13 +438,13 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'l':
|
||||
if ( _T("long") == sValue ) this->m_eValue = strokearrowlengthLong;
|
||||
if ( _T("long") == sValue ) this->m_eValue = strokearrowlengthLong;
|
||||
break;
|
||||
case 'm':
|
||||
if ( _T("medium") == sValue ) this->m_eValue = strokearrowlengthMedium;
|
||||
if ( _T("medium") == sValue ) this->m_eValue = strokearrowlengthMedium;
|
||||
break;
|
||||
case 's':
|
||||
if ( _T("short") == sValue ) this->m_eValue = strokearrowlengthShort;
|
||||
if ( _T("short") == sValue ) this->m_eValue = strokearrowlengthShort;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -455,10 +455,10 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case strokearrowlengthLong : return _T("long");
|
||||
case strokearrowlengthMedium : return _T("medium");
|
||||
case strokearrowlengthShort : return _T("short");
|
||||
default : return _T("medium");
|
||||
case strokearrowlengthLong : return _T("long");
|
||||
case strokearrowlengthMedium : return _T("medium");
|
||||
case strokearrowlengthShort : return _T("short");
|
||||
default : return _T("medium");
|
||||
}
|
||||
}
|
||||
|
||||
@ -563,13 +563,13 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'm':
|
||||
if ( _T("medium") == sValue ) this->m_eValue = strokearrowwidthMedium;
|
||||
if ( _T("medium") == sValue ) this->m_eValue = strokearrowwidthMedium;
|
||||
break;
|
||||
case 'n':
|
||||
if ( _T("narrow") == sValue ) this->m_eValue = strokearrowwidthNarrow;
|
||||
if ( _T("narrow") == sValue ) this->m_eValue = strokearrowwidthNarrow;
|
||||
break;
|
||||
case 'w':
|
||||
if ( _T("wide") == sValue ) this->m_eValue = strokearrowwidthWide;
|
||||
if ( _T("wide") == sValue ) this->m_eValue = strokearrowwidthWide;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -580,10 +580,10 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case strokearrowwidthMedium : return _T("medium");
|
||||
case strokearrowwidthNarrow : return _T("narrow");
|
||||
case strokearrowwidthWide : return _T("wide");
|
||||
default : return _T("medium");
|
||||
case strokearrowwidthMedium : return _T("medium");
|
||||
case strokearrowwidthNarrow : return _T("narrow");
|
||||
case strokearrowwidthWide : return _T("wide");
|
||||
default : return _T("medium");
|
||||
}
|
||||
}
|
||||
|
||||
@ -619,13 +619,13 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'f':
|
||||
if ( _T("flat") == sValue ) this->m_eValue = strokeendcapFlat;
|
||||
if ( _T("flat") == sValue ) this->m_eValue = strokeendcapFlat;
|
||||
break;
|
||||
case 'r':
|
||||
if ( _T("round") == sValue ) this->m_eValue = strokeendcapRound;
|
||||
if ( _T("round") == sValue ) this->m_eValue = strokeendcapRound;
|
||||
break;
|
||||
case 's':
|
||||
if ( _T("square") == sValue ) this->m_eValue = strokeendcapSqaure;
|
||||
if ( _T("square") == sValue ) this->m_eValue = strokeendcapSqaure;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -777,10 +777,10 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'o':
|
||||
if ( _T("officeopenxmlmath") == sValue ) this->m_eValue = alternatemathcontenttypeOfficeOpenXmlMath;
|
||||
if ( _T("officeopenxmlmath") == sValue ) this->m_eValue = alternatemathcontenttypeOfficeOpenXmlMath;
|
||||
break;
|
||||
case 'm':
|
||||
if ( _T("mathml") == sValue ) this->m_eValue = alternatemathcontenttypeMathMl;
|
||||
if ( _T("mathml") == sValue ) this->m_eValue = alternatemathcontenttypeMathMl;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1033,10 +1033,10 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'a':
|
||||
if ( _T("auto") == sValue ) this->m_eValue = colormodeAuto;
|
||||
if ( _T("auto") == sValue ) this->m_eValue = colormodeAuto;
|
||||
break;
|
||||
case 'c':
|
||||
if ( _T("custom") == sValue ) this->m_eValue = colormodeCustom;
|
||||
if ( _T("custom") == sValue ) this->m_eValue = colormodeCustom;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1086,16 +1086,16 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'c':
|
||||
if ( _T("curved") == sValue ) this->m_eValue = connectortypeCurved;
|
||||
if ( _T("curved") == sValue ) this->m_eValue = connectortypeCurved;
|
||||
break;
|
||||
case 'e':
|
||||
if ( _T("elbow") == sValue ) this->m_eValue = connectortypeElbow;
|
||||
if ( _T("elbow") == sValue ) this->m_eValue = connectortypeElbow;
|
||||
break;
|
||||
case 'n':
|
||||
if ( _T("none") == sValue ) this->m_eValue = connectortypeNone;
|
||||
if ( _T("none") == sValue ) this->m_eValue = connectortypeNone;
|
||||
break;
|
||||
case 's':
|
||||
if ( _T("straight") == sValue ) this->m_eValue = connectortypeStraight;
|
||||
if ( _T("straight") == sValue ) this->m_eValue = connectortypeStraight;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1106,11 +1106,11 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case connectortypeCurved : return _T("curved");
|
||||
case connectortypeElbow : return _T("elbow");
|
||||
case connectortypeNone : return _T("none");
|
||||
case connectortypeStraight: return _T("straight");
|
||||
default : return _T("none");
|
||||
case connectortypeCurved : return _T("curved");
|
||||
case connectortypeElbow : return _T("elbow");
|
||||
case connectortypeNone : return _T("none");
|
||||
case connectortypeStraight: return _T("straight");
|
||||
default : return _T("none");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1147,16 +1147,16 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'c':
|
||||
if ( _T("custom") == sValue ) this->m_eValue = connecttypeCustom;
|
||||
if ( _T("custom") == sValue ) this->m_eValue = connecttypeCustom;
|
||||
break;
|
||||
case 'n':
|
||||
if ( _T("none") == sValue ) this->m_eValue = connecttypeNone;
|
||||
if ( _T("none") == sValue ) this->m_eValue = connecttypeNone;
|
||||
break;
|
||||
case 'r':
|
||||
if ( _T("rect") == sValue ) this->m_eValue = connecttypeRect;
|
||||
if ( _T("rect") == sValue ) this->m_eValue = connecttypeRect;
|
||||
break;
|
||||
case 's':
|
||||
if ( _T("segments") == sValue ) this->m_eValue = connecttypeSegments;
|
||||
if ( _T("segments") == sValue ) this->m_eValue = connecttypeSegments;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1167,11 +1167,11 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case connecttypeCustom : return _T("custom");
|
||||
case connecttypeNone : return _T("none");
|
||||
case connecttypeRect : return _T("rect");
|
||||
case connecttypeSegments: return _T("segments");
|
||||
default : return _T("none");
|
||||
case connecttypeCustom : return _T("custom");
|
||||
case connecttypeNone : return _T("none");
|
||||
case connecttypeRect : return _T("rect");
|
||||
case connecttypeSegments: return _T("segments");
|
||||
default : return _T("none");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1247,16 +1247,16 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case '0':
|
||||
if ( _T("0") == sValue ) this->m_eValue = diagramlayout0;
|
||||
if ( _T("0") == sValue ) this->m_eValue = diagramlayout0;
|
||||
break;
|
||||
case '1':
|
||||
if ( _T("1") == sValue ) this->m_eValue = diagramlayout1;
|
||||
if ( _T("1") == sValue ) this->m_eValue = diagramlayout1;
|
||||
break;
|
||||
case '2':
|
||||
if ( _T("2") == sValue ) this->m_eValue = diagramlayout2;
|
||||
if ( _T("2") == sValue ) this->m_eValue = diagramlayout2;
|
||||
break;
|
||||
case '3':
|
||||
if ( _T("3") == sValue ) this->m_eValue = diagramlayout3;
|
||||
if ( _T("3") == sValue ) this->m_eValue = diagramlayout3;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1267,11 +1267,11 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case diagramlayout0 : return _T("0");
|
||||
case diagramlayout1 : return _T("1");
|
||||
case diagramlayout2 : return _T("2");
|
||||
case diagramlayout3 : return _T("3");
|
||||
default : return _T("0");
|
||||
case diagramlayout0 : return _T("0");
|
||||
case diagramlayout1 : return _T("1");
|
||||
case diagramlayout2 : return _T("2");
|
||||
case diagramlayout3 : return _T("3");
|
||||
default : return _T("0");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1307,22 +1307,22 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'X':
|
||||
if ( _T("XY") == sValue ) this->m_eValue = extrusionplaneXY;
|
||||
if ( _T("XY") == sValue ) this->m_eValue = extrusionplaneXY;
|
||||
break;
|
||||
case 'Y':
|
||||
if ( _T("YZ") == sValue ) this->m_eValue = extrusionplaneYZ;
|
||||
if ( _T("YZ") == sValue ) this->m_eValue = extrusionplaneYZ;
|
||||
break;
|
||||
case 'Z':
|
||||
if ( _T("ZX") == sValue ) this->m_eValue = extrusionplaneZX;
|
||||
if ( _T("ZX") == sValue ) this->m_eValue = extrusionplaneZX;
|
||||
break;
|
||||
case 'x':
|
||||
if ( _T("xy") == sValue ) this->m_eValue = extrusionplaneXY;
|
||||
if ( _T("xy") == sValue ) this->m_eValue = extrusionplaneXY;
|
||||
break;
|
||||
case 'y':
|
||||
if ( _T("yz") == sValue ) this->m_eValue = extrusionplaneYZ;
|
||||
if ( _T("yz") == sValue ) this->m_eValue = extrusionplaneYZ;
|
||||
break;
|
||||
case 'z':
|
||||
if ( _T("zx") == sValue ) this->m_eValue = extrusionplaneZX;
|
||||
if ( _T("zx") == sValue ) this->m_eValue = extrusionplaneZX;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1372,13 +1372,13 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'b':
|
||||
if ( _T("boundingCube") == sValue ) this->m_eValue = extrusionrenderBoundingCube;
|
||||
if ( _T("boundingCube") == sValue ) this->m_eValue = extrusionrenderBoundingCube;
|
||||
break;
|
||||
case 's':
|
||||
if ( _T("solid") == sValue ) this->m_eValue = extrusionrenderSolid;
|
||||
if ( _T("solid") == sValue ) this->m_eValue = extrusionrenderSolid;
|
||||
break;
|
||||
case 'w':
|
||||
if ( _T("wireFrame") == sValue ) this->m_eValue = extrusionrenderWireFrame;
|
||||
if ( _T("wireFrame") == sValue ) this->m_eValue = extrusionrenderWireFrame;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1389,10 +1389,10 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case extrusionrenderBoundingCube: return _T("boundingCube");
|
||||
case extrusionrenderSolid: return _T("solid");
|
||||
case extrusionrenderWireFrame: return _T("wireFrame");
|
||||
default : return _T("solid");
|
||||
case extrusionrenderBoundingCube: return _T("boundingCube");
|
||||
case extrusionrenderSolid: return _T("solid");
|
||||
case extrusionrenderWireFrame: return _T("wireFrame");
|
||||
default : return _T("solid");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1467,22 +1467,22 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'b':
|
||||
if ( _T("bottom") == sValue ) this->m_eValue = howBottom;
|
||||
if ( _T("bottom") == sValue ) this->m_eValue = howBottom;
|
||||
break;
|
||||
case 'c':
|
||||
if ( _T("center") == sValue ) this->m_eValue = howCenter;
|
||||
if ( _T("center") == sValue ) this->m_eValue = howCenter;
|
||||
break;
|
||||
case 'l':
|
||||
if ( _T("left") == sValue ) this->m_eValue = howLeft;
|
||||
if ( _T("left") == sValue ) this->m_eValue = howLeft;
|
||||
break;
|
||||
case 'm':
|
||||
if ( _T("middle") == sValue ) this->m_eValue = howMiddle;
|
||||
if ( _T("middle") == sValue ) this->m_eValue = howMiddle;
|
||||
break;
|
||||
case 'r':
|
||||
if ( _T("right") == sValue ) this->m_eValue = howRight;
|
||||
if ( _T("right") == sValue ) this->m_eValue = howRight;
|
||||
break;
|
||||
case 't':
|
||||
if ( _T("top") == sValue ) this->m_eValue = howTop;
|
||||
if ( _T("top") == sValue ) this->m_eValue = howTop;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1493,13 +1493,13 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case howBottom: return _T("bottom");
|
||||
case howCenter: return _T("center");
|
||||
case howLeft : return _T("left");
|
||||
case howMiddle: return _T("middle");
|
||||
case howRight : return _T("right");
|
||||
case howTop : return _T("top");
|
||||
default : return _T("top");
|
||||
case howBottom: return _T("bottom");
|
||||
case howCenter: return _T("center");
|
||||
case howLeft : return _T("left");
|
||||
case howMiddle: return _T("middle");
|
||||
case howRight : return _T("right");
|
||||
case howTop : return _T("top");
|
||||
default : return _T("top");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1535,13 +1535,13 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'c':
|
||||
if ( _T("center") == sValue ) this->m_eValue = hralignCenter;
|
||||
if ( _T("center") == sValue ) this->m_eValue = hralignCenter;
|
||||
break;
|
||||
case 'l':
|
||||
if ( _T("left") == sValue ) this->m_eValue = hralignLeft;
|
||||
if ( _T("left") == sValue ) this->m_eValue = hralignLeft;
|
||||
break;
|
||||
case 'r':
|
||||
if ( _T("right") == sValue ) this->m_eValue = hralignRight;
|
||||
if ( _T("right") == sValue ) this->m_eValue = hralignRight;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1552,10 +1552,10 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case hralignCenter: return _T("center");
|
||||
case hralignLeft : return _T("left");
|
||||
case hralignRight : return _T("right");
|
||||
default : return _T("left");
|
||||
case hralignCenter: return _T("center");
|
||||
case hralignLeft : return _T("left");
|
||||
case hralignRight : return _T("right");
|
||||
default : return _T("left");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1590,10 +1590,10 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'a':
|
||||
if ( _T("auto") == sValue ) this->m_eValue = insetmodeAuto;
|
||||
if ( _T("auto") == sValue ) this->m_eValue = insetmodeAuto;
|
||||
break;
|
||||
case 'c':
|
||||
if ( _T("custom") == sValue ) this->m_eValue = insetmodeCustom;
|
||||
if ( _T("custom") == sValue ) this->m_eValue = insetmodeCustom;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1604,9 +1604,9 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case insetmodeAuto : return _T("auto");
|
||||
case insetmodeCustom : return _T("custom");
|
||||
default : return _T("auto");
|
||||
case insetmodeAuto : return _T("auto");
|
||||
case insetmodeCustom : return _T("custom");
|
||||
default : return _T("auto");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1642,9 +1642,9 @@ namespace SimpleTypes
|
||||
{
|
||||
switch (this->m_eValue)
|
||||
{
|
||||
case oledrawaspectContent : return _T("Content");
|
||||
case oledrawaspectIcon : return _T("Icon");
|
||||
default : return _T("Content");
|
||||
case oledrawaspectContent : return _T("Content");
|
||||
case oledrawaspectIcon : return _T("Icon");
|
||||
default : return _T("Content");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1702,12 +1702,12 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case olelinktypeBitmap: return _T("Bitmap");
|
||||
case olelinktypeEmf: return _T("EnhancedMetaFile");
|
||||
case olelinktypeJpeg: return _T("Jpeg");
|
||||
case olelinktypePicture: return _T("Picture");
|
||||
case olelinktypePng: return _T("Png");
|
||||
default : return _T("Bitmap");
|
||||
case olelinktypeBitmap: return _T("Bitmap");
|
||||
case olelinktypeEmf: return _T("EnhancedMetaFile");
|
||||
case olelinktypeJpeg: return _T("Jpeg");
|
||||
case olelinktypePicture: return _T("Picture");
|
||||
case olelinktypePng: return _T("Png");
|
||||
default : return _T("Bitmap");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1944,10 +1944,10 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'f':
|
||||
if ( _T("f") == sValue || _T("false") == sValue ) this->m_eValue = bordershadowFalse;
|
||||
if ( _T("f") == sValue || _T("false") == sValue ) this->m_eValue = bordershadowFalse;
|
||||
break;
|
||||
case 't':
|
||||
if ( _T("t") == sValue || _T("true") == sValue ) this->m_eValue = bordershadowTrue;
|
||||
if ( _T("t") == sValue || _T("true") == sValue ) this->m_eValue = bordershadowTrue;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2074,34 +2074,34 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case bordertypeDash: return _T("dash");
|
||||
case bordertypeDashDotDot: return _T("dashDotDot");
|
||||
case bordertypeDashDotStroked: return _T("dashDotStroked");
|
||||
case bordertypeDashedSmall: return _T("dashedSmall");
|
||||
case bordertypeDot: return _T("dot");
|
||||
case bordertypeDotDash: return _T("dotDash");
|
||||
case bordertypeDouble: return _T("double");
|
||||
case bordertypeDoubleWave: return _T("doubleWave");
|
||||
case bordertypeHairline: return _T("hairline");
|
||||
case bordertypeHTMLInset: return _T("HTMLInset");
|
||||
case bordertypeHTMLOutset: return _T("HTMLOutset");
|
||||
case bordertypeNone: return _T("none");
|
||||
case bordertypeSingle: return _T("single");
|
||||
case bordertypeThick: return _T("thick");
|
||||
case bordertypeThickBetweenThin: return _T("thickBetweenThin");
|
||||
case bordertypeThickBetweenThinLarge: return _T("thickBetweenThinLarge");
|
||||
case bordertypeThickBetweenThinSmall: return _T("thickBetweenThinSmall");
|
||||
case bordertypeThickThin: return _T("thickThin");
|
||||
case bordertypeThickThinLarge: return _T("thickThinLarge");
|
||||
case bordertypeThickThinSmall: return _T("thickThinSmall");
|
||||
case bordertypeThinThick: return _T("thinThick");
|
||||
case bordertypeThinThickLarge: return _T("thinThickLarge");
|
||||
case bordertypeThinThickSmall: return _T("thinThickSmall");
|
||||
case bordertypeThreeDEmboss: return _T("threeDEmboss");
|
||||
case bordertypeThreeDEngrave: return _T("threeDEngrave");
|
||||
case bordertypeTriple: return _T("triple");
|
||||
case bordertypeWave: return _T("wave");
|
||||
default : return _T("none");
|
||||
case bordertypeDash: return _T("dash");
|
||||
case bordertypeDashDotDot: return _T("dashDotDot");
|
||||
case bordertypeDashDotStroked: return _T("dashDotStroked");
|
||||
case bordertypeDashedSmall: return _T("dashedSmall");
|
||||
case bordertypeDot: return _T("dot");
|
||||
case bordertypeDotDash: return _T("dotDash");
|
||||
case bordertypeDouble: return _T("double");
|
||||
case bordertypeDoubleWave: return _T("doubleWave");
|
||||
case bordertypeHairline: return _T("hairline");
|
||||
case bordertypeHTMLInset: return _T("HTMLInset");
|
||||
case bordertypeHTMLOutset: return _T("HTMLOutset");
|
||||
case bordertypeNone: return _T("none");
|
||||
case bordertypeSingle: return _T("single");
|
||||
case bordertypeThick: return _T("thick");
|
||||
case bordertypeThickBetweenThin: return _T("thickBetweenThin");
|
||||
case bordertypeThickBetweenThinLarge: return _T("thickBetweenThinLarge");
|
||||
case bordertypeThickBetweenThinSmall: return _T("thickBetweenThinSmall");
|
||||
case bordertypeThickThin: return _T("thickThin");
|
||||
case bordertypeThickThinLarge: return _T("thickThinLarge");
|
||||
case bordertypeThickThinSmall: return _T("thickThinSmall");
|
||||
case bordertypeThinThick: return _T("thinThick");
|
||||
case bordertypeThinThickLarge: return _T("thinThickLarge");
|
||||
case bordertypeThinThickSmall: return _T("thinThickSmall");
|
||||
case bordertypeThreeDEmboss: return _T("threeDEmboss");
|
||||
case bordertypeThreeDEngrave: return _T("threeDEngrave");
|
||||
case bordertypeTriple: return _T("triple");
|
||||
case bordertypeWave: return _T("wave");
|
||||
default : return _T("none");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2138,18 +2138,18 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'c':
|
||||
if ( _T("char") == sValue ) this->m_eValue = horizontalanchorChar;
|
||||
if ( _T("char") == sValue ) this->m_eValue = horizontalanchorChar;
|
||||
break;
|
||||
case 'm':
|
||||
if ( _T("margin") == sValue ) this->m_eValue = horizontalanchorMargin;
|
||||
if ( _T("margin") == sValue ) this->m_eValue = horizontalanchorMargin;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if ( _T("page") == sValue ) this->m_eValue = horizontalanchorPage;
|
||||
if ( _T("page") == sValue ) this->m_eValue = horizontalanchorPage;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
if ( _T("text") == sValue ) this->m_eValue = horizontalanchorText;
|
||||
if ( _T("text") == sValue ) this->m_eValue = horizontalanchorText;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2160,11 +2160,11 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case horizontalanchorChar: return _T("char");
|
||||
case horizontalanchorMargin: return _T("margin");
|
||||
case horizontalanchorPage: return _T("page");
|
||||
case horizontalanchorText: return _T("text");
|
||||
default : return _T("char");
|
||||
case horizontalanchorChar: return _T("char");
|
||||
case horizontalanchorMargin: return _T("margin");
|
||||
case horizontalanchorPage: return _T("page");
|
||||
case horizontalanchorText: return _T("text");
|
||||
default : return _T("char");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2201,18 +2201,18 @@ namespace SimpleTypes
|
||||
switch ( wChar )
|
||||
{
|
||||
case 'l':
|
||||
if ( _T("line") == sValue ) this->m_eValue = verticalanchorLine;
|
||||
if ( _T("line") == sValue ) this->m_eValue = verticalanchorLine;
|
||||
break;
|
||||
case 'm':
|
||||
if ( _T("margin") == sValue ) this->m_eValue = verticalanchorMargin;
|
||||
if ( _T("margin") == sValue ) this->m_eValue = verticalanchorMargin;
|
||||
break;
|
||||
|
||||
case 'p':
|
||||
if ( _T("page") == sValue ) this->m_eValue = verticalanchorPage;
|
||||
if ( _T("page") == sValue ) this->m_eValue = verticalanchorPage;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
if ( _T("text") == sValue ) this->m_eValue = verticalanchorText;
|
||||
if ( _T("text") == sValue ) this->m_eValue = verticalanchorText;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -2223,11 +2223,11 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case verticalanchorLine: return _T("line");
|
||||
case verticalanchorMargin: return _T("margin");
|
||||
case verticalanchorPage: return _T("page");
|
||||
case verticalanchorText: return _T("text");
|
||||
default : return _T("line");
|
||||
case verticalanchorLine: return _T("line");
|
||||
case verticalanchorMargin: return _T("margin");
|
||||
case verticalanchorPage: return _T("page");
|
||||
case verticalanchorText: return _T("text");
|
||||
default : return _T("line");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2284,11 +2284,11 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case wrapsideBoth: return _T("both");
|
||||
case wrapsideLargest: return _T("largest");
|
||||
case wrapsideLeft: return _T("left");
|
||||
case wrapsideRight: return _T("right");
|
||||
default : return _T("both");
|
||||
case wrapsideBoth: return _T("both");
|
||||
case wrapsideLargest: return _T("largest");
|
||||
case wrapsideLeft: return _T("left");
|
||||
case wrapsideRight: return _T("right");
|
||||
default : return _T("both");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2347,12 +2347,12 @@ namespace SimpleTypes
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case wraptypeNone: return _T("none");
|
||||
case wraptypeSquare: return _T("square");
|
||||
case wraptypeThrough: return _T("through");
|
||||
case wraptypeTight: return _T("tight");
|
||||
case wraptypeTopAndBottom: return _T("topAndBottom");
|
||||
default : return _T("none");
|
||||
case wraptypeNone: return _T("none");
|
||||
case wraptypeSquare: return _T("square");
|
||||
case wraptypeThrough: return _T("through");
|
||||
case wraptypeTight: return _T("tight");
|
||||
case wraptypeTopAndBottom: return _T("topAndBottom");
|
||||
default : return _T("none");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2370,25 +2370,25 @@ namespace SimpleTypes
|
||||
{
|
||||
enum EVmlClientDataObjectType
|
||||
{
|
||||
vmlclientdataobjecttypeButton = 0,
|
||||
vmlclientdataobjecttypeCheckbox = 1,
|
||||
vmlclientdataobjecttypeDialog = 2,
|
||||
vmlclientdataobjecttypeDrop = 3,
|
||||
vmlclientdataobjecttypeEdit = 4,
|
||||
vmlclientdataobjecttypeGBox = 5,
|
||||
vmlclientdataobjecttypeGroup = 6,
|
||||
vmlclientdataobjecttypeLabel = 7,
|
||||
vmlclientdataobjecttypeLineA = 8,
|
||||
vmlclientdataobjecttypeList = 9,
|
||||
vmlclientdataobjecttypeMovie = 10,
|
||||
vmlclientdataobjecttypeNote = 11,
|
||||
vmlclientdataobjecttypePict = 12,
|
||||
vmlclientdataobjecttypeRadio = 13,
|
||||
vmlclientdataobjecttypeRect = 14,
|
||||
vmlclientdataobjecttypeRectA = 15,
|
||||
vmlclientdataobjecttypeScroll = 16,
|
||||
vmlclientdataobjecttypeShape = 17,
|
||||
vmlclientdataobjecttypeSpin = 18
|
||||
vmlclientdataobjecttypeButton = 0,
|
||||
vmlclientdataobjecttypeCheckbox = 1,
|
||||
vmlclientdataobjecttypeDialog = 2,
|
||||
vmlclientdataobjecttypeDrop = 3,
|
||||
vmlclientdataobjecttypeEdit = 4,
|
||||
vmlclientdataobjecttypeGBox = 5,
|
||||
vmlclientdataobjecttypeGroup = 6,
|
||||
vmlclientdataobjecttypeLabel = 7,
|
||||
vmlclientdataobjecttypeLineA = 8,
|
||||
vmlclientdataobjecttypeList = 9,
|
||||
vmlclientdataobjecttypeMovie = 10,
|
||||
vmlclientdataobjecttypeNote = 11,
|
||||
vmlclientdataobjecttypePict = 12,
|
||||
vmlclientdataobjecttypeRadio = 13,
|
||||
vmlclientdataobjecttypeRect = 14,
|
||||
vmlclientdataobjecttypeRectA = 15,
|
||||
vmlclientdataobjecttypeScroll = 16,
|
||||
vmlclientdataobjecttypeShape = 17,
|
||||
vmlclientdataobjecttypeSpin = 18
|
||||
};
|
||||
template<EVmlClientDataObjectType eDefValue = vmlclientdataobjecttypeButton>
|
||||
class CVmlClientDataObjectType : public CSimpleType<EVmlClientDataObjectType, eDefValue>
|
||||
@ -2427,28 +2427,28 @@ namespace SimpleTypes
|
||||
|
||||
virtual std::wstring ToString () const
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case vmlclientdataobjecttypeButton: return _T("Button");
|
||||
case vmlclientdataobjecttypeCheckbox: return _T("Checkbox");
|
||||
case vmlclientdataobjecttypeDialog: return _T("Dialog");
|
||||
case vmlclientdataobjecttypeDrop: return _T("Drop");
|
||||
case vmlclientdataobjecttypeEdit: return _T("Edit");
|
||||
case vmlclientdataobjecttypeGBox: return _T("GBox");
|
||||
case vmlclientdataobjecttypeGroup: return _T("Group");
|
||||
case vmlclientdataobjecttypeLabel: return _T("Label");
|
||||
case vmlclientdataobjecttypeLineA: return _T("LineA");
|
||||
case vmlclientdataobjecttypeList: return _T("List");
|
||||
case vmlclientdataobjecttypeMovie: return _T("Movie");
|
||||
case vmlclientdataobjecttypeNote: return _T("Note");
|
||||
case vmlclientdataobjecttypePict: return _T("Pict");
|
||||
case vmlclientdataobjecttypeRadio: return _T("Radio");
|
||||
case vmlclientdataobjecttypeRect: return _T("Rect");
|
||||
case vmlclientdataobjecttypeRectA: return _T("RectA");
|
||||
case vmlclientdataobjecttypeScroll: return _T("Scroll");
|
||||
case vmlclientdataobjecttypeShape: return _T("Shape");
|
||||
case vmlclientdataobjecttypeSpin: return _T("Spin");
|
||||
default : return _T("Button");
|
||||
case vmlclientdataobjecttypeButton: return _T("Button");
|
||||
case vmlclientdataobjecttypeCheckbox: return _T("Checkbox");
|
||||
case vmlclientdataobjecttypeDialog: return _T("Dialog");
|
||||
case vmlclientdataobjecttypeDrop: return _T("Drop");
|
||||
case vmlclientdataobjecttypeEdit: return _T("Edit");
|
||||
case vmlclientdataobjecttypeGBox: return _T("GBox");
|
||||
case vmlclientdataobjecttypeGroup: return _T("Group");
|
||||
case vmlclientdataobjecttypeLabel: return _T("Label");
|
||||
case vmlclientdataobjecttypeLineA: return _T("LineA");
|
||||
case vmlclientdataobjecttypeList: return _T("List");
|
||||
case vmlclientdataobjecttypeMovie: return _T("Movie");
|
||||
case vmlclientdataobjecttypeNote: return _T("Note");
|
||||
case vmlclientdataobjecttypePict: return _T("Pict");
|
||||
case vmlclientdataobjecttypeRadio: return _T("Radio");
|
||||
case vmlclientdataobjecttypeRect: return _T("Rect");
|
||||
case vmlclientdataobjecttypeRectA: return _T("RectA");
|
||||
case vmlclientdataobjecttypeScroll: return _T("Scroll");
|
||||
case vmlclientdataobjecttypeShape: return _T("Shape");
|
||||
case vmlclientdataobjecttypeSpin: return _T("Spin");
|
||||
default : return _T("Button");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2499,13 +2499,13 @@ namespace SimpleTypes
|
||||
|
||||
virtual std::wstring ToString () const
|
||||
{
|
||||
switch(this->m_eValue)
|
||||
switch(this->m_eValue)
|
||||
{
|
||||
case vmlcallouttypeRectangle: return _T("rectangle");
|
||||
case vmlcallouttypeRoundRectangle: return _T("roundedrectangle");
|
||||
case vmlcallouttypeOval: return _T("oval");
|
||||
case vmlcallouttypeCloud: return _T("cloud");
|
||||
default : return _T("rectangle");
|
||||
case vmlcallouttypeRectangle: return _T("rectangle");
|
||||
case vmlcallouttypeRoundRectangle: return _T("roundedrectangle");
|
||||
case vmlcallouttypeOval: return _T("oval");
|
||||
case vmlcallouttypeCloud: return _T("cloud");
|
||||
default : return _T("rectangle");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2526,7 +2526,7 @@ namespace SimpleTypes
|
||||
return m_sValue;
|
||||
}
|
||||
|
||||
void SetValue(std::wstring &sValue)
|
||||
void SetValue(std::wstring &sValue)
|
||||
{
|
||||
m_sValue = sValue;
|
||||
}
|
||||
@ -2707,12 +2707,12 @@ namespace SimpleTypes
|
||||
return m_dValue;
|
||||
}
|
||||
|
||||
void SetValue(double dValue)
|
||||
void SetValue(double dValue)
|
||||
{
|
||||
m_dValue = (std::max)( 0.0, (std::min)( 1.0, dValue) );
|
||||
}
|
||||
|
||||
void SetValue(int nValue)
|
||||
void SetValue(int nValue)
|
||||
{
|
||||
m_dValue = (std::max)( 0.0, (std::min)( 65536.0, (double) nValue) ) / 65536.0;
|
||||
}
|
||||
|
||||
@ -29,13 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
//
|
||||
// ImageUtils.h
|
||||
// UTILS
|
||||
//
|
||||
// Created by alexey.musinov on 30.04.15.
|
||||
// Copyright (c) 2015 Ascensio System SIA. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _IMAGE_UTILS_H_
|
||||
#define _IMAGE_UTILS_H_
|
||||
|
||||
@ -29,13 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
//
|
||||
// MemoryMacUtils.h
|
||||
// UTILS
|
||||
//
|
||||
// Created by Alexey Musinov on 03.11.15.
|
||||
// Copyright © 2015 Ascensio System SIA. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _MEMORY_MAC_UTILS_H_
|
||||
#define _MEMORY_MAC_UTILS_H_
|
||||
|
||||
@ -29,13 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
//
|
||||
// NSFileManager+Utils.h
|
||||
// UTILS
|
||||
//
|
||||
// Created by alexey.musinov on 21.09.15.
|
||||
// Copyright © 2015 Ascensio System SIA. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@ -29,13 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
//
|
||||
// NSFileManager+Utils.m
|
||||
// UTILS
|
||||
//
|
||||
// Created by alexey.musinov on 21.09.15.
|
||||
// Copyright © 2015 Ascensio System SIA. All rights reserved.
|
||||
//
|
||||
|
||||
#import "NSFileManager+Utils.h"
|
||||
|
||||
|
||||
@ -29,13 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
//
|
||||
// NSString+StringUtils.h
|
||||
// UTILS
|
||||
//
|
||||
// Created by alexey.musinov on 10.08.15.
|
||||
// Copyright (c) 2015 Ascensio System SIA. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <string>
|
||||
|
||||
@ -1,10 +1,34 @@
|
||||
//
|
||||
// NSString+StringUtils.m
|
||||
// UTILS
|
||||
//
|
||||
// Created by alexey.musinov on 10.08.15.
|
||||
// Copyright (c) 2015 Ascensio System SIA. All rights reserved.
|
||||
//
|
||||
/*
|
||||
* (c) Copyright Ascensio System SIA 2010-2017
|
||||
*
|
||||
* This program is a free software product. You can redistribute it and/or
|
||||
* modify it under the terms of the GNU Affero General Public License (AGPL)
|
||||
* version 3 as published by the Free Software Foundation. In accordance with
|
||||
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
|
||||
* that Ascensio System SIA expressly excludes the warranty of non-infringement
|
||||
* of any third-party rights.
|
||||
*
|
||||
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
|
||||
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
|
||||
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
|
||||
*
|
||||
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
|
||||
* EU, LV-1021.
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions
|
||||
* of the Program must display Appropriate Legal Notices, as required under
|
||||
* Section 5 of the GNU AGPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7(b) of the License you must retain the original Product
|
||||
* logo when distributing the program. Pursuant to Section 7(e) we decline to
|
||||
* grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
* All the Product's GUI elements, including illustrations and icon sets, as
|
||||
* well as technical writing content are licensed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
|
||||
#import "NSString+StringUtils.h"
|
||||
|
||||
|
||||
@ -29,13 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
//
|
||||
// MathUtils.h
|
||||
// UTILS
|
||||
//
|
||||
// Created by alexey.musinov on 19.06.15.
|
||||
// Copyright (c) 2015 Ascensio System SIA. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _MATH_UTILS_
|
||||
#define _MATH_UTILS_
|
||||
|
||||
@ -29,13 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
//
|
||||
// ShapeAspects.h
|
||||
// UTILS
|
||||
//
|
||||
// Created by alexey.musinov on 09.10.15.
|
||||
// Copyright © 2015 Ascensio System SIA. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SHAPE_ASPECTS_H
|
||||
#define SHAPE_ASPECTS_H
|
||||
|
||||
@ -29,13 +29,6 @@
|
||||
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
|
||||
*
|
||||
*/
|
||||
//
|
||||
// TrackingImages.h
|
||||
// UTILS
|
||||
//
|
||||
// Created by alexey.musinov on 05.11.15.
|
||||
// Copyright © 2015 Ascensio System SIA. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _TRACKING_IMAGES_H_
|
||||
#define _TRACKING_IMAGES_H_
|
||||
|
||||
@ -39,6 +39,8 @@
|
||||
|
||||
bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileType)
|
||||
{
|
||||
m_nFileType = nFileType;
|
||||
|
||||
if (CXIMAGE_FORMAT_JP2 == nFileType)
|
||||
{
|
||||
Jpeg2000::CJ2kFile oJ2;
|
||||
@ -49,7 +51,7 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
|
||||
if (nFileType == 0)
|
||||
{
|
||||
CImageFileFormatChecker checker(strFileName);
|
||||
nFileType = checker.eFileType;
|
||||
m_nFileType = checker.eFileType;
|
||||
}
|
||||
NSFile::CFileBinary oFile;
|
||||
if (!oFile.OpenFile(strFileName))
|
||||
@ -57,7 +59,7 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
|
||||
|
||||
CxImage img;
|
||||
|
||||
if (!img.Decode(oFile.GetFileNative(), nFileType))
|
||||
if (!img.Decode(oFile.GetFileNative(), m_nFileType))
|
||||
return false;
|
||||
|
||||
CxImageToMediaFrame(img);
|
||||
@ -116,7 +118,44 @@ bool CBgraFrame::Resize(const long& nNewWidth, const long& nNewHeight, bool bDes
|
||||
CxImageToMediaFrame( imgDst );
|
||||
return true;
|
||||
}
|
||||
bool CBgraFrame::ReColorPatternImage(const std::wstring& strFileName, unsigned int rgbColorBack, unsigned int rgbColorFore)
|
||||
{
|
||||
if (OpenFile(strFileName))
|
||||
{
|
||||
int smpl = abs(get_Stride() / get_Width());
|
||||
|
||||
BYTE * rgb = get_Data();
|
||||
|
||||
BYTE R1 = (BYTE)(rgbColorBack);
|
||||
BYTE G1 = (BYTE)(rgbColorBack >> 8);
|
||||
BYTE B1 = (BYTE)(rgbColorBack >> 16);
|
||||
|
||||
BYTE R2 = (BYTE)(rgbColorFore);
|
||||
BYTE G2 = (BYTE)(rgbColorFore >> 8);
|
||||
BYTE B2 = (BYTE)(rgbColorFore >> 16);
|
||||
|
||||
for (int i = 0 ; i < get_Width() * get_Height(); i++)
|
||||
{
|
||||
if (rgb[i * smpl + 0 ] == 0x00 && rgb[i * smpl + 1 ] == 0x00 && rgb[i * smpl + 2 ] == 0x00)
|
||||
{
|
||||
rgb[i * smpl + 0 ] = R1;
|
||||
rgb[i * smpl + 1 ] = G1;
|
||||
rgb[i * smpl + 2 ] = B1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rgb[i * smpl + 0 ] = R2;
|
||||
rgb[i * smpl + 1 ] = G2;
|
||||
rgb[i * smpl + 2 ] = B2;
|
||||
}
|
||||
}
|
||||
if (m_nFileType == 0) m_nFileType = 1;
|
||||
|
||||
SaveFile(strFileName, m_nFileType);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
void CBgraFrame::CxImageToMediaFrame( CxImage& img )
|
||||
{
|
||||
if( !img.IsValid() )
|
||||
|
||||
@ -39,6 +39,8 @@ class CxImage;
|
||||
class CBgraFrame
|
||||
{
|
||||
private:
|
||||
int m_nFileType;
|
||||
|
||||
int m_lWidth;
|
||||
int m_lHeight;
|
||||
int m_lStride;
|
||||
@ -67,6 +69,7 @@ private:
|
||||
}
|
||||
inline void Clear()
|
||||
{
|
||||
m_nFileType = 0;
|
||||
m_lWidth = 0;
|
||||
m_lHeight = 0;
|
||||
m_lStride = 0;
|
||||
@ -120,7 +123,10 @@ public:
|
||||
public:
|
||||
bool OpenFile(const std::wstring& strFileName, unsigned int nFileType = 0); //0 - detect
|
||||
bool SaveFile(const std::wstring& strFileName, unsigned int nFileType);
|
||||
bool Resize(const long& nNewWidth, const long& nNewHeight, bool bDestroyData = true);
|
||||
|
||||
bool Resize(const long& nNewWidth, const long& nNewHeight, bool bDestroyData = true);
|
||||
|
||||
bool ReColorPatternImage(const std::wstring& strFileName, unsigned int rgbColorBack, unsigned int rgbColorFore);
|
||||
private:
|
||||
|
||||
void CxImageToMediaFrame( CxImage& img );
|
||||
|
||||
@ -3306,12 +3306,10 @@ namespace PdfReader
|
||||
}
|
||||
void RendererOutputDev::DrawMaskedImage(GrState *pGState, Object *pRef, Stream *pStream, int nWidth, int nHeight, GrImageColorMap *pColorMap, Stream *pMaskStream, int nMaskWidth, int nMaskHeight, bool bMaskInvert)
|
||||
{
|
||||
if (m_bDrawOnlyText)
|
||||
return;
|
||||
if (m_bDrawOnlyText)
|
||||
return;
|
||||
|
||||
// Вообще, размеры маски и самой картинки могут не совпадать (в этом случае мы должны срезайзить до размеров картинки)
|
||||
// TO DO: Сделать, когда появится файл
|
||||
if (nWidth != nMaskWidth || nHeight != nMaskHeight)
|
||||
if (nMaskWidth <= 0 || nMaskHeight <= 0)
|
||||
DrawImage(pGState, pRef, pStream, nWidth, nHeight, pColorMap, NULL, false);
|
||||
|
||||
double dPageHeight = pGState->GetPageHeight();
|
||||
@ -3334,25 +3332,79 @@ namespace PdfReader
|
||||
pMask->Reset();
|
||||
pImageStream->Reset();
|
||||
|
||||
unsigned char unPixel[4] ={ 0, 0, 0, 0 };
|
||||
unsigned char unMask = 0;
|
||||
for (int nY = nHeight - 1; nY >= 0; nY--)
|
||||
if (nWidth != nMaskWidth || nHeight != nMaskHeight)
|
||||
{
|
||||
for (int nX = 0; nX < nWidth; nX++)
|
||||
unsigned char *pMaskBuffer = new unsigned char[nMaskWidth * nMaskHeight];
|
||||
if (!pMaskBuffer)
|
||||
{
|
||||
int nIndex = 4 * (nX + nY * nWidth);
|
||||
pImageStream->GetPixel(unPixel);
|
||||
pMask->GetPixel(&unMask);
|
||||
GrRGB oRGB;
|
||||
pColorMap->GetRGB(unPixel, &oRGB);
|
||||
pBufferPtr[nIndex + 0] = ColorToByte(oRGB.b);
|
||||
pBufferPtr[nIndex + 1] = ColorToByte(oRGB.g);
|
||||
pBufferPtr[nIndex + 2] = ColorToByte(oRGB.r);
|
||||
delete pMask;
|
||||
delete pImageStream;
|
||||
return;
|
||||
}
|
||||
|
||||
if (unMask && !bMaskInvert)
|
||||
pBufferPtr[nIndex + 3] = 0;
|
||||
else
|
||||
pBufferPtr[nIndex + 3] = 255;
|
||||
unsigned char unMask = 0;
|
||||
for (int nY = nMaskHeight - 1; nY >= 0; nY--)
|
||||
{
|
||||
for (int nX = 0; nX < nMaskWidth; nX++)
|
||||
{
|
||||
int nIndex = nX + nY * nMaskWidth;
|
||||
pMask->GetPixel(&unMask);
|
||||
pMaskBuffer[nIndex] = unMask;
|
||||
}
|
||||
}
|
||||
|
||||
double dScaleWidth = (double)nWidth / (double)nMaskWidth;
|
||||
double dScaleHeight = (double)nHeight / (double)nMaskHeight;
|
||||
|
||||
unsigned char unPixel[4] ={ 0, 0, 0, 0 };
|
||||
for (int nY = nHeight - 1; nY >= 0; nY--)
|
||||
{
|
||||
for (int nX = 0; nX < nWidth; nX++)
|
||||
{
|
||||
int nIndex = 4 * (nX + nY * nWidth);
|
||||
pImageStream->GetPixel(unPixel);
|
||||
|
||||
int nNearestY = std::min((int)(nY / dScaleHeight), nMaskHeight - 1);
|
||||
int nNearestX = std::min((int)(nX / dScaleWidth), nMaskWidth - 1);
|
||||
unMask = pMaskBuffer[nNearestY * nMaskWidth + nNearestX];
|
||||
|
||||
GrRGB oRGB;
|
||||
pColorMap->GetRGB(unPixel, &oRGB);
|
||||
pBufferPtr[nIndex + 0] = ColorToByte(oRGB.b);
|
||||
pBufferPtr[nIndex + 1] = ColorToByte(oRGB.g);
|
||||
pBufferPtr[nIndex + 2] = ColorToByte(oRGB.r);
|
||||
|
||||
if (unMask && !bMaskInvert)
|
||||
pBufferPtr[nIndex + 3] = 0;
|
||||
else
|
||||
pBufferPtr[nIndex + 3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
delete[] pMaskBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char unPixel[4] ={ 0, 0, 0, 0 };
|
||||
unsigned char unMask = 0;
|
||||
for (int nY = nHeight - 1; nY >= 0; nY--)
|
||||
{
|
||||
for (int nX = 0; nX < nWidth; nX++)
|
||||
{
|
||||
int nIndex = 4 * (nX + nY * nWidth);
|
||||
pImageStream->GetPixel(unPixel);
|
||||
pMask->GetPixel(&unMask);
|
||||
GrRGB oRGB;
|
||||
pColorMap->GetRGB(unPixel, &oRGB);
|
||||
pBufferPtr[nIndex + 0] = ColorToByte(oRGB.b);
|
||||
pBufferPtr[nIndex + 1] = ColorToByte(oRGB.g);
|
||||
pBufferPtr[nIndex + 2] = ColorToByte(oRGB.r);
|
||||
|
||||
if (unMask && !bMaskInvert)
|
||||
pBufferPtr[nIndex + 3] = 0;
|
||||
else
|
||||
pBufferPtr[nIndex + 3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -3362,7 +3414,7 @@ namespace PdfReader
|
||||
double arrMatrix[6];
|
||||
double *pCTM = pGState->GetCTM();
|
||||
// Исходное предобразование
|
||||
// |1 0 0| |pCTM[0] pCTM[1] 0|
|
||||
// |1 0 0| |pCTM[0] pCTM[1] 0|
|
||||
// arrMatrix = |0 -1 0| * |pCTM[2] pCTM[3] 0|
|
||||
// |0 1 1| |pCTM[4] pCTM[5] 1|
|
||||
arrMatrix[0] = pCTM[0];
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
QT -= core
|
||||
QT -= gui
|
||||
|
||||
VERSION = 2.0.3.434
|
||||
VERSION = 2.0.3.435
|
||||
DEFINES += INTVER=$$VERSION
|
||||
|
||||
TARGET = x2t
|
||||
|
||||
@ -226,16 +226,16 @@ namespace NExtractTools
|
||||
}
|
||||
else return AVS_FILEUTILS_ERROR_CONVERT; }
|
||||
|
||||
return xlsx_dir2xlst_bin(sTempUnpackedXLSX, sTo, params);
|
||||
return xlsx_dir2xlst_bin(sTempUnpackedXLSX, sTo, params, true);
|
||||
}
|
||||
int xlsx_dir2xlst_bin (const std::wstring &sXlsxDir, const std::wstring &sTo, InputParams& params)
|
||||
int xlsx_dir2xlst_bin (const std::wstring &sXlsxDir, const std::wstring &sTo, InputParams& params, bool bXmlOptions)
|
||||
{
|
||||
// Save to file (from temp dir)
|
||||
BinXlsxRW::CXlsxSerializer m_oCXlsxSerializer;
|
||||
|
||||
|
||||
m_oCXlsxSerializer.setFontDir(params.getFontPath());
|
||||
|
||||
return m_oCXlsxSerializer.saveToFile (sTo, sXlsxDir, params.getXmlOptions()) ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
|
||||
return m_oCXlsxSerializer.saveToFile (sTo, sXlsxDir, bXmlOptions ? params.getXmlOptions() : L"") ? 0 : AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
|
||||
// xslx -> xslt
|
||||
@ -2016,47 +2016,48 @@ namespace NExtractTools
|
||||
return nRes;
|
||||
}
|
||||
|
||||
int fromXlsxDir(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
|
||||
{
|
||||
int nRes = 0;
|
||||
if(0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & nFormatTo) && AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV != nFormatTo)
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo)
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
}
|
||||
//else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatTo)
|
||||
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2ods(sFrom, sTo, sTemp, params);
|
||||
}
|
||||
else
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_OTHER_JSON == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTo, params);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTo, params);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring sXlstDir = sTemp + FILE_SEPARATOR_STR + L"xlst_unpacked";
|
||||
NSDirectory::CreateDirectory(sXlstDir);
|
||||
std::wstring sTFile = sXlstDir + FILE_SEPARATOR_STR + L"Editor.bin";
|
||||
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == nFormatTo)
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTFile, params);
|
||||
else
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTFile, params);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = fromXlstBin(sTFile, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
|
||||
}
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
int fromXlsxDir(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
|
||||
{
|
||||
int nRes = 0;
|
||||
if(0 != (AVS_OFFICESTUDIO_FILE_SPREADSHEET & nFormatTo) && AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV != nFormatTo)
|
||||
{
|
||||
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLSX == nFormatTo)
|
||||
{
|
||||
nRes = dir2zip(sFrom, sTo);
|
||||
}
|
||||
//else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_XLS == nFormatTo)
|
||||
else if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_ODS == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2ods(sFrom, sTo, sTemp, params);
|
||||
}
|
||||
else
|
||||
nRes = AVS_FILEUTILS_ERROR_CONVERT;
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_OTHER_JSON == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTo, params, true);
|
||||
}
|
||||
else if(AVS_OFFICESTUDIO_FILE_CANVAS_SPREADSHEET == nFormatTo)
|
||||
{
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTo, params, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring sXlstDir = sTemp + FILE_SEPARATOR_STR + _T("xlst_unpacked");
|
||||
NSDirectory::CreateDirectory(sXlstDir);
|
||||
std::wstring sTFile = sXlstDir + FILE_SEPARATOR_STR + _T("Editor.bin");
|
||||
if(AVS_OFFICESTUDIO_FILE_SPREADSHEET_CSV == nFormatTo)
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTFile, params, false);
|
||||
else
|
||||
nRes = xlsx_dir2xlst_bin(sFrom, sTFile, params, true);
|
||||
if(SUCCEEDED_X2T(nRes))
|
||||
{
|
||||
nRes = fromXlstBin(sTFile, sTo, nFormatTo, sTemp, sThemeDir, bFromChanges, bPaid, params);
|
||||
}
|
||||
}
|
||||
return nRes;
|
||||
}
|
||||
|
||||
int fromXlstBin(const std::wstring &sFrom, const std::wstring &sTo, int nFormatTo, const std::wstring &sTemp, const std::wstring &sThemeDir, bool bFromChanges, bool bPaid, InputParams& params)
|
||||
{
|
||||
int nRes = 0;
|
||||
|
||||
Reference in New Issue
Block a user