Commit bbd429a9 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormat - Reader/Writer - background page (image, pattern, gradient)

parent f4d63653
...@@ -55,7 +55,7 @@ int _tmain(int argc, _TCHAR* argv[]) ...@@ -55,7 +55,7 @@ int _tmain(int argc, _TCHAR* argv[])
HRESULT hr = S_OK; HRESULT hr = S_OK;
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
std::wstring srcFileName = argv[1]; 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); std::wstring outputDir = NSDirectory::GetFolderPath(dstPath);
......
...@@ -531,8 +531,8 @@ mso-position-vertical-relative:text;"; ...@@ -531,8 +531,8 @@ mso-position-vertical-relative:text;";
strStyle += L"height:" + boost::lexical_cast<std::wstring>(val.cy / 12700.) + L"pt;"; 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); 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"id", L"Rect" + std::to_wstring(val.id));
CP_XML_ATTR(L"o:spid", L"_x0000_s" + boost::lexical_cast<std::wstring>(1024 + 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"style", strStyle);
CP_XML_ATTR(L"fillcolor", L"#4f81bd [3204]"); CP_XML_ATTR(L"fillcolor", L"#4f81bd [3204]");
CP_XML_ATTR(L"strokecolor", L"#243f60 [1604]"); 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) ...@@ -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_NODE(L"a:srgbClr")
{ {
CP_XML_ATTR(L"val",color); CP_XML_ATTR(L"val", color);
if (opacity) if (opacity)
{ {
CP_XML_NODE(L"a:alpha") CP_XML_NODE(L"a:alpha")
...@@ -101,11 +101,56 @@ void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val) ...@@ -101,11 +101,56 @@ void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
{ {
CP_XML_NODE(L"a:solidFill") 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) void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{ {
if (!val.bitmap) return; if (!val.bitmap) return;
...@@ -164,20 +209,69 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val) ...@@ -164,20 +209,69 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{ {
CP_XML_NODE(L"a:fillRect"); 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) void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
{ {
if (!val.gradient) if (!val.gradient) return;
{
return;
}
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
...@@ -233,6 +327,7 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val) ...@@ -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) void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
{ {
if (!val.hatch)return; if (!val.hatch)return;
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"a:pattFill") CP_XML_NODE(L"a:pattFill")
...@@ -253,7 +348,38 @@ void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val) ...@@ -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) switch (val.type)
{ {
......
...@@ -143,9 +143,10 @@ namespace oox { ...@@ -143,9 +143,10 @@ namespace oox {
} }
}; };
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);
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double) opacity); void oox_serialize_fill (std::wostream & strm, const _oox_fill & val);
void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(odf_types::percent) opacity); 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);
} }
} }
...@@ -281,14 +281,14 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr ...@@ -281,14 +281,14 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
fill->style = 0; fill->style = 0;
point.pos = 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_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_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point); fill->colors.push_back(point);
point.pos = 100; 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_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_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point); fill->colors.push_back(point);
}break; }break;
...@@ -297,20 +297,20 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr ...@@ -297,20 +297,20 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
fill->style = 0; fill->style = 0;
point.pos = 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_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_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point); fill->colors.push_back(point);
point.pos = 50; 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_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_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point); fill->colors.push_back(point);
point.pos = 100; 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_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_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point); fill->colors.push_back(point);
}break; }break;
...@@ -319,41 +319,35 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr ...@@ -319,41 +319,35 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
case gradient_style::square: case gradient_style::square:
case gradient_style::rectangular: 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::square ) fill->style = 1;
if (style == gradient_style::rectangular) fill->style = 3; if (style == gradient_style::rectangular) fill->style = 3;
point.pos = 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_start_color_) point.color_ref = image_style->draw_start_color_->get_hex_value();
if (image_style->draw_end_intensity_)point.opacity = image_style->draw_end_intensity_->get_value(); if (image_style->draw_start_intensity_) point.opacity = image_style->draw_start_intensity_->get_value();
fill->colors.push_back(point); fill->colors.push_back(point);
point.pos = 100; point.pos = 100;
if (image_style->draw_start_color_)point.color_ref = image_style->draw_start_color_->get_hex_value(); if (image_style->draw_end_color_) point.color_ref = image_style->draw_end_color_->get_hex_value();
if (image_style->draw_start_intensity_)point.opacity = image_style->draw_start_intensity_->get_value(); if (image_style->draw_end_intensity_) point.opacity = image_style->draw_end_intensity_->get_value();
fill->colors.push_back(point); fill->colors.push_back(point);
if (image_style->draw_cx_)//хохма - у мс в конвертилке из open-office перепутаны l & r !!! fill->rect[0] = fill->rect[1] = 0;
{ fill->rect[2] = fill->rect[3] = 100;
fill->rect[0]=image_style->draw_cx_->get_value();
fill->rect[2]=100-image_style->draw_cx_->get_value(); if (image_style->draw_cx_)
}
else
{ {
fill->rect[0]=0; fill->rect[0] = 100 - image_style->draw_cx_->get_value();
fill->rect[2]=100; fill->rect[2] = image_style->draw_cx_->get_value();
} }
if (image_style->draw_cy_) if (image_style->draw_cy_)
{ {
fill->rect[1]=image_style->draw_cy_->get_value(); fill->rect[1] = 100 - image_style->draw_cy_->get_value();
fill->rect[3]=100-image_style->draw_cy_->get_value(); fill->rect[3] = image_style->draw_cy_->get_value();
}
else
{
fill->rect[1]=0;
fill->rect[3]=100;
} }
}break; }break;
} }
...@@ -427,8 +421,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el ...@@ -427,8 +421,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{ {
switch(image->style_repeat_->get_type()) switch(image->style_repeat_->get_type())
{ {
case style_repeat::Repeat : fill.bitmap->bTile = true; break; case style_repeat::Repeat :
case style_repeat::Stretch : fill.bitmap->bStretch = true; break; 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_) if (image->draw_opacity_)
...@@ -445,8 +445,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el ...@@ -445,8 +445,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{ {
switch(props.style_repeat_->get_type()) switch(props.style_repeat_->get_type())
{ {
case style_repeat::Repeat : fill.bitmap->bTile = true; break; case style_repeat::Repeat :
case style_repeat::Stretch : fill.bitmap->bStretch = true; break; fill.bitmap->bTile = true;
fill.bitmap->bStretch = false;
break;
case style_repeat::Stretch :
fill.bitmap->bStretch = true;
fill.bitmap->bTile = false;
break;
} }
} }
else else
......
...@@ -893,7 +893,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio ...@@ -893,7 +893,7 @@ 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); 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_; std::wstring href = drawing->fill.bitmap->xlink_href_;
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href); drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
......
...@@ -180,7 +180,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -180,7 +180,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
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_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_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_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_bottom", Compute_BorderWidth(properties, sideBottom)));
if (properties.fo_clip_) if (properties.fo_clip_)
......
...@@ -41,7 +41,9 @@ ...@@ -41,7 +41,9 @@
#include <cpdoccore/xml/attributes.h> #include <cpdoccore/xml/attributes.h>
#include <cpdoccore/odf/odf_document.h> #include <cpdoccore/odf/odf_document.h>
#include "odfcontext.h" #include "odfcontext.h"
#include "draw_common.h"
namespace cpdoccore { namespace cpdoccore {
...@@ -111,14 +113,29 @@ void office_body::docx_convert(oox::docx_conversion_context & Context) ...@@ -111,14 +113,29 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
Context.add_page_properties(L""); // Context.add_page_properties(L""); //
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 (page_layout_instance * firtsPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
{ {
if (style_page_layout_properties * prop = firtsPageLayout->properties()) if (style_page_layout_properties * 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)
{
if ((fill.bitmap) && (fill.bitmap->rId.empty()))
{ {
Context.set_settings_property(odf_reader::_property(L"displayBackgroundShape",true)); 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));
}
} }
} }
} }
......
...@@ -54,7 +54,6 @@ ...@@ -54,7 +54,6 @@
#include "serialize_elements.h" #include "serialize_elements.h"
#include "odfcontext.h" #include "odfcontext.h"
#include "draw_common.h" #include "draw_common.h"
namespace cpdoccore { namespace cpdoccore {
...@@ -919,6 +918,7 @@ void style_page_layout_properties_attlist::add_attributes( const xml::attributes ...@@ -919,6 +918,7 @@ void style_page_layout_properties_attlist::add_attributes( const xml::attributes
common_padding_attlist_.add_attributes(Attributes); common_padding_attlist_.add_attributes(Attributes);
common_shadow_attlist_.add_attributes(Attributes); common_shadow_attlist_.add_attributes(Attributes);
common_background_color_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: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", style_print_);
...@@ -1260,18 +1260,26 @@ void style_page_layout_properties::add_child_element( xml::sax * Reader, const s ...@@ -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()); 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_WRITER(strm)
{ {
CP_XML_NODE(L"w:background") 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(); std::wstring color = L"ffffff";
CP_XML_ATTR(L"w:color",color);
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; return true;
......
...@@ -892,53 +892,25 @@ public: ...@@ -892,53 +892,25 @@ public:
odf_types::common_padding_attlist common_padding_attlist_; odf_types::common_padding_attlist common_padding_attlist_;
odf_types::common_shadow_attlist common_shadow_attlist_; odf_types::common_shadow_attlist common_shadow_attlist_;
// 15.2.10
odf_types::common_background_color_attlist common_background_color_attlist_; odf_types::common_background_color_attlist common_background_color_attlist_;
// 15.2.12 odf_types::common_draw_fill_attlist common_draw_fill_attlist_;
_CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_; _CP_OPT(odf_types::style_ref) style_register_truth_ref_style_name_;
// 15.2.13 TODO
_CP_OPT(std::wstring) style_print_; _CP_OPT(std::wstring) style_print_;
// 15.2.14
_CP_OPT(odf_types::direction) style_print_page_order_; _CP_OPT(odf_types::direction) style_print_page_order_;
// 15.2.15 TODO
_CP_OPT(std::wstring) style_first_page_number_; _CP_OPT(std::wstring) style_first_page_number_;
// 15.2.16
_CP_OPT(odf_types::percent) style_scale_to_; _CP_OPT(odf_types::percent) style_scale_to_;
_CP_OPT(unsigned int) style_scale_to_pages_; _CP_OPT(unsigned int) style_scale_to_pages_;
// 15.2.17
_CP_OPT(odf_types::table_centering) style_table_centering_; _CP_OPT(odf_types::table_centering) style_table_centering_;
// 15.2.18
_CP_OPT(odf_types::length) style_footnote_max_height_; _CP_OPT(odf_types::length) style_footnote_max_height_;
// 15.2.19
odf_types::common_writing_mode_attlist common_writing_mode_attlist_; odf_types::common_writing_mode_attlist common_writing_mode_attlist_;
// 15.2.21
_CP_OPT(odf_types::layout_grid_mode) style_layout_grid_mode_; _CP_OPT(odf_types::layout_grid_mode) style_layout_grid_mode_;
// 15.2.22
_CP_OPT(odf_types::length) style_layout_grid_base_height_; _CP_OPT(odf_types::length) style_layout_grid_base_height_;
// 15.2.23
_CP_OPT(odf_types::length) style_layout_grid_ruby_height_; _CP_OPT(odf_types::length) style_layout_grid_ruby_height_;
// 15.2.24
_CP_OPT(unsigned int) style_layout_grid_lines_; _CP_OPT(unsigned int) style_layout_grid_lines_;
// 15.2.25
_CP_OPT(odf_types::color) style_layout_grid_color_; _CP_OPT(odf_types::color) style_layout_grid_color_;
// 15.2.26
_CP_OPT(bool) style_layout_grid_ruby_below_; _CP_OPT(bool) style_layout_grid_ruby_below_;
// 15.2.27
_CP_OPT(bool) style_layout_grid_print_; _CP_OPT(bool) style_layout_grid_print_;
// 15.2.28
_CP_OPT(bool) style_layout_grid_display_; _CP_OPT(bool) style_layout_grid_display_;
}; };
...@@ -1005,7 +977,7 @@ public: ...@@ -1005,7 +977,7 @@ public:
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context); void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_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() { } style_page_layout_properties() { }
......
...@@ -55,8 +55,7 @@ ...@@ -55,8 +55,7 @@
#include "style_text_properties.h" #include "style_text_properties.h"
#include "style_paragraph_properties.h" #include "style_paragraph_properties.h"
#include "style_graphic_properties.h" #include "style_graphic_properties.h"
#include "style_page_layout_properties.h"
namespace cpdoccore namespace cpdoccore
{ {
...@@ -175,6 +174,7 @@ struct odf_drawing_state ...@@ -175,6 +174,7 @@ struct odf_drawing_state
svg_y_ = boost::none; svg_y_ = boost::none;
svg_height_ = boost::none; svg_height_ = boost::none;
svg_width_ = boost::none; svg_width_ = boost::none;
fill_color_ = boost::none;
name_ = L""; name_ = L"";
description_ = L""; description_ = L"";
...@@ -209,6 +209,7 @@ struct odf_drawing_state ...@@ -209,6 +209,7 @@ struct odf_drawing_state
bool hidden_; bool hidden_;
_CP_OPT(double) rotateAngle; _CP_OPT(double) rotateAngle;
_CP_OPT(unsigned int) fill_color_;
bool flipH; bool flipH;
bool flipV; bool flipV;
...@@ -240,6 +241,7 @@ public: ...@@ -240,6 +241,7 @@ public:
is_header_ = false; is_header_ = false;
is_footer_ = false; is_footer_ = false;
is_background_ = false;
//некоторые свойства для объектов графики не поддерживаюися в редакторах Liber && OpenOffice.net //некоторые свойства для объектов графики не поддерживаюися в редакторах Liber && OpenOffice.net
//в MS Office и в нашем - проблем таких нет. //в MS Office и в нашем - проблем таких нет.
} }
...@@ -254,6 +256,7 @@ public: ...@@ -254,6 +256,7 @@ public:
bool is_footer_; bool is_footer_;
bool is_header_; bool is_header_;
bool is_background_;
void create_draw_base(int type); void create_draw_base(int type);
office_element_ptr create_draw_element(int type); office_element_ptr create_draw_element(int type);
...@@ -309,10 +312,18 @@ void odf_drawing_context::set_header_state(bool Val) ...@@ -309,10 +312,18 @@ void odf_drawing_context::set_header_state(bool Val)
{ {
impl_->is_header_ = 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() void odf_drawing_context::check_anchor()
{ {
return; 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); set_anchor(anchor_type::Char);
//подозрительно на подложку страницы //подозрительно на подложку страницы
...@@ -444,7 +455,18 @@ void odf_drawing_context::start_drawing() ...@@ -444,7 +455,18 @@ void odf_drawing_context::start_drawing()
} }
void odf_drawing_context::end_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()); 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() ...@@ -570,12 +592,13 @@ void odf_drawing_context::end_drawing()
{ {
impl_->tops_elements_.push_back(impl_->current_drawing_state_.elements_[0].elm); impl_->tops_elements_.push_back(impl_->current_drawing_state_.elements_[0].elm);
} }
/////////////// ///////////////
impl_->current_drawing_state_.clear(); impl_->current_drawing_state_.clear();
impl_->current_graphic_properties = NULL; impl_->current_graphic_properties = NULL;
impl_->current_paragraph_properties = NULL; impl_->current_paragraph_properties = NULL;
impl_->current_text_properties = NULL; impl_->current_text_properties = NULL;
} }
//////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////
...@@ -629,7 +652,7 @@ void odf_drawing_context::Impl::create_draw_base(int type) ...@@ -629,7 +652,7 @@ void odf_drawing_context::Impl::create_draw_base(int type)
draw_base* draw = dynamic_cast<draw_base*>(draw_elm.get()); draw_base* draw = dynamic_cast<draw_base*>(draw_elm.get());
if (draw == NULL)return; 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(); office_element_ptr & style_shape_elm = styles_context_->last_state()->get_office_element();
std::wstring style_name; std::wstring style_name;
...@@ -1068,7 +1091,7 @@ void odf_drawing_context::set_no_fill() ...@@ -1068,7 +1091,7 @@ void odf_drawing_context::set_no_fill()
switch(impl_->current_drawing_part_) switch(impl_->current_drawing_part_)
{ {
case Area: 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_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap)) (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) ...@@ -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; 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) void odf_drawing_context::set_solid_fill(std::wstring hexColor)
{ {
if (!impl_->current_graphic_properties)return; if (!impl_->current_graphic_properties)return;
...@@ -1102,7 +1136,7 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor) ...@@ -1102,7 +1136,7 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
impl_->current_graphic_properties->content().common_background_color_attlist_.fo_background_color_ = color(hexColor); impl_->current_graphic_properties->content().common_background_color_attlist_.fo_background_color_ = color(hexColor);
//последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста) //последнее нужно - что если будут вводить текст - под текстом будет цвет фона (или он поменяется в полях текста)
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_) &&
(impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap)) (impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_->get_type() == draw_fill::bitmap))
{ {
...@@ -1119,6 +1153,7 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor) ...@@ -1119,6 +1153,7 @@ void odf_drawing_context::set_solid_fill(std::wstring hexColor)
break; break;
} }
} }
void odf_drawing_context::set_z_order(int id) void odf_drawing_context::set_z_order(int id)
{ {
if (id < 0) if (id < 0)
...@@ -1243,7 +1278,7 @@ void odf_drawing_context::set_object_foreground(bool Val) ...@@ -1243,7 +1278,7 @@ void odf_drawing_context::set_object_foreground(bool Val)
{ {
if (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); impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
} }
...@@ -1273,7 +1308,7 @@ void odf_drawing_context::set_margin_bottom (double valPt) ...@@ -1273,7 +1308,7 @@ void odf_drawing_context::set_margin_bottom (double valPt)
} }
void odf_drawing_context::set_anchor(int type) 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; type = anchor_type::Paragraph;
} }
...@@ -1369,7 +1404,7 @@ void odf_drawing_context::set_horizontal_pos(double offset_pt) ...@@ -1369,7 +1404,7 @@ void odf_drawing_context::set_horizontal_pos(double offset_pt)
} }
void odf_drawing_context::set_default_wrap_style() 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; 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 ...@@ -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) 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_shape(142/*SimpleTypes::shapetypeRect*/);
start_bitmap_style(); start_bitmap_style();
...@@ -2011,7 +2046,7 @@ void odf_drawing_context::set_text_box_parent_style(std::wstring style_name) ...@@ -2011,7 +2046,7 @@ void odf_drawing_context::set_text_box_parent_style(std::wstring style_name)
void odf_drawing_context::end_image() 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_bitmap_style();
end_shape(); end_shape();
...@@ -2179,9 +2214,11 @@ void odf_drawing_context::start_gradient_style() ...@@ -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_; 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.; 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_gradient_name_ = gradient->draw_name_;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::gradient); 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) void odf_drawing_context::set_gradient_type(gradient_style::type style)
{ {
...@@ -2217,7 +2254,7 @@ void odf_drawing_context::set_gradient_angle(double angle) ...@@ -2217,7 +2254,7 @@ 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()); draw_gradient * gradient = dynamic_cast<draw_gradient *>(impl_->styles_context_->last_state(style_family::Gradient)->get_office_element().get());
if (!gradient) return; 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) 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 ...@@ -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) void odf_drawing_context::set_bitmap_link(std::wstring file_path)
{ {
std::wstring odf_ref_name ; 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) if (impl_->current_drawing_state_.oox_shape_preset == 3000)
{ {
......
...@@ -66,6 +66,8 @@ public: ...@@ -66,6 +66,8 @@ public:
void set_header_state (bool Val); void set_header_state (bool Val);
void set_footer_state (bool Val); void set_footer_state (bool Val);
void set_background_state (bool Val);
void check_anchor (); void check_anchor ();
void set_margin_left (double valPt); void set_margin_left (double valPt);
...@@ -173,6 +175,7 @@ public: ...@@ -173,6 +175,7 @@ public:
void set_type_fill (int type);//for area - temp for objects void set_type_fill (int type);//for area - temp for objects
void set_solid_fill (std::wstring hexColor); void set_solid_fill (std::wstring hexColor);
void set_opacity (double percent); void set_opacity (double percent);
////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////
void start_area_properties(); void start_area_properties();
void end_area_properties(); void end_area_properties();
...@@ -187,6 +190,8 @@ public: ...@@ -187,6 +190,8 @@ public:
std::wstring add_marker_style(int type); std::wstring add_marker_style(int type);
void end_line_properties (); void end_line_properties ();
_CP_OPT(unsigned int) get_fill_color ();
void set_fill_color (unsigned int color);
//void start_shadow_properties(); //void start_shadow_properties();
//void end_shadow_properties(); //void end_shadow_properties();
// пока одной функией .. // пока одной функией ..
......
...@@ -170,6 +170,7 @@ private: ...@@ -170,6 +170,7 @@ private:
bool is_header_; bool is_header_;
bool is_footer_; bool is_footer_;
bool is_background_;
std::vector<odf_drawing_context_ptr> drawing_context_; std::vector<odf_drawing_context_ptr> drawing_context_;
std::vector<odf_text_context_ptr> text_context_; //for embedded std::vector<odf_text_context_ptr> text_context_; //for embedded
......
...@@ -124,19 +124,22 @@ void style_page_layout_properties_attlist::serialize(CP_ATTR_NODE) ...@@ -124,19 +124,22 @@ 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-width", fo_page_width_);
CP_XML_ATTR_OPT (L"fo:page-height", fo_page_height_); 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()); 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:paper-tray-name", style_paper_tray_name_);
CP_XML_ATTR_OPT (L"style:print-orientation", style_print_orientation_); CP_XML_ATTR_OPT (L"style:print-orientation", style_print_orientation_);
common_horizontal_margin_attlist_.serialize(CP_GET_XML_NODE()); common_horizontal_margin_attlist_.serialize (CP_GET_XML_NODE());
common_vertical_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_margin_attlist_.serialize (CP_GET_XML_NODE());
common_border_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_border_line_width_attlist_.serialize (CP_GET_XML_NODE());
common_padding_attlist_.serialize(CP_GET_XML_NODE()); common_padding_attlist_.serialize (CP_GET_XML_NODE());
common_shadow_attlist_.serialize(CP_GET_XML_NODE()); common_shadow_attlist_.serialize (CP_GET_XML_NODE());
common_background_color_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: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", style_print_);
...@@ -146,7 +149,9 @@ void style_page_layout_properties_attlist::serialize(CP_ATTR_NODE) ...@@ -146,7 +149,9 @@ void style_page_layout_properties_attlist::serialize(CP_ATTR_NODE)
CP_XML_ATTR_OPT (L"style:scale-to_pages", style_scale_to_pages_); 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:table-centering", style_table_centering_);
CP_XML_ATTR_OPT (L"style:footnote-max-height", style_footnote_max_height_); CP_XML_ATTR_OPT (L"style:footnote-max-height", style_footnote_max_height_);
common_writing_mode_attlist_.serialize(CP_GET_XML_NODE()); 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-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-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-ruby-height", style_layout_grid_ruby_height_);
......
...@@ -62,6 +62,7 @@ public: ...@@ -62,6 +62,7 @@ public:
_CP_OPT(odf_types::length) fo_page_width_; _CP_OPT(odf_types::length) fo_page_width_;
_CP_OPT(odf_types::length) fo_page_height_; _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_attlist common_num_format_attlist_;
odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_; odf_types::common_num_format_prefix_suffix_attlist common_num_format_prefix_suffix_attlist_;
......
...@@ -48,8 +48,6 @@ ...@@ -48,8 +48,6 @@
#include "../OdfFormat/style_text_properties.h" #include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_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; using namespace cpdoccore;
namespace Oox2Odf namespace Oox2Odf
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "../OdfFormat/style_paragraph_properties.h" #include "../OdfFormat/style_paragraph_properties.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h" #include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
#include "../../../DesktopEditor/raster/BgraFrame.h"
#include "VmlShapeTypes2Oox.h" #include "VmlShapeTypes2Oox.h"
...@@ -386,6 +387,9 @@ void OoxConverter::convert(OOX::Vml::CArc *vml_arc) ...@@ -386,6 +387,9 @@ void OoxConverter::convert(OOX::Vml::CArc *vml_arc)
void OoxConverter::convert(OOX::Vml::CBackground *vml_background) void OoxConverter::convert(OOX::Vml::CBackground *vml_background)
{ {
if (vml_background == NULL) return; 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) void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
...@@ -394,6 +398,28 @@ 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(); 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()) if (vml_fill->m_rId.IsInit())
{ {
//bitmap fill //bitmap fill
...@@ -401,19 +427,19 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill) ...@@ -401,19 +427,19 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
{ {
double Width=0, Height = 0; double Width=0, Height = 0;
std::wstring sID = vml_fill->m_rId->GetValue(); std::wstring sID = vml_fill->m_rId->GetValue();
std::wstring pathImage = find_link_by_id(sID,1);
if (!pathImage.empty()) sImagePath = find_link_by_id(sID, 1);
if (!sImagePath.empty())
{ {
odf_context()->drawing_context()->set_bitmap_link(pathImage); odf_context()->drawing_context()->set_bitmap_link( sImagePath );
_graphics_utils_::GetResolution(pathImage.c_str(), Width, Height); _graphics_utils_::GetResolution( sImagePath.c_str(), Width, Height );
} }
odf_context()->drawing_context()->set_image_style_repeat(1); odf_context()->drawing_context()->set_image_style_repeat(1);
} }
odf_context()->drawing_context()->end_bitmap_style(); 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::filltypeGradient :
...@@ -428,10 +454,10 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill) ...@@ -428,10 +454,10 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
if (SimpleTypes::filltypeGradientUnscaled == vml_fill->m_oType.GetValue()) odf_context()->drawing_context()->set_gradient_type(odf_types::gradient_style::square); 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; _CP_OPT(double) no_set;
if (vml_fill->m_oColor.IsInit()) if (sRgbColor1)
odf_context()->drawing_context()->set_gradient_start(vml_fill->m_oColor->ToString(), no_set); odf_context()->drawing_context()->set_gradient_start(*sRgbColor1, no_set);
if (vml_fill->m_oColor2.IsInit()) if (sRgbColor2)
odf_context()->drawing_context()->set_gradient_end(vml_fill->m_oColor2->ToString(), no_set); odf_context()->drawing_context()->set_gradient_end(*sRgbColor2, no_set);
if (vml_fill->m_oFocusPosition.IsInit()) if (vml_fill->m_oFocusPosition.IsInit())
odf_context()->drawing_context()->set_gradient_center(vml_fill->m_oFocusPosition->GetX(), vml_fill->m_oFocusPosition->GetY()); odf_context()->drawing_context()->set_gradient_center(vml_fill->m_oFocusPosition->GetX(), vml_fill->m_oFocusPosition->GetY());
...@@ -439,25 +465,37 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill) ...@@ -439,25 +465,37 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
odf_context()->drawing_context()->end_gradient_style(); odf_context()->drawing_context()->end_gradient_style();
}break; }break;
case SimpleTypes::filltypePattern: 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(); odf_context()->drawing_context()->start_hatch_style();
if (vml_fill->m_oColor2.IsInit()) if (sRgbColor2)
odf_context()->drawing_context()->set_hatch_line_color(vml_fill->m_oColor2->ToString()); odf_context()->drawing_context()->set_hatch_line_color(*sRgbColor2);
if (vml_fill->m_oColor.IsInit()) if (sRgbColor1)
odf_context()->drawing_context()->set_hatch_area_color(vml_fill->m_oColor->ToString()); odf_context()->drawing_context()->set_hatch_area_color(*sRgbColor1);
else else
odf_context()->drawing_context()->set_hatch_area_color(L"#ffffff"); odf_context()->drawing_context()->set_hatch_area_color(L"#ffffff");
odf_context()->drawing_context()->end_hatch_style(); odf_context()->drawing_context()->end_hatch_style();
}
}break; }break;
case SimpleTypes::filltypeSolid: case SimpleTypes::filltypeSolid:
default: default:
if (vml_fill->m_oColor.IsInit()) if (sImagePath.empty() && sRgbColor1)
odf_context()->drawing_context()->set_solid_fill(vml_fill->m_oColor->ToString()); odf_context()->drawing_context()->set_solid_fill(*sRgbColor1);
break; break;
} }
}
//-------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------
if (vml_fill->m_oOpacity.IsInit() && vml_fill->m_oOpacity2.IsInit() ) if (vml_fill->m_oOpacity.IsInit() && vml_fill->m_oOpacity2.IsInit() )
{ {
...@@ -588,7 +626,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke) ...@@ -588,7 +626,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
if (vml_stroke->m_oColor.IsInit()) if (vml_stroke->m_oColor.IsInit())
{ {
std::wstring hexColor = vml_stroke->m_oColor->ToString(); 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); odf_context()->drawing_context()->set_solid_fill(hexColor);
} }
...@@ -818,9 +856,16 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common) ...@@ -818,9 +856,16 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
if (oRgbColor) if (oRgbColor)
{ {
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()->start_area_properties();
odf_context()->drawing_context()->set_solid_fill(oRgbColor->ToString().substr(2));//.Right(6)); odf_context()->drawing_context()->set_solid_fill(oRgbColor->ToString().substr(2));//.Right(6));
odf_context()->drawing_context()->end_area_properties(); odf_context()->drawing_context()->end_area_properties();
delete oRgbColor; delete oRgbColor;
} }
} }
......
...@@ -215,11 +215,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown) ...@@ -215,11 +215,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Vml::CTextbox *vml = static_cast<OOX::Vml::CTextbox*>(oox_unknown); OOX::Vml::CTextbox *vml = static_cast<OOX::Vml::CTextbox*>(oox_unknown);
convert(vml); convert(vml);
}break; }break;
//case OOX::et_v_background: case OOX::et_v_background:
//{ {
// OOX::Vml::CBackground *vml = static_cast<OOX::Vml::CBackground*>(oox_unknown); OOX::Vml::CBackground *vml = static_cast<OOX::Vml::CBackground*>(oox_unknown);
// convert(vml); convert(vml);
//}break; }break;
case OOX::et_v_path: case OOX::et_v_path:
{ {
OOX::Vml::CPath *vml = static_cast<OOX::Vml::CPath*>(oox_unknown); 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) ...@@ -1684,6 +1684,10 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
odt_context->set_background(color, 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()) if (oox_background->m_oDrawing.IsInit())
{ {
convert(oox_background->m_oDrawing.GetPointer()); convert(oox_background->m_oDrawing.GetPointer());
...@@ -1692,6 +1696,8 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type) ...@@ -1692,6 +1696,8 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
{ {
convert(oox_background->m_oBackground.GetPointer()); 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) void DocxConverter::convert(ComplexTypes::Word::CFramePr *oox_frame_pr, odf_writer::style_paragraph_properties * paragraph_properties)
......
...@@ -1930,7 +1930,7 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt ...@@ -1930,7 +1930,7 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt
else if ( L"fLine" == m_sPropName ) m_oShape.m_bLine = ( 0 == nValue ? false : true ); 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"lineStartArrowhead" == m_sPropName ) m_oShape.m_nLineStartArrow = nValue;
else if ( L"lineColor" == m_sPropName ) m_oShape.m_nLineColor = 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"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"lineEndArrowWidth" == m_sPropName ) m_oShape.m_nLineEndArrowWidth = nValue;
......
...@@ -2417,44 +2417,12 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std:: ...@@ -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); std::wstring image_path = context_.get_mediaitems().media_path() + drawing_state->fill.texture_target.substr(6);
int rgbColor1 = STR::hex_str2int(sRgbColor1); size_t rgbColor1 = STR::hex_str2int(sRgbColor1);
int rgbColor2 = STR::hex_str2int(sRgbColor2); size_t rgbColor2 = STR::hex_str2int(sRgbColor2);
CBgraFrame bgraFrame; CBgraFrame bgraFrame;
if (bgraFrame.OpenFile(image_path)) return bgraFrame.ReColorPatternImage(image_path, rgbColor1, rgbColor2);
{
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;
} }
void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm) void xlsx_drawing_context::serialize_vml_HF(std::wostream & strm)
......
...@@ -39,6 +39,8 @@ ...@@ -39,6 +39,8 @@
bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileType) bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileType)
{ {
m_nFileType = nFileType;
if (CXIMAGE_FORMAT_JP2 == nFileType) if (CXIMAGE_FORMAT_JP2 == nFileType)
{ {
Jpeg2000::CJ2kFile oJ2; Jpeg2000::CJ2kFile oJ2;
...@@ -49,7 +51,7 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp ...@@ -49,7 +51,7 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
if (nFileType == 0) if (nFileType == 0)
{ {
CImageFileFormatChecker checker(strFileName); CImageFileFormatChecker checker(strFileName);
nFileType = checker.eFileType; m_nFileType = checker.eFileType;
} }
NSFile::CFileBinary oFile; NSFile::CFileBinary oFile;
if (!oFile.OpenFile(strFileName)) if (!oFile.OpenFile(strFileName))
...@@ -57,7 +59,7 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp ...@@ -57,7 +59,7 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
CxImage img; CxImage img;
if (!img.Decode(oFile.GetFileNative(), nFileType)) if (!img.Decode(oFile.GetFileNative(), m_nFileType))
return false; return false;
CxImageToMediaFrame(img); CxImageToMediaFrame(img);
...@@ -116,7 +118,44 @@ bool CBgraFrame::Resize(const long& nNewWidth, const long& nNewHeight, bool bDes ...@@ -116,7 +118,44 @@ bool CBgraFrame::Resize(const long& nNewWidth, const long& nNewHeight, bool bDes
CxImageToMediaFrame( imgDst ); CxImageToMediaFrame( imgDst );
return true; 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 ) void CBgraFrame::CxImageToMediaFrame( CxImage& img )
{ {
if( !img.IsValid() ) if( !img.IsValid() )
......
...@@ -39,6 +39,8 @@ class CxImage; ...@@ -39,6 +39,8 @@ class CxImage;
class CBgraFrame class CBgraFrame
{ {
private: private:
int m_nFileType;
int m_lWidth; int m_lWidth;
int m_lHeight; int m_lHeight;
int m_lStride; int m_lStride;
...@@ -67,6 +69,7 @@ private: ...@@ -67,6 +69,7 @@ private:
} }
inline void Clear() inline void Clear()
{ {
m_nFileType = 0;
m_lWidth = 0; m_lWidth = 0;
m_lHeight = 0; m_lHeight = 0;
m_lStride = 0; m_lStride = 0;
...@@ -120,7 +123,10 @@ public: ...@@ -120,7 +123,10 @@ public:
public: public:
bool OpenFile(const std::wstring& strFileName, unsigned int nFileType = 0); //0 - detect bool OpenFile(const std::wstring& strFileName, unsigned int nFileType = 0); //0 - detect
bool SaveFile(const std::wstring& strFileName, unsigned int nFileType); 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: private:
void CxImageToMediaFrame( CxImage& img ); void CxImageToMediaFrame( CxImage& img );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment