mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-03-05 02:11:47 +08:00
Compare commits
24 Commits
core-win-3
...
core-win-6
| Author | SHA1 | Date | |
|---|---|---|---|
| c727f0cba8 | |||
| 181f613893 | |||
| 8c4d1cde6c | |||
| 6e515a1ee5 | |||
| 3532d4088d | |||
| eec7ab20fd | |||
| 8b568ddefb | |||
| 708c07c072 | |||
| c7524a2509 | |||
| 90240caa0b | |||
| f8098f1237 | |||
| 760dfbf0d7 | |||
| 784f57dea4 | |||
| e280dcbb27 | |||
| 30986e3c36 | |||
| 6eb596080c | |||
| b45d705e2b | |||
| 21dffa628d | |||
| 1b949a978b | |||
| 17e140debf | |||
| 6452e9956e | |||
| f8ad532f77 | |||
| e05551e679 | |||
| 850959f791 |
@ -188,14 +188,14 @@ public:
|
||||
}
|
||||
void set_position_child_group(_INT32 x, _INT32 y)
|
||||
{
|
||||
if (groups_.size() < 1) return;
|
||||
if (groups_.empty()) return;
|
||||
|
||||
if (groups_.back().x > x) groups_.back().x = x;
|
||||
if (groups_.back().y > y) groups_.back().y = y;
|
||||
}
|
||||
void set_size_child_group(_INT32 cx, _INT32 cy)
|
||||
{
|
||||
if (groups_.size() < 1) return;
|
||||
if (groups_.empty()) return;
|
||||
|
||||
if (groups_.back().cx < cx) groups_.back().cx = cx;
|
||||
if (groups_.back().cy < cy) groups_.back().cy = cy;
|
||||
@ -203,7 +203,7 @@ public:
|
||||
void get_position_group(_INT32 & x, _INT32 & y)
|
||||
{
|
||||
x = y = 0;
|
||||
if (groups_.size() < 1) return;
|
||||
if (groups_.empty()) return;
|
||||
|
||||
x = groups_.back().x;
|
||||
y = groups_.back().y;
|
||||
@ -211,7 +211,7 @@ public:
|
||||
void get_size_group(_INT32 & cx, _INT32 & cy)
|
||||
{
|
||||
cx = cy = 0;
|
||||
if (groups_.size() < 1) return;
|
||||
if (groups_.empty()) return;
|
||||
|
||||
cx = groups_.back().cx;
|
||||
cy = groups_.back().cy;
|
||||
|
||||
@ -152,8 +152,8 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
|
||||
|
||||
if (sExt.empty())
|
||||
{
|
||||
int n = uri.find(L"ObjectReplacements");
|
||||
if (n >= 0)
|
||||
size_t n = uri.find(L"ObjectReplacements");
|
||||
if (n != std::wstring::npos)
|
||||
{
|
||||
if (!isInternal) return L"";
|
||||
|
||||
@ -164,9 +164,9 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
|
||||
if (sExt.empty())
|
||||
{
|
||||
//то что есть ..
|
||||
int n = uri.rfind(L".");
|
||||
if (n > 0)
|
||||
sExt = uri.substr(n);
|
||||
size_t n = uri.rfind(L".");
|
||||
if (n != std::wstring::npos)
|
||||
sExt = XmlUtils::GetLower(uri.substr(n));
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ std::wstring mediaitems::detectImageFileExtension(const std::wstring &fileName)
|
||||
|
||||
if (!sExt.empty()) sExt = std::wstring(L".") + sExt;
|
||||
}
|
||||
return sExt;
|
||||
return XmlUtils::GetLower(sExt);
|
||||
}
|
||||
|
||||
std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, bool & isInternal, std::wstring & ref)
|
||||
@ -268,8 +268,8 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
|
||||
}
|
||||
else if ( type == typeImage)
|
||||
{
|
||||
int n_svm = outputPath.rfind (L".svm");
|
||||
if ( n_svm >= 0 )
|
||||
size_t n_svm = outputPath.rfind (L".svm");
|
||||
if ( n_svm != std::wstring::npos )
|
||||
{
|
||||
outputPath = outputPath.substr(0, n_svm) + L".png";
|
||||
}
|
||||
|
||||
@ -112,7 +112,10 @@ static const std::wstring _ooxShapeType[]=
|
||||
L"curvedConnector3",
|
||||
L"",//3-D shape
|
||||
L"",
|
||||
L"polyline"
|
||||
L"polyline",
|
||||
L"cube",
|
||||
L"ellipse", //sphere
|
||||
L""
|
||||
};
|
||||
|
||||
|
||||
@ -253,15 +256,15 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
|
||||
{
|
||||
values.clear();
|
||||
}
|
||||
//else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
|
||||
//{
|
||||
// names.push_back(L"vf");
|
||||
//}
|
||||
//else if (std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
|
||||
//{
|
||||
// names.push_back(L"hf");
|
||||
// names.push_back(L"vf");
|
||||
//}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
|
||||
{
|
||||
names.push_back(L"vf");
|
||||
}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"pentagon"))
|
||||
{
|
||||
names.push_back(L"hf");
|
||||
names.push_back(L"vf");
|
||||
}
|
||||
else if (std::wstring::npos != shapeGeomPreset.find(L"hexagon"))
|
||||
{
|
||||
names.push_back(L"adj");
|
||||
@ -427,7 +430,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
|
||||
shapeGeomPreset = L"rect";
|
||||
}
|
||||
}
|
||||
else if (sub_type <= 14 && sub_type >= 0)
|
||||
else if (sub_type <= 16 && sub_type >= 0)
|
||||
{
|
||||
shapeGeomPreset = _ooxShapeType[sub_type]; //odf -> oox
|
||||
}
|
||||
@ -521,29 +524,16 @@ void _oox_drawing::serialize_xfrm(std::wostream & strm, const std::wstring & nam
|
||||
|
||||
_CP_OPT(double) dSkewY;
|
||||
odf_reader::GetProperty(additional, L"svg:skewY", dSkewY);
|
||||
|
||||
_CP_OPT(double) dRotateAngle;
|
||||
|
||||
if (dRotate || dSkewX || dSkewY)
|
||||
{
|
||||
double tmp=0;
|
||||
if (dRotate)tmp += *dRotate;
|
||||
//if (dSkewX)tmp += *dSkewX;
|
||||
//if (dSkewY)tmp += (*dSkewY) + 3.1415926;
|
||||
|
||||
dRotateAngle = tmp;
|
||||
}
|
||||
|
||||
CP_XML_NODE(xfrm)
|
||||
{
|
||||
if (dRotateAngle)
|
||||
if (dRotate)
|
||||
{
|
||||
double d =360 - dRotateAngle.get() * 180. / 3.14159265358979323846;
|
||||
d *= 60000; //60 000 per 1 gr - 19.5.5 oox
|
||||
CP_XML_ATTR(L"rot", (int)d);
|
||||
double d = 360 - dRotate.get() * 180. / 3.14159265358979323846;
|
||||
CP_XML_ATTR(L"rot", (int)( d * 60000) ); //60 000 per 1 gr - 19.5.5 oox
|
||||
}
|
||||
_CP_OPT(bool)bVal;
|
||||
if (odf_reader::GetProperty(additional,L"flipH", bVal))
|
||||
if (odf_reader::GetProperty(additional, L"flipH", bVal))
|
||||
CP_XML_ATTR(L"flipH", bVal.get());
|
||||
|
||||
if (odf_reader::GetProperty(additional,L"flipV", bVal))
|
||||
|
||||
@ -42,7 +42,7 @@ namespace oox {
|
||||
|
||||
struct _pptx_comment
|
||||
{
|
||||
size_t x_, y_;
|
||||
int x_, y_;
|
||||
|
||||
int author_id_;
|
||||
int idx_;
|
||||
|
||||
@ -267,21 +267,20 @@ void pptx_slide_context::set_rect(double width_pt, double height_pt, double x_pt
|
||||
impl_->object_description_.svg_rect_ = _rect(width_pt, height_pt, x_pt, y_pt);
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_rotate(double angle)
|
||||
void pptx_slide_context::set_rotate(double angle, bool translate)
|
||||
{
|
||||
set_property(odf_reader::_property(L"svg:rotate",angle));
|
||||
set_property(odf_reader::_property(L"svg:rotate", angle));
|
||||
|
||||
if (impl_->object_description_.svg_rect_)
|
||||
if (impl_->object_description_.svg_rect_ && translate)
|
||||
{
|
||||
//вращение в open office от центральной точки
|
||||
_rect r = impl_->object_description_.svg_rect_.get();
|
||||
//r.x_-=r.width_;
|
||||
//r.y_-=r.height_;
|
||||
|
||||
impl_->object_description_.svg_rect_= r;
|
||||
_rect &r = impl_->object_description_.svg_rect_.get();
|
||||
double new_x = (r.cx / 2 * cos(-angle) - r.cy / 2 * sin(-angle) ) - r.cx / 2;
|
||||
double new_y = (r.cx / 2 * sin(-angle) + r.cy / 2 * cos(-angle) ) - r.cy / 2;
|
||||
|
||||
r.x += new_x;
|
||||
r.y += new_y;
|
||||
}
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_translate(double x_pt, double y_pt)
|
||||
{
|
||||
if (impl_->object_description_.svg_rect_)
|
||||
@ -292,16 +291,7 @@ void pptx_slide_context::set_translate(double x_pt, double y_pt)
|
||||
r.y += y_pt;
|
||||
}
|
||||
}
|
||||
void pptx_slide_context::set_translate_rotate()
|
||||
{
|
||||
if (impl_->object_description_.svg_rect_)
|
||||
{
|
||||
_rect & r = impl_->object_description_.svg_rect_.get();
|
||||
|
||||
r.x -= r.cx / 2;
|
||||
r.y += r.cy / 2;
|
||||
}
|
||||
}
|
||||
|
||||
void pptx_slide_context::set_scale(double cx_pt, double cy_pt)
|
||||
{
|
||||
if (impl_->object_description_.svg_rect_)
|
||||
@ -701,12 +691,10 @@ void pptx_slide_context::Impl::process_common_properties(drawing_object_descript
|
||||
{
|
||||
if (pic.svg_rect_)
|
||||
{
|
||||
int val;
|
||||
//todooo непонятки с отрицательными значениями
|
||||
int val = (int)(0.5 + odf_types::length(pic.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if ( val >= 0) drawing.x = val;
|
||||
|
||||
val = (int)(0.5 + odf_types::length(pic.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if ( val >= 0 ) drawing.y = val;
|
||||
drawing.x = (int)(0.5 + odf_types::length(pic.svg_rect_->x, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
drawing.y = (int)(0.5 + odf_types::length(pic.svg_rect_->y, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
|
||||
val = (int)(0.5 + odf_types::length(pic.svg_rect_->cx, odf_types::length::pt).get_value_unit(odf_types::length::emu));
|
||||
if ( val >=0 ) drawing.cx = val;
|
||||
|
||||
@ -59,12 +59,11 @@ public:
|
||||
void set_transitionAction (bool val);
|
||||
void set_transitionSpeed (std::wstring val);
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
void set_rect (double width_pt, double height_pt, double x_pt, double y_pt);
|
||||
void set_rect (double width_pt, double height_pt, double x_pt, double y_pt);
|
||||
|
||||
void set_translate_rotate();
|
||||
void set_translate (double x_pt, double y_pt);
|
||||
void set_scale (double cx_pt, double cy_pt);
|
||||
void set_rotate (double angle);
|
||||
void set_rotate (double angle, bool translate = false);
|
||||
|
||||
void set_name (std::wstring const & name);
|
||||
void set_anchor (std::wstring anchor, double x_pt, double y_pt);
|
||||
|
||||
@ -361,17 +361,18 @@ void xlsx_drawing_context::set_translate(double x_pt, double y_pt)
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::set_rotate(double angle)
|
||||
void xlsx_drawing_context::set_rotate(double angle, bool translate)
|
||||
{
|
||||
set_property(odf_reader::_property(L"svg:rotate", angle));
|
||||
|
||||
if (impl_->object_description_.svg_rect_)
|
||||
if (impl_->object_description_.svg_rect_ && translate)
|
||||
{
|
||||
_rect & r = impl_->object_description_.svg_rect_.get();
|
||||
_rect &r = impl_->object_description_.svg_rect_.get();
|
||||
double new_x = (r.cx / 2 * cos(-angle) - r.cy / 2 * sin(-angle) ) - r.cx / 2;
|
||||
double new_y = (r.cx / 2 * sin(-angle) + r.cy / 2 * cos(-angle) ) - r.cy / 2;
|
||||
|
||||
//r.x -= r.width_/2;
|
||||
//r.y -= r.height_/2;
|
||||
|
||||
r.x += new_x;
|
||||
r.y += new_y;
|
||||
}
|
||||
}
|
||||
void xlsx_drawing_context::set_scale(double cx_pt, double cy_pt)
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
|
||||
void set_translate (double x_pt, double y_pt);
|
||||
void set_scale (double cx_pt, double cy_pt);
|
||||
void set_rotate (double angle);
|
||||
void set_rotate (double angle, bool translate = false);
|
||||
|
||||
void set_anchor (std::wstring anchor, double x_pt, double y_pt, bool group = false);
|
||||
void set_property (odf_reader::_property p);
|
||||
|
||||
@ -510,7 +510,7 @@ public:
|
||||
_CP_OPT(std::wstring) draw_id_;
|
||||
_CP_OPT(std::wstring) draw_layer_;
|
||||
_CP_OPT(std::wstring) draw_transform_;
|
||||
_CP_OPT(int) draw_z_index_;
|
||||
_CP_OPT(unsigned int) draw_z_index_;
|
||||
_CP_OPT(std::wstring) drawooo_display_;
|
||||
};
|
||||
|
||||
|
||||
@ -619,7 +619,7 @@ void parse_string_to_points(std::wstring str, std::vector<length> & Points)
|
||||
}
|
||||
}
|
||||
|
||||
void oox_convert_transforms(std::wstring transformStr,std::vector<odf_reader::_property> & additional)
|
||||
void docx_convert_transforms(std::wstring transformStr,std::vector<odf_reader::_property> & additional)
|
||||
{
|
||||
std::vector<std::wstring> transforms;
|
||||
|
||||
@ -688,10 +688,10 @@ void xlsx_convert_transforms(std::wstring transformStr, oox::xlsx_conversion_con
|
||||
std::vector<std::wstring> transform;
|
||||
boost::algorithm::split(transform, transforms[i], boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on);
|
||||
|
||||
if (transform.size()>1)//тока с аргументами
|
||||
if (transform.size() > 1)//тока с аргументами
|
||||
{
|
||||
int res=0;
|
||||
if ((res = transform[0].find(L"translate"))>=0)//перемещение
|
||||
size_t res=0;
|
||||
if ((res = transform[0].find(L"translate")) != std::wstring::npos)//перемещение
|
||||
{
|
||||
std::vector<length> Points ;
|
||||
parse_string_to_points(transform[1], Points);
|
||||
@ -705,7 +705,7 @@ void xlsx_convert_transforms(std::wstring transformStr, oox::xlsx_conversion_con
|
||||
Context.get_drawing_context().set_translate(x_pt,y_pt);
|
||||
}
|
||||
}
|
||||
else if ((res = transform[0].find(L"scale"))>=0)//масштабирование
|
||||
else if ((res = transform[0].find(L"scale")) != std::wstring::npos)//масштабирование
|
||||
{
|
||||
std::vector<length> Points ;
|
||||
parse_string_to_points(transform[1], Points);
|
||||
@ -718,19 +718,19 @@ void xlsx_convert_transforms(std::wstring transformStr, oox::xlsx_conversion_con
|
||||
Context.get_drawing_context().set_scale(x_pt,y_pt);
|
||||
}
|
||||
}
|
||||
else if ((res = transform[0].find(L"rotate"))>=0)//вращение
|
||||
else if ((res = transform[0].find(L"rotate")) != std::wstring::npos)//вращение
|
||||
{
|
||||
Context.get_drawing_context().set_rotate(boost::lexical_cast<double>(transform[1]));
|
||||
Context.get_drawing_context().set_rotate(boost::lexical_cast<double>(transform[1]), true);
|
||||
}
|
||||
else if ((res = transform[0].find(L"skewX"))>=0)//сдвиг
|
||||
else if ((res = transform[0].find(L"skewX")) != std::wstring::npos)//сдвиг
|
||||
{
|
||||
double angle = boost::lexical_cast<double>(transform[1]);
|
||||
Context.get_drawing_context().set_property(_property(L"svg:skewX",angle));
|
||||
Context.get_drawing_context().set_property(_property(L"svg:skewX", angle));
|
||||
}
|
||||
else if ((res = transform[0].find(L"skewY"))>=0)//сдвиг
|
||||
else if ((res = transform[0].find(L"skewY")) != std::wstring::npos)//сдвиг
|
||||
{
|
||||
double angle = boost::lexical_cast<double>(transform[1]);
|
||||
Context.get_drawing_context().set_property(_property(L"svg:skewY",angle));
|
||||
Context.get_drawing_context().set_property(_property(L"svg:skewY", angle));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -748,7 +748,7 @@ void pptx_convert_transforms(std::wstring transformStr, oox::pptx_conversion_con
|
||||
std::vector<std::wstring> transform;
|
||||
boost::algorithm::split(transform, transforms[i], boost::algorithm::is_any_of(L"("), boost::algorithm::token_compress_on);
|
||||
|
||||
if (transform.size()>1)//тока с аргументами
|
||||
if (transform.size() > 1)//тока с аргументами
|
||||
{
|
||||
size_t res = 0;
|
||||
if ((res = transform[0].find(L"translate")) != std::wstring::npos)//перемещение
|
||||
@ -781,8 +781,7 @@ void pptx_convert_transforms(std::wstring transformStr, oox::pptx_conversion_con
|
||||
}
|
||||
else if ((res = transform[0].find(L"rotate")) != std::wstring::npos)//вращение
|
||||
{
|
||||
Context.get_slide_context().set_rotate( boost::lexical_cast<double>(transform[1]));
|
||||
Context.get_slide_context().set_translate_rotate();
|
||||
Context.get_slide_context().set_rotate( boost::lexical_cast<double>(transform[1]), true);
|
||||
}
|
||||
else if ((res = transform[0].find(L"skewX")) != std::wstring::npos)//вращение
|
||||
{
|
||||
|
||||
@ -111,10 +111,9 @@ private:
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(draw_a);
|
||||
|
||||
void xlsx_convert_transforms(std::wstring transformStr, oox::xlsx_conversion_context & Context);
|
||||
void docx_convert_transforms(std::wstring transformStr, std::vector<odf_reader::_property> & additional);
|
||||
void pptx_convert_transforms(std::wstring transformStr, oox::pptx_conversion_context & Context);
|
||||
void oox_convert_transforms(std::wstring transformStr,std::vector<odf_reader::_property> & additional);
|
||||
//void docx_convert_transforms(std::wstring transformStr, oox::xlsx_conversion_context & Context);
|
||||
void xlsx_convert_transforms(std::wstring transformStr, oox::xlsx_conversion_context & Context);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,48 +163,65 @@ void draw_g::add_child_element( xml::sax * Reader, const std::wstring & Ns, cons
|
||||
|
||||
if (group)
|
||||
{
|
||||
int x=0, y=0, cx=0, cy=0;
|
||||
x = get_value_emu(group->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(group->common_draw_attlists_.position_.svg_y_);
|
||||
int x = 0, y = 0, cx = 0, cy = 0;
|
||||
if (group->common_draw_attlists_.position_.svg_x_ && group->common_draw_attlists_.position_.svg_y_)
|
||||
{
|
||||
x = get_value_emu(group->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(group->common_draw_attlists_.position_.svg_y_);
|
||||
}
|
||||
else
|
||||
{
|
||||
x = group->position_child_x1;
|
||||
y = group->position_child_y1;
|
||||
}
|
||||
|
||||
cx = get_value_emu(group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
if (position_child_x1 > x || position_child_x1 < 0) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 < 0) position_child_y1 = y;
|
||||
if (group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_ &&
|
||||
group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_)
|
||||
{
|
||||
cx = get_value_emu(group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(group->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
}
|
||||
else
|
||||
{
|
||||
cx = group->position_child_x2 - group->position_child_x1;
|
||||
cy = group->position_child_y2 - group->position_child_y1;
|
||||
}
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 < 0) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 < 0) position_child_y2 = y + cy;
|
||||
if (position_child_x1 > x || position_child_x1 == 0x7fffffff) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 == 0x7fffffff) position_child_y1 = y;
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 == 0x7fffffff) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 == 0x7fffffff) position_child_y2 = y + cy;
|
||||
}
|
||||
else if (frame)
|
||||
{
|
||||
int x=0, y=0, cx=0, cy=0;
|
||||
int x = 0, y = 0, cx = 0, cy = 0;
|
||||
x = get_value_emu(frame->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(frame->common_draw_attlists_.position_.svg_y_);
|
||||
|
||||
cx = get_value_emu(frame->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(frame->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
if (position_child_x1 > x || position_child_x1 < 0) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 < 0) position_child_y1 = y;
|
||||
if (position_child_x1 > x || position_child_x1 == 0x7fffffff) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 == 0x7fffffff) position_child_y1 = y;
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 < 0) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 < 0) position_child_y2 = y + cy;
|
||||
if (position_child_x2 < x + cx || position_child_x2 == 0x7fffffff) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 == 0x7fffffff) position_child_y2 = y + cy;
|
||||
}
|
||||
else if (shape)
|
||||
{
|
||||
int x=0, y=0, cx=0, cy=0;
|
||||
int x = 0, y = 0, cx = 0, cy = 0;
|
||||
x = get_value_emu(shape->common_draw_attlists_.position_.svg_x_);
|
||||
y = get_value_emu(shape->common_draw_attlists_.position_.svg_y_);
|
||||
|
||||
cx = get_value_emu(shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
cy = get_value_emu(shape->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
if (position_child_x1 > x || position_child_x1 < 0) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 < 0) position_child_y1 = y;
|
||||
if (position_child_x1 > x || position_child_x1 == 0x7fffffff) position_child_x1 = x;
|
||||
if (position_child_y1 > y || position_child_y1 == 0x7fffffff) position_child_y1 = y;
|
||||
|
||||
if (position_child_x2 < x + cx || position_child_x2 < 0) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 < 0) position_child_y2 = y + cy;
|
||||
if (position_child_x2 < x + cx || position_child_x2 == 0x7fffffff) position_child_x2 = x + cx;
|
||||
if (position_child_y2 < y + cy || position_child_y2 == 0x7fffffff) position_child_y2 = y + cy;
|
||||
}
|
||||
}
|
||||
|
||||
@ -355,6 +372,8 @@ void draw_object_ole::detectObject(const std::wstring &fileName, std::wstring &p
|
||||
POLE::Storage *storage = new POLE::Storage(fileName.c_str());
|
||||
if ((storage) && (storage->open(false, false) == true))
|
||||
{
|
||||
rels = oox::typeOleObject;
|
||||
|
||||
std::wstring prog;
|
||||
POLE::Stream* pStream = new POLE::Stream(storage, L"CompObj");
|
||||
if ((pStream) && (pStream->size() > 28))
|
||||
|
||||
@ -209,7 +209,7 @@ public:
|
||||
static const ElementType type = typeDrawG;
|
||||
CPDOCCORE_DEFINE_VISITABLE();
|
||||
|
||||
draw_g() : position_child_x1(-1), position_child_y1(-1), position_child_x2(-1), position_child_y2(-1) {}
|
||||
draw_g() : position_child_x1(0x7fffffff), position_child_y1(0x7fffffff), position_child_x2(0x7fffffff), position_child_y2(0x7fffffff) {}
|
||||
|
||||
virtual std::wostream & text_to_stream(std::wostream & _Wostream) const;
|
||||
|
||||
|
||||
@ -574,11 +574,7 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties,
|
||||
const graphic_format_properties & graphicProperties,
|
||||
const std::vector<odf_reader::_property> & additional)
|
||||
{
|
||||
// TODO : recursive result!!!
|
||||
const _CP_OPT(anchor_type) anchor =
|
||||
attlists_.shape_with_text_and_styles_.
|
||||
common_text_anchor_attlist_.
|
||||
type_;
|
||||
const _CP_OPT(anchor_type) anchor = attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
|
||||
|
||||
//todooo пока не ясно как привязать к определеной странице в документе ...
|
||||
//const _CP_OPT(unsigned int) anchor_page_number =
|
||||
@ -589,6 +585,15 @@ int ComputeMarginY(const style_page_layout_properties_attlist & pageProperties,
|
||||
_CP_OPT(vertical_rel) styleVerticalRel = graphicProperties.common_vertical_rel_attlist_.style_vertical_rel_;
|
||||
_CP_OPT(vertical_pos) styleVerticallPos = graphicProperties.common_vertical_pos_attlist_.style_vertical_pos_;
|
||||
|
||||
if (!styleVerticalRel && anchor)
|
||||
{
|
||||
switch(anchor->get_type())
|
||||
{
|
||||
case anchor_type::Paragraph: styleVerticalRel = vertical_rel::Paragraph; break;
|
||||
case anchor_type::Page: styleVerticalRel = vertical_rel::Page; break;
|
||||
}
|
||||
}
|
||||
|
||||
_CP_OPT(double) dVal;
|
||||
GetProperty(additional, L"svg:translate_y", dVal);
|
||||
|
||||
@ -817,14 +822,31 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
}
|
||||
|
||||
_CP_OPT(run_through) styleRunThrough = graphicProperties.style_run_through_;
|
||||
_CP_OPT(anchor_type) anchor = attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
|
||||
|
||||
drawing->styleHorizontalRel = graphicProperties.common_horizontal_rel_attlist_.style_horizontal_rel_;
|
||||
drawing->styleHorizontalPos = graphicProperties.common_horizontal_pos_attlist_.style_horizontal_pos_;
|
||||
drawing->styleVerticalPos = graphicProperties.common_vertical_pos_attlist_.style_vertical_pos_;
|
||||
drawing->styleVerticalRel = graphicProperties.common_vertical_rel_attlist_.style_vertical_rel_;
|
||||
|
||||
_CP_OPT(anchor_type) anchor = attlists_.shape_with_text_and_styles_.common_text_anchor_attlist_.type_;
|
||||
|
||||
|
||||
if (!drawing->styleVerticalRel && anchor)
|
||||
{
|
||||
switch(anchor->get_type())
|
||||
{
|
||||
case anchor_type::Paragraph: drawing->styleVerticalRel = vertical_rel::Paragraph; break;
|
||||
case anchor_type::Page: drawing->styleVerticalRel = vertical_rel::Page; break;
|
||||
case anchor_type::Char: drawing->styleVerticalRel = vertical_rel::Char; break;
|
||||
}
|
||||
}
|
||||
if (!drawing->styleHorizontalRel && anchor)
|
||||
{
|
||||
switch(anchor->get_type())
|
||||
{
|
||||
case anchor_type::Paragraph: drawing->styleHorizontalRel = horizontal_rel::Paragraph; break;
|
||||
case anchor_type::Page: drawing->styleHorizontalRel = horizontal_rel::Page; break;
|
||||
case anchor_type::Char: drawing->styleHorizontalRel = horizontal_rel::Char; break;
|
||||
}
|
||||
}
|
||||
int level_drawing = Context.get_drawing_context().get_current_level();
|
||||
|
||||
if (drawing->parallel == 1 || anchor && anchor->get_type() == anchor_type::AsChar || level_drawing >1 )
|
||||
@ -834,7 +856,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
if (attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_transform_)
|
||||
{
|
||||
std::wstring transformStr = attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_transform_.get();
|
||||
oox_convert_transforms(transformStr, drawing->additional);
|
||||
docx_convert_transforms(transformStr, drawing->additional);
|
||||
}
|
||||
if (!drawing->isInline)
|
||||
{
|
||||
@ -852,7 +874,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
if (!drawing->styleWrap)
|
||||
drawing->styleWrap = style_wrap(style_wrap::Parallel);//у опен офис и мс разные дефолты
|
||||
|
||||
_CP_OPT(int) zIndex = attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_;
|
||||
_CP_OPT(unsigned int) zIndex = attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_.draw_z_index_;
|
||||
|
||||
if (zIndex)//порядок отрисовки объектов
|
||||
{
|
||||
@ -887,7 +909,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
}
|
||||
drawing->number_wrapped_paragraphs = graphicProperties.style_number_wrapped_paragraphs_.
|
||||
get_value_or( integer_or_nolimit( integer_or_nolimit::NoLimit) ).get_value();
|
||||
if (anchor && anchor->get_type() == anchor_type::AsChar && drawing->posOffsetV< 0)
|
||||
if (anchor && anchor->get_type() == anchor_type::AsChar && drawing->posOffsetV < 0)
|
||||
{
|
||||
drawing->posOffsetV = (int)(length(0.01, length::cm).get_value_unit(length::emu));
|
||||
}
|
||||
@ -936,14 +958,41 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
drawing->cx = get_value_emu(attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
|
||||
drawing->cy = get_value_emu(attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
|
||||
|
||||
_CP_OPT(double) dVal;
|
||||
|
||||
GetProperty(drawing->additional, L"svg:rotate", dVal);
|
||||
if (dVal)
|
||||
{
|
||||
double new_x = (drawing->cx / 2 * cos(-(*dVal)) - drawing->cy / 2 * sin(-(*dVal)) ) - drawing->cx / 2;
|
||||
double new_y = (drawing->cx / 2 * sin(-(*dVal)) + drawing->cy / 2 * cos(-(*dVal)) ) - drawing->cy / 2;
|
||||
|
||||
drawing->x += new_x;
|
||||
drawing->y += new_y;
|
||||
}
|
||||
|
||||
GetProperty(drawing->additional, L"svg:scale_x",dVal);
|
||||
if (dVal)drawing->cx = (int)(0.5 + drawing->cx * dVal.get());
|
||||
|
||||
GetProperty(drawing->additional, L"svg:scale_y",dVal);
|
||||
if (dVal)drawing->cy = (int)(0.5 + drawing->cy * dVal.get());
|
||||
|
||||
GetProperty(drawing->additional, L"svg:translate_x", dVal);
|
||||
if (dVal)
|
||||
{
|
||||
drawing->x += get_value_emu(dVal.get());
|
||||
}
|
||||
GetProperty(drawing->additional, L"svg:translate_y", dVal);
|
||||
if (dVal)
|
||||
{
|
||||
drawing->y += get_value_emu(dVal.get());
|
||||
}
|
||||
|
||||
if (drawing->cx < 0) //frame textbox int WORD_EXAMPLE.odt = 45 inch !!!!
|
||||
{
|
||||
drawing->cx = -drawing->cx;
|
||||
drawing->additional.push_back(_property(L"fit-to-size", true));
|
||||
}
|
||||
|
||||
if (drawing->cy < 0)
|
||||
drawing->cy = 0;
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
if ((drawing->styleWrap) && (drawing->styleWrap->get_type() == style_wrap::Dynamic)) //автоподбор
|
||||
{
|
||||
@ -988,28 +1037,6 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, union_comm
|
||||
//}
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
_CP_OPT(double) dVal;
|
||||
|
||||
GetProperty(drawing->additional, L"svg:scale_x",dVal);
|
||||
if (dVal)drawing->cx = (int)(0.5 + drawing->cx * dVal.get());
|
||||
|
||||
GetProperty(drawing->additional, L"svg:scale_y",dVal);
|
||||
if (dVal)drawing->cy = (int)(0.5 + drawing->cy * dVal.get());
|
||||
|
||||
GetProperty(drawing->additional, L"svg:translate_x", dVal);
|
||||
if (dVal)
|
||||
{
|
||||
int val = get_value_emu(dVal.get());
|
||||
drawing->x = val >= 0 ? val : 0; //??? todooo отрицательные величины ...
|
||||
}
|
||||
|
||||
GetProperty(drawing->additional, L"svg:translate_y", dVal);
|
||||
if (dVal)
|
||||
{
|
||||
int val = get_value_emu(dVal.get());
|
||||
drawing->y = val >= 0 ? val : 0; //??? todooo отрицательные величины ...
|
||||
}
|
||||
|
||||
if (drawing->inGroup && drawing->type != oox::typeGroupShape)
|
||||
{
|
||||
_INT32 x_group_offset, y_group_offset;
|
||||
@ -1116,7 +1143,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
return;
|
||||
|
||||
std::wstring href = xlink_attlist_.href_.get_value_or(L"");
|
||||
int pos_replaicement = href.find(L"ObjectReplacements");
|
||||
size_t pos_replaicement = href.find(L"ObjectReplacements");
|
||||
|
||||
const draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner
|
||||
if (!frame)
|
||||
@ -1125,7 +1152,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
|
||||
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
|
||||
if (!drawing) return;
|
||||
|
||||
if (pos_replaicement >= 0)
|
||||
if (pos_replaicement != std::wstring::npos)
|
||||
{
|
||||
if (!Context.get_drawing_context().get_use_image_replace())
|
||||
return; //skip replacement image (math, chart, ...) - возможно записать как альтернативный контент - todooo ???
|
||||
@ -1352,11 +1379,15 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
|
||||
Context.reset_context_state();
|
||||
|
||||
if (position_child_x1 >= 0 && position_child_y1 >= 0 )
|
||||
if (position_child_x1 != 0x7fffffff && position_child_y1 != 0x7fffffff )
|
||||
{
|
||||
Context.get_drawing_context().set_position_child_group (position_child_x1, position_child_y1);
|
||||
|
||||
if (position_child_x2 >= 0 && position_child_y2 >= 0 )
|
||||
Context.get_drawing_context().set_size_child_group (position_child_x2, position_child_y2);
|
||||
if (position_child_x2 != 0x7fffffff && position_child_y2 != 0x7fffffff )
|
||||
{
|
||||
Context.get_drawing_context().set_size_child_group (position_child_x2 - position_child_x1, position_child_y2 - position_child_y1);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < content_.size(); i++)
|
||||
{
|
||||
@ -1370,10 +1401,7 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
|
||||
//--------------------------------------------------
|
||||
Context.get_drawing_context().get_size_group (drawing.cx , drawing.cy);
|
||||
Context.get_drawing_context().get_position_group(drawing.x , drawing.y);
|
||||
|
||||
drawing.cx -= drawing.x;
|
||||
drawing.cy -= drawing.y;
|
||||
|
||||
|
||||
Context.get_drawing_context().stop_group();
|
||||
|
||||
if (drawing.inGroup)
|
||||
@ -1649,7 +1677,7 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
|
||||
if (!drawing) return;
|
||||
|
||||
std::wstring extension;
|
||||
detectObject(href, drawing->objectProgId, extension, drawing->type);
|
||||
detectObject(objectPath, drawing->objectProgId, extension, drawing->type);
|
||||
|
||||
NSFile::CFileBinary::Copy(objectPath, objectPath + extension);
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
common_shape_draw_attlist &common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_;
|
||||
common_presentation_attlist &common_presentation_attlist_= common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
|
||||
|
||||
const int z_index = common_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const unsigned int z_index = common_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const std::wstring name = common_draw_attlist_.draw_name_.get_value_or(L"");
|
||||
const std::wstring textStyleName = common_draw_attlist_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
@ -115,7 +115,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
if (common_draw_attlist_.draw_transform_)
|
||||
{
|
||||
std::wstring transformStr = common_draw_attlist_.draw_transform_.get();
|
||||
pptx_convert_transforms(transformStr,Context);
|
||||
pptx_convert_transforms(transformStr, Context);
|
||||
}
|
||||
////////////////////////////////////////
|
||||
std::wstring Anchor;
|
||||
@ -125,7 +125,7 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
const double a_x_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_x_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
const double a_y_pt = common_draw_attlists_.shape_with_text_and_styles_.common_shape_table_attlist_.table_end_y_.get_value_or(length(0)).get_value_unit(length::pt);
|
||||
|
||||
Context.get_slide_context().set_anchor(Anchor,a_x_pt,a_y_pt);
|
||||
Context.get_slide_context().set_anchor(Anchor, a_x_pt, a_y_pt);
|
||||
}
|
||||
//////////////////////////////////////////////
|
||||
std::vector<const odf_reader::style_instance *> instances;
|
||||
|
||||
@ -73,8 +73,8 @@ void draw_g::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
|
||||
|
||||
const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
|
||||
const unsigned int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
Context.get_drawing_context().start_group( name);
|
||||
@ -118,7 +118,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
|
||||
|
||||
const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const unsigned int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
|
||||
const std::wstring styleName = common_draw_attlist_.common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
|
||||
const std::wstring textStyleName = common_draw_attlist_.common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
|
||||
@ -144,7 +144,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
if (common_draw_attlist_.common_shape_draw_attlist_.draw_transform_)
|
||||
{
|
||||
std::wstring transformStr = common_draw_attlist_.common_shape_draw_attlist_.draw_transform_.get();
|
||||
xlsx_convert_transforms(transformStr,Context);
|
||||
xlsx_convert_transforms(transformStr, Context);
|
||||
}
|
||||
////////////////////////////////////////
|
||||
std::wstring Anchor;
|
||||
|
||||
@ -492,6 +492,8 @@ void draw_enhanced_geometry_attlist::add_attributes( const xml::attributes_wc_pt
|
||||
CP_APPLY_ATTR(L"draw:enhanced-path" , draw_enhanced_path_);
|
||||
CP_APPLY_ATTR(L"drawooo:enhanced-path" , drawooo_enhanced_path_);
|
||||
CP_APPLY_ATTR(L"drawooo:sub-view-size" , drawooo_sub_view_size_);
|
||||
CP_APPLY_ATTR(L"draw:mirror-horizontal" , draw_mirror_horizontal_);
|
||||
CP_APPLY_ATTR(L"draw:mirror-vertical" , draw_mirror_vertical_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:enhanced_geometry
|
||||
@ -501,7 +503,7 @@ const wchar_t * draw_enhanced_geometry::name = L"enhanced-geometry";
|
||||
|
||||
void draw_enhanced_geometry::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_enhanced_geometry_attlist_.add_attributes(Attributes);
|
||||
attlist_.add_attributes(Attributes);
|
||||
CP_APPLY_ATTR(L"svg:viewBox", svg_viewbox_);
|
||||
}
|
||||
|
||||
@ -525,20 +527,20 @@ void draw_enhanced_geometry::add_child_element( xml::sax * Reader, const std::ws
|
||||
}
|
||||
void draw_enhanced_geometry::find_draw_type_oox()
|
||||
{
|
||||
word_art_ = false;
|
||||
bOoxType_ = false;
|
||||
word_art_ = false;
|
||||
bOoxType_ = false;
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.draw_text_path_ &&
|
||||
*draw_enhanced_geometry_attlist_.draw_text_path_ == true)
|
||||
if (attlist_.draw_text_path_ &&
|
||||
*attlist_.draw_text_path_ == true)
|
||||
{
|
||||
draw_type_oox_index_ = 0;
|
||||
word_art_ = true;
|
||||
sub_type_ = 1;
|
||||
}
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.draw_type_)
|
||||
if (attlist_.draw_type_)
|
||||
{
|
||||
std::wstring odf_type = draw_enhanced_geometry_attlist_.draw_type_.get();
|
||||
std::wstring odf_type = attlist_.draw_type_.get();
|
||||
|
||||
if (word_art_)
|
||||
{
|
||||
@ -561,7 +563,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
|
||||
|
||||
if (pos == std::wstring::npos)
|
||||
{
|
||||
for (long i = 0; i< count; i++)
|
||||
for (long i = 0; i < count; i++)
|
||||
{
|
||||
if (_OO_OOX_custom_shapes[i].odf_reader == odf_type)
|
||||
{
|
||||
@ -762,6 +764,38 @@ void dr3d_light::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
CP_APPLY_ATTR(L"dr3d:enabled", dr3d_enabled_);
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:cube
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_cube::ns = L"dr3d";
|
||||
const wchar_t * dr3d_cube::name = L"cube";
|
||||
|
||||
void dr3d_cube::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
CP_APPLY_ATTR(L"dr3d:max-edge", dr3d_max_edge_);
|
||||
CP_APPLY_ATTR(L"dr3d:min-edge", dr3d_min_edge_);
|
||||
CP_APPLY_ATTR(L"dr3d:transform", dr3d_transform_);
|
||||
|
||||
sub_type_ = 15;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// dr3d:sphere
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * dr3d_sphere::ns = L"dr3d";
|
||||
const wchar_t * dr3d_sphere::name = L"sphere";
|
||||
|
||||
void dr3d_sphere::add_attributes( const xml::attributes_wc_ptr & Attributes )
|
||||
{
|
||||
draw_shape::add_attributes(Attributes);
|
||||
|
||||
CP_APPLY_ATTR(L"dr3d:size", dr3d_size_); //vector3D
|
||||
CP_APPLY_ATTR(L"dr3d:center", dr3d_center_); //vector3D
|
||||
CP_APPLY_ATTR(L"dr3d:transform",dr3d_transform_);
|
||||
|
||||
sub_type_ = 16;
|
||||
}
|
||||
//-------------------------------------------------------------------------------------------
|
||||
// draw:control
|
||||
//-------------------------------------------------------------------------------------------
|
||||
const wchar_t * draw_control::ns = L"draw";
|
||||
|
||||
@ -455,6 +455,8 @@ public:
|
||||
_CP_OPT(std::wstring) draw_enhanced_path_;
|
||||
_CP_OPT(std::wstring) drawooo_enhanced_path_;
|
||||
_CP_OPT(std::wstring) drawooo_sub_view_size_;
|
||||
_CP_OPT(bool) draw_mirror_horizontal_;
|
||||
_CP_OPT(bool) draw_mirror_vertical_;
|
||||
};
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
class draw_enhanced_geometry : public office_element_impl<draw_enhanced_geometry>
|
||||
@ -476,7 +478,7 @@ public:
|
||||
|
||||
void find_draw_type_oox();
|
||||
|
||||
draw_enhanced_geometry_attlist draw_enhanced_geometry_attlist_;
|
||||
draw_enhanced_geometry_attlist attlist_;
|
||||
|
||||
_CP_OPT(int) sub_type_;
|
||||
_CP_OPT(int) draw_type_oox_index_;
|
||||
@ -641,13 +643,61 @@ public:
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
_CP_OPT(std::wstring) dr3d_diffuse_color_;
|
||||
_CP_OPT(std::wstring) dr3d_direction_;
|
||||
_CP_OPT(std::wstring) dr3d_specular_;
|
||||
_CP_OPT(odf_types::Bool)dr3d_enabled_;
|
||||
_CP_OPT(std::wstring) dr3d_diffuse_color_;
|
||||
_CP_OPT(std::wstring) dr3d_direction_;
|
||||
_CP_OPT(odf_types::Bool) dr3d_specular_;
|
||||
_CP_OPT(odf_types::Bool) dr3d_enabled_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_light);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
class dr3d_cube : public draw_shape
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDr3dCube;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
_CP_OPT(std::wstring) dr3d_max_edge_;
|
||||
_CP_OPT(std::wstring) dr3d_min_edge_;
|
||||
_CP_OPT(std::wstring) dr3d_transform_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_cube);
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
class dr3d_sphere : public draw_shape
|
||||
{
|
||||
public:
|
||||
static const wchar_t * ns;
|
||||
static const wchar_t * name;
|
||||
|
||||
static const ElementType type = typeDr3dSphere;
|
||||
static const xml::NodeType xml_type = xml::typeElement;
|
||||
|
||||
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name){}
|
||||
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
|
||||
|
||||
virtual void xlsx_convert(oox::xlsx_conversion_context & Context);
|
||||
virtual void docx_convert(oox::docx_conversion_context & Context);
|
||||
virtual void pptx_convert(oox::pptx_conversion_context & Context);
|
||||
|
||||
_CP_OPT(std::wstring) dr3d_size_; //vector3D
|
||||
_CP_OPT(std::wstring) dr3d_center_; //vector3D
|
||||
_CP_OPT(std::wstring) dr3d_transform_;
|
||||
|
||||
};
|
||||
CP_REGISTER_OFFICE_ELEMENT2(dr3d_sphere);
|
||||
//----------------------------------------------------------------------------------------------
|
||||
class draw_control : public draw_shape
|
||||
{
|
||||
|
||||
@ -288,6 +288,14 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
|
||||
bool set_shape = false;
|
||||
|
||||
if (attlist_.draw_mirror_horizontal_)
|
||||
{
|
||||
shape->additional_.push_back(_property(L"flipH", *attlist_.draw_mirror_horizontal_));
|
||||
}
|
||||
if (attlist_.draw_mirror_vertical_)
|
||||
{
|
||||
shape->additional_.push_back(_property(L"flipV", *attlist_.draw_mirror_vertical_));
|
||||
}
|
||||
if (draw_type_oox_index_)
|
||||
{
|
||||
shape->additional_.push_back(_property(L"oox-geom-index", draw_type_oox_index_.get()));
|
||||
@ -305,10 +313,10 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
set_shape = true;
|
||||
}
|
||||
std::wstring odf_path; //общая часть - объединить ...
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_enhanced_path_)
|
||||
odf_path = draw_enhanced_geometry_attlist_.drawooo_enhanced_path_.get();
|
||||
else if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
|
||||
odf_path = draw_enhanced_geometry_attlist_.draw_enhanced_path_.get();
|
||||
if (attlist_.drawooo_enhanced_path_)
|
||||
odf_path = attlist_.drawooo_enhanced_path_.get();
|
||||
else if (attlist_.draw_enhanced_path_)
|
||||
odf_path = attlist_.draw_enhanced_path_.get();
|
||||
|
||||
if (!odf_path.empty())
|
||||
{
|
||||
@ -339,10 +347,10 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)
|
||||
if (attlist_.drawooo_sub_view_size_)
|
||||
{
|
||||
std::vector< std::wstring > splitted;
|
||||
boost::algorithm::split(splitted, *draw_enhanced_geometry_attlist_.drawooo_sub_view_size_, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(splitted, *attlist_.drawooo_sub_view_size_, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
|
||||
if (splitted.size() == 2)
|
||||
{
|
||||
@ -375,10 +383,10 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
|
||||
}
|
||||
}
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.draw_modifiers_)
|
||||
if (attlist_.draw_modifiers_)
|
||||
{
|
||||
if (bOoxType_)
|
||||
shape->additional_.push_back(_property(L"oox-draw-modifiers", draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
|
||||
shape->additional_.push_back(_property(L"oox-draw-modifiers", attlist_.draw_modifiers_.get()));
|
||||
else
|
||||
{
|
||||
}
|
||||
@ -406,6 +414,14 @@ void dr3d_scene::docx_convert(oox::docx_conversion_context & Context)
|
||||
void dr3d_light::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
|
||||
}
|
||||
void dr3d_cube::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
|
||||
}
|
||||
void dr3d_sphere::docx_convert(oox::docx_conversion_context & Context)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -68,7 +68,7 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
|
||||
common_shape_draw_attlist &common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_.common_shape_draw_attlist_;
|
||||
common_presentation_attlist &common_presentation_attlist_= common_draw_attlists_.shape_with_text_and_styles_.common_presentation_attlist_;
|
||||
|
||||
const int z_index = common_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const unsigned int z_index = common_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const std::wstring name = common_draw_attlist_.draw_name_.get_value_or(L"");
|
||||
const std::wstring textStyleName = common_draw_attlist_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
@ -92,8 +92,7 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
|
||||
if (common_draw_attlist_.draw_transform_)
|
||||
{
|
||||
std::wstring transformStr = common_draw_attlist_.draw_transform_.get();
|
||||
pptx_convert_transforms(transformStr,Context);
|
||||
//oox_convert_transforms(transformStr, additional_);
|
||||
pptx_convert_transforms(transformStr, Context);
|
||||
}
|
||||
////////////////////////////////////////
|
||||
std::wstring Anchor;
|
||||
@ -341,6 +340,14 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
|
||||
bool set_shape = false;
|
||||
|
||||
if (attlist_.draw_mirror_horizontal_)
|
||||
{
|
||||
Context.get_slide_context().set_property(_property(L"flipH", *attlist_.draw_mirror_horizontal_));
|
||||
}
|
||||
if (attlist_.draw_mirror_vertical_)
|
||||
{
|
||||
Context.get_slide_context().set_property(_property(L"flipV", *attlist_.draw_mirror_vertical_));
|
||||
}
|
||||
if (draw_type_oox_index_)
|
||||
{
|
||||
Context.get_slide_context().set_property(_property(L"oox-geom-index", draw_type_oox_index_.get()));
|
||||
@ -358,10 +365,10 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
}
|
||||
|
||||
std::wstring odf_path;
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_enhanced_path_)
|
||||
odf_path = draw_enhanced_geometry_attlist_.drawooo_enhanced_path_.get();
|
||||
else if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
|
||||
odf_path = draw_enhanced_geometry_attlist_.draw_enhanced_path_.get();
|
||||
if (attlist_.drawooo_enhanced_path_)
|
||||
odf_path = attlist_.drawooo_enhanced_path_.get();
|
||||
else if (attlist_.draw_enhanced_path_)
|
||||
odf_path = attlist_.draw_enhanced_path_.get();
|
||||
|
||||
if (!odf_path.empty())
|
||||
{
|
||||
@ -389,10 +396,10 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
|
||||
set_shape = true;
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)
|
||||
if (attlist_.drawooo_sub_view_size_)
|
||||
{
|
||||
std::vector< std::wstring > splitted;
|
||||
boost::algorithm::split(splitted, *draw_enhanced_geometry_attlist_.drawooo_sub_view_size_, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(splitted, *attlist_.drawooo_sub_view_size_, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
|
||||
if (splitted.size() == 2)
|
||||
{
|
||||
@ -413,10 +420,10 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
|
||||
}
|
||||
}
|
||||
}
|
||||
if (draw_enhanced_geometry_attlist_.draw_modifiers_)
|
||||
if (attlist_.draw_modifiers_)
|
||||
{
|
||||
if (bOoxType_)
|
||||
Context.get_slide_context().set_property(_property(L"oox-draw-modifiers", draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
|
||||
Context.get_slide_context().set_property(_property(L"oox-draw-modifiers", attlist_.draw_modifiers_.get()));
|
||||
else
|
||||
{
|
||||
}
|
||||
@ -447,6 +454,14 @@ void dr3d_scene::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
void dr3d_light::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
|
||||
}
|
||||
void dr3d_cube::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_slide_context().start_shape(sub_type_); //reset type
|
||||
}
|
||||
void dr3d_sphere::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
{
|
||||
Context.get_slide_context().start_shape(sub_type_); //reset type
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -71,7 +71,7 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
common_draw_shape_with_text_and_styles_attlist common_draw_attlist_ = common_draw_attlists_.shape_with_text_and_styles_;
|
||||
|
||||
const int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const unsigned int z_index = common_draw_attlist_.common_shape_draw_attlist_.draw_z_index_.get_value_or(0);
|
||||
const std::wstring name = common_draw_attlist_.common_shape_draw_attlist_.draw_name_.get_value_or(L"");
|
||||
const std::wstring styleName = common_draw_attlist_.common_shape_draw_attlist_.draw_style_name_.get_value_or(L"");
|
||||
const std::wstring textStyleName = common_draw_attlist_.common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
|
||||
@ -96,8 +96,7 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
if (common_draw_attlist_.common_shape_draw_attlist_.draw_transform_)
|
||||
{
|
||||
std::wstring transformStr = common_draw_attlist_.common_shape_draw_attlist_.draw_transform_.get();
|
||||
xlsx_convert_transforms(transformStr,Context);
|
||||
//oox_convert_transforms(transformStr, additional_);
|
||||
xlsx_convert_transforms(transformStr, Context);
|
||||
}
|
||||
////////////////////////////////////////
|
||||
std::wstring Anchor;
|
||||
@ -277,6 +276,14 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
{
|
||||
find_draw_type_oox();
|
||||
|
||||
if (attlist_.draw_mirror_horizontal_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"flipH", *attlist_.draw_mirror_horizontal_));
|
||||
}
|
||||
if (attlist_.draw_mirror_vertical_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"flipV", *attlist_.draw_mirror_vertical_));
|
||||
}
|
||||
if (draw_type_oox_index_)
|
||||
{
|
||||
Context.get_drawing_context().set_property(_property(L"oox-geom-index", draw_type_oox_index_.get()));
|
||||
@ -292,10 +299,10 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
}
|
||||
|
||||
std::wstring odf_path;
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_enhanced_path_)
|
||||
odf_path = draw_enhanced_geometry_attlist_.drawooo_enhanced_path_.get();
|
||||
else if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
|
||||
odf_path = draw_enhanced_geometry_attlist_.draw_enhanced_path_.get();
|
||||
if (attlist_.drawooo_enhanced_path_)
|
||||
odf_path = attlist_.drawooo_enhanced_path_.get();
|
||||
else if (attlist_.draw_enhanced_path_)
|
||||
odf_path = attlist_.draw_enhanced_path_.get();
|
||||
|
||||
if (!odf_path.empty())
|
||||
{
|
||||
@ -321,10 +328,10 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
::svg_path::oox_serialize(output_, o_Polyline);
|
||||
Context.get_drawing_context().set_property(odf_reader::_property(L"custom_path", output_.str()));
|
||||
|
||||
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)
|
||||
if (attlist_.drawooo_sub_view_size_)
|
||||
{
|
||||
std::vector< std::wstring > splitted;
|
||||
boost::algorithm::split(splitted, *draw_enhanced_geometry_attlist_.drawooo_sub_view_size_, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
boost::algorithm::split(splitted, *attlist_.drawooo_sub_view_size_, boost::algorithm::is_any_of(L" "), boost::algorithm::token_compress_on);
|
||||
|
||||
if (splitted.size() == 2)
|
||||
{
|
||||
@ -349,10 +356,10 @@ void draw_enhanced_geometry::xlsx_convert(oox::xlsx_conversion_context & Context
|
||||
draw_type_oox_index_ = 0;
|
||||
}
|
||||
}
|
||||
if (draw_enhanced_geometry_attlist_.draw_modifiers_)
|
||||
if (attlist_.draw_modifiers_)
|
||||
{
|
||||
if (bOoxType_)
|
||||
Context.get_drawing_context().set_property(_property(L"oox-draw-modifiers", draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
|
||||
Context.get_drawing_context().set_property(_property(L"oox-draw-modifiers", attlist_.draw_modifiers_.get()));
|
||||
else
|
||||
{
|
||||
}
|
||||
@ -372,6 +379,15 @@ void dr3d_scene::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
void dr3d_light::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
}
|
||||
void dr3d_cube::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_drawing_context().start_shape(sub_type_); //reset type
|
||||
}
|
||||
void dr3d_sphere::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
Context.get_drawing_context().start_shape(sub_type_); //reset type
|
||||
|
||||
}
|
||||
void draw_control::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
{
|
||||
|
||||
@ -268,7 +268,7 @@ void officeooo_annotation::pptx_convert(oox::pptx_conversion_context & Context)
|
||||
}
|
||||
id_idx = Context.add_author_comments(author);
|
||||
|
||||
Context.get_comments_context().start_comment(x, y,id_idx.first,id_idx.second);//author & idx (uniq number for author
|
||||
Context.get_comments_context().start_comment(x, y, id_idx.first, id_idx.second);//author & idx (uniq number for author
|
||||
|
||||
Context.get_text_context().start_comment_content();
|
||||
for (size_t i = 0; i < content_.size(); i++)//текст + текстовый стиль
|
||||
|
||||
@ -507,13 +507,7 @@ void odf_drawing_context::end_drawing_background(odf_types::common_draw_fill_att
|
||||
}
|
||||
void odf_drawing_context::end_drawing()
|
||||
{
|
||||
if (impl_->current_drawing_state_.elements_.empty())
|
||||
{
|
||||
impl_->current_level_.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
draw_base* draw = dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
draw_base* draw = impl_->current_drawing_state_.elements_.empty() ? NULL : dynamic_cast<draw_base*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
if (draw)
|
||||
{
|
||||
if (impl_->current_drawing_state_.presentation_class_ || impl_->current_drawing_state_.presentation_placeholder_)
|
||||
@ -603,7 +597,7 @@ void odf_drawing_context::end_drawing()
|
||||
draw->common_draw_attlists_.rel_size_.common_draw_size_attlist_.svg_width_ = impl_->current_drawing_state_.svg_width_;
|
||||
}
|
||||
///////////////////////////////////////////////////////
|
||||
presentation_placeholder * placeholder = dynamic_cast<presentation_placeholder*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
presentation_placeholder * placeholder = impl_->current_drawing_state_.elements_.empty() ? NULL : dynamic_cast<presentation_placeholder*>(impl_->current_drawing_state_.elements_[0].elm.get());
|
||||
if (placeholder)
|
||||
{
|
||||
placeholder->presentation_object_ = impl_->current_drawing_state_.presentation_class_;
|
||||
@ -1860,7 +1854,7 @@ void odf_drawing_context::set_horizontal_pos(int align)
|
||||
}
|
||||
void odf_drawing_context::set_horizontal_pos(double offset_pt)
|
||||
{
|
||||
impl_->anchor_settings_.style_horizontal_pos_svg_x_ = length(length(offset_pt,length::pt).get_value_unit(length::cm),length::cm);
|
||||
impl_->anchor_settings_.style_horizontal_pos_svg_x_ = length(length(offset_pt, length::pt).get_value_unit(length::cm), length::cm);
|
||||
impl_->x = offset_pt;
|
||||
}
|
||||
void odf_drawing_context::set_default_wrap_style()
|
||||
|
||||
@ -74,6 +74,7 @@ namespace odf_writer
|
||||
count_rows = 0;
|
||||
|
||||
table_width = 0;
|
||||
table_height = 0;
|
||||
}
|
||||
std::vector<odf_row_state> rows;
|
||||
std::vector<odf_column_state> columns;
|
||||
@ -91,6 +92,8 @@ namespace odf_writer
|
||||
bool styled;
|
||||
|
||||
double table_width;
|
||||
double table_height;
|
||||
|
||||
std::wstring default_cell_properties;
|
||||
|
||||
_CP_OPT(std::wstring) border_inside_v_;
|
||||
@ -103,30 +106,34 @@ class odf_table_context::Impl
|
||||
public:
|
||||
Impl(odf_conversion_context *odf_context) :odf_context_(odf_context)
|
||||
{
|
||||
default_column_width = -1;
|
||||
default_column_width = boost::none;
|
||||
default_row_height = boost::none;
|
||||
optimal_column_width = false;
|
||||
}
|
||||
|
||||
odf_table_state & current_table() {return tables_.back();}
|
||||
bool empty () {return tables_.size() >0 ? false : true; }
|
||||
bool empty () {return (false == tables_.empty()) ? false : true; }
|
||||
|
||||
void start_table(odf_table_state & state) {tables_.push_back(state);}
|
||||
|
||||
void end_table()
|
||||
{
|
||||
if (tables_.size() > 0) tables_.pop_back();
|
||||
if (false == tables_.empty()) tables_.pop_back();
|
||||
|
||||
default_column_width = -1; // todo .. in level ???
|
||||
default_column_width = boost::none; // todo .. in level ???
|
||||
default_row_height = boost::none;
|
||||
default_cell_properties = L"";
|
||||
optimal_column_width = false;
|
||||
}
|
||||
|
||||
odf_style_context * styles_context() {return odf_context_->styles_context();}
|
||||
odf_style_context *styles_context() {return odf_context_->styles_context();}
|
||||
|
||||
odf_conversion_context *odf_context_;
|
||||
|
||||
double default_column_width;
|
||||
bool optimal_column_width;
|
||||
_CP_OPT(double) default_row_height;
|
||||
_CP_OPT(double) default_column_width;
|
||||
bool optimal_column_width;
|
||||
|
||||
std::wstring default_cell_properties; // для предустановки ..
|
||||
|
||||
private:
|
||||
@ -252,7 +259,7 @@ void odf_table_context::end_row()
|
||||
// start_cell(cell,false);
|
||||
// end_cell();
|
||||
//}
|
||||
impl_->current_table().current_column =0;
|
||||
impl_->current_table().current_column = 0;
|
||||
}
|
||||
|
||||
|
||||
@ -312,16 +319,25 @@ void odf_table_context::set_default_cell_properties(std::wstring style_name)
|
||||
{
|
||||
impl_->default_cell_properties = style_name;
|
||||
}
|
||||
double odf_table_context::get_table_width()
|
||||
_CP_OPT(double) odf_table_context::get_table_width()
|
||||
{
|
||||
if (impl_->empty()) return -1;
|
||||
if (impl_->empty()) return boost::none;
|
||||
else return impl_->current_table().table_width;
|
||||
}
|
||||
_CP_OPT(double) odf_table_context::get_table_height()
|
||||
{
|
||||
if (impl_->empty()) return boost::none;
|
||||
else return impl_->current_table().table_height;
|
||||
}
|
||||
std::wstring odf_table_context::get_default_cell_properties()
|
||||
{
|
||||
if (impl_->empty()) return impl_->default_cell_properties;
|
||||
else return impl_->current_table().default_cell_properties;
|
||||
}
|
||||
void odf_table_context::set_default_row_height(double height)
|
||||
{
|
||||
impl_->default_row_height = height;
|
||||
}
|
||||
void odf_table_context::set_default_column_width(double width)
|
||||
{
|
||||
impl_->default_column_width = width;
|
||||
@ -347,7 +363,7 @@ void odf_table_context::set_column_optimal(bool val)
|
||||
void odf_table_context::change_current_column_width(double width)
|
||||
{
|
||||
if (impl_->empty()) return;
|
||||
if (impl_->current_table().columns.size() < 1)return;
|
||||
if (impl_->current_table().columns.empty())return;
|
||||
|
||||
int index = impl_->current_table().current_column ;
|
||||
if (index < 0) return;
|
||||
@ -368,7 +384,7 @@ void odf_table_context::change_current_column_width(double width)
|
||||
style_table_column_properties *properties = style_->content_.get_style_table_column_properties();
|
||||
if (properties == NULL) return;
|
||||
|
||||
length length_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
length length_ = length(length(width, length::pt).get_value_unit(length::cm), length::cm);
|
||||
|
||||
if (!properties->style_table_column_properties_attlist_.style_column_width_)
|
||||
properties->style_table_column_properties_attlist_.style_column_width_ = length_;
|
||||
@ -383,39 +399,68 @@ void odf_table_context::change_current_column_width(double width)
|
||||
void odf_table_context::set_column_width(double width)
|
||||
{
|
||||
if (impl_->empty()) return;
|
||||
if (impl_->current_table().columns.size() < 1)return;
|
||||
if (impl_->current_table().columns.empty())return;
|
||||
|
||||
style *style_ = dynamic_cast<style*>(impl_->current_table().columns.back().style_elm.get());
|
||||
|
||||
if (style_ == NULL) return;
|
||||
style_table_column_properties *properties = style_->content_.get_style_table_column_properties();
|
||||
if (properties == NULL) return;
|
||||
style_table_column_properties *properties = style_ ? style_->content_.get_style_table_column_properties() : NULL;
|
||||
|
||||
if (width > 0)
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
|
||||
if (impl_->optimal_column_width)
|
||||
if (properties)
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
|
||||
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
|
||||
if (impl_->optimal_column_width)
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
|
||||
}
|
||||
}
|
||||
|
||||
impl_->current_table().table_width += width;
|
||||
}
|
||||
else
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
|
||||
|
||||
if (impl_->default_column_width >= 0)
|
||||
if (properties)
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(impl_->default_column_width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
|
||||
impl_->current_table().table_width += impl_->default_column_width;
|
||||
properties->style_table_column_properties_attlist_.style_use_optimal_column_width_ = true;
|
||||
|
||||
if (impl_->default_column_width)
|
||||
{
|
||||
properties->style_table_column_properties_attlist_.style_column_width_ = length(length(impl_->default_column_width.get(), length::pt).get_value_unit(length::cm), length::cm);
|
||||
//properties->style_table_column_properties_attlist_.style_rel_column_width_ = length(length(impl_->current_table().table_width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
}
|
||||
}
|
||||
impl_->current_table().table_width += impl_->default_column_width.get_value_or(0);
|
||||
}
|
||||
}
|
||||
void odf_table_context::set_row_height(double height)
|
||||
{
|
||||
if (impl_->empty()) return;
|
||||
|
||||
if (height > 0)
|
||||
{
|
||||
//style *style_ = dynamic_cast<odf_writer::style*>(rows_.back().style_elm.get());
|
||||
|
||||
//if (style_)
|
||||
//{
|
||||
// style_table_row_properties *properties = style_->content_.get_style_table_row_properties();
|
||||
// if (properties)
|
||||
// {
|
||||
// //properties->style_table_column_properties_attlist_.style_column_width_ = length(length(width,length::pt).get_value_unit(length::cm),length::cm);
|
||||
// }
|
||||
//}
|
||||
impl_->current_table().table_height += height;
|
||||
|
||||
if (!impl_->default_row_height)
|
||||
impl_->default_row_height = height;
|
||||
}
|
||||
else
|
||||
{
|
||||
impl_->current_table().table_height += impl_->default_row_height.get_value_or(0);
|
||||
}
|
||||
}
|
||||
|
||||
int odf_table_context::current_column ()
|
||||
{
|
||||
if (impl_->empty()) return 0;
|
||||
|
||||
@ -65,15 +65,17 @@ public:
|
||||
void count_rows (int count);
|
||||
|
||||
void start_table(office_element_ptr &elm, bool styled = false);
|
||||
void set_default_column_width(double width);
|
||||
void set_default_column_width(double val);
|
||||
void set_optimal_column_width(bool val);
|
||||
void change_current_column_width(double width);
|
||||
void change_current_column_width(double val);
|
||||
void set_default_row_height(double val);
|
||||
void end_table();
|
||||
|
||||
void set_default_cell_properties(std::wstring style_name);
|
||||
std::wstring get_default_cell_properties();
|
||||
|
||||
double get_table_width();
|
||||
_CP_OPT(double) get_table_width();
|
||||
_CP_OPT(double) get_table_height();
|
||||
|
||||
void set_table_inside_v(_CP_OPT(std::wstring) border);
|
||||
void set_table_inside_h(_CP_OPT(std::wstring) border);
|
||||
@ -82,6 +84,7 @@ public:
|
||||
_CP_OPT(std::wstring) get_table_inside_h();
|
||||
|
||||
void start_row(office_element_ptr &elm, bool styled = false);
|
||||
void set_row_height(double val);
|
||||
void end_row();
|
||||
|
||||
void start_cell(office_element_ptr &elm, bool styled = false);
|
||||
|
||||
@ -1509,7 +1509,7 @@ void odt_conversion_context::end_table_columns()
|
||||
void odt_conversion_context::start_table_header_rows()
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"table", L"table-header-rows",elm,this);
|
||||
create_element(L"table", L"table-header-rows", elm, this);
|
||||
|
||||
text_context()->start_element(elm);
|
||||
}
|
||||
@ -1520,11 +1520,11 @@ void odt_conversion_context::end_table_header_rows()
|
||||
void odt_conversion_context::start_table_row(bool styled)
|
||||
{
|
||||
office_element_ptr elm;
|
||||
create_element(L"table", L"table-row",elm,this);
|
||||
create_element(L"table", L"table-row", elm, this);
|
||||
|
||||
if (styled)
|
||||
{
|
||||
styles_context()->create_style(L"",odf_types::style_family::TableRow, true, false, -1);
|
||||
styles_context()->create_style(L"", odf_types::style_family::TableRow, true, false, -1);
|
||||
}
|
||||
text_context()->start_element(elm);
|
||||
|
||||
@ -1556,7 +1556,7 @@ void odt_conversion_context::end_table_cell()
|
||||
}
|
||||
void odt_conversion_context::end_table_row()
|
||||
{
|
||||
for (int i=table_context()->current_column() ; i < table_context()->count_columns(); i++)
|
||||
for (int i = table_context()->current_column() ; i < table_context()->count_columns(); i++)
|
||||
{
|
||||
add_default_cell();
|
||||
}
|
||||
|
||||
@ -3980,7 +3980,14 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
odt_context->start_drawings();
|
||||
_CP_OPT(double) width, height, x, y ;
|
||||
|
||||
if (oox_table->m_oTableProperties->m_oTblpPr->m_oTblpX.IsInit())
|
||||
if (oox_table->m_oTableProperties->m_oTblpPr->m_oTblpXSpec.IsInit())
|
||||
{
|
||||
odt_context->drawing_context()->set_horizontal_pos(oox_table->m_oTableProperties->m_oTblpPr->m_oTblpXSpec->GetValue());
|
||||
}
|
||||
bool bRightAlignX = ((oox_table->m_oTableProperties->m_oTblpPr->m_oTblpXSpec.IsInit()) &&
|
||||
(oox_table->m_oTableProperties->m_oTblpPr->m_oTblpXSpec->GetValue() == SimpleTypes::xalignRight));
|
||||
|
||||
if (!bRightAlignX && oox_table->m_oTableProperties->m_oTblpPr->m_oTblpX.IsInit())
|
||||
x = oox_table->m_oTableProperties->m_oTblpPr->m_oTblpX->ToPoints();
|
||||
if (oox_table->m_oTableProperties->m_oTblpPr->m_oTblpY.IsInit())
|
||||
y = oox_table->m_oTableProperties->m_oTblpPr->m_oTblpY->ToPoints();
|
||||
@ -3991,6 +3998,7 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
// else x = -*x + oox_table->m_oTableProperties->m_oTblpPr->m_oLeftFromText->ToPoints();
|
||||
//}
|
||||
|
||||
|
||||
odt_context->drawing_context()->set_drawings_rect(x, y, width, height);
|
||||
|
||||
odt_context->drawing_context()->set_anchor(in_frame_anchor);
|
||||
@ -4021,10 +4029,11 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
|
||||
if (oox_table->m_oTableProperties->m_oTblpPr->m_oRightFromText.IsInit())
|
||||
{
|
||||
if (!x) //x = *x + oox_table->m_oTableProperties->m_oTblpPr->m_oRightFromText->ToPoints();
|
||||
if (!bRightAlignX && !x) //x = *x + oox_table->m_oTableProperties->m_oTblpPr->m_oRightFromText->ToPoints();
|
||||
{
|
||||
x = oox_table->m_oTableProperties->m_oTblpPr->m_oRightFromText->ToPoints();
|
||||
|
||||
odt_context->drawing_context()->set_horizontal_pos(*x);
|
||||
odt_context->drawing_context()->set_horizontal_pos(*x);
|
||||
}
|
||||
}
|
||||
if (oox_table->m_oTableProperties->m_oTblpPr->m_oTopFromText.IsInit())
|
||||
{
|
||||
@ -4038,7 +4047,7 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
odt_context->drawing_context()->start_text_box();
|
||||
odt_context->drawing_context()->set_text_box_tableframe(true);
|
||||
odt_context->drawing_context()->set_text_box_min_size(0, 1.);
|
||||
odt_context->drawing_context()->set_z_order(0x7fffffff-1);
|
||||
odt_context->drawing_context()->set_z_order(0x7fffffff - 1024/* + id_tables*/);
|
||||
odt_context->drawing_context()->set_text_box_parent_style(L"Frame");
|
||||
odt_context->drawing_context()->set_name(L"TableFrame");
|
||||
odt_context->start_text_context();
|
||||
@ -4046,7 +4055,7 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
|
||||
odt_context->start_table(true);
|
||||
|
||||
_CP_OPT(std::wstring) border_inside_h,border_inside_v;
|
||||
_CP_OPT(std::wstring) border_inside_h, border_inside_v;
|
||||
|
||||
if (styled_table)
|
||||
{
|
||||
@ -4100,10 +4109,11 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
|
||||
if (in_frame)
|
||||
{
|
||||
_CP_OPT(double) width = odt_context->table_context()->get_table_width();
|
||||
_CP_OPT(double) height;
|
||||
_CP_OPT(double) height = odt_context->table_context()->get_table_height();
|
||||
|
||||
odt_context->drawing_context()->set_size(width, height);
|
||||
|
||||
odt_context->drawing_context()->set_text_box_min_size(-1,0);
|
||||
odt_context->drawing_context()->set_text_box_min_size(-1, height.get_value_or(0));
|
||||
}
|
||||
|
||||
odt_context->end_table();
|
||||
@ -4295,7 +4305,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
|
||||
if (id_change_properties >= 0)
|
||||
odt_context->end_change(id_change_properties, 3);
|
||||
}
|
||||
bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_properties * table_properties )
|
||||
bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_properties *table_properties )
|
||||
{
|
||||
if (oox_table_pr == NULL) return false;
|
||||
if (table_properties == NULL) return false;
|
||||
@ -4397,7 +4407,7 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer
|
||||
return true;
|
||||
}
|
||||
|
||||
void DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_cell_properties * table_cell_properties)
|
||||
void DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_cell_properties * table_cell_properties)
|
||||
{
|
||||
if (oox_table_pr == NULL || oox_table_pr == NULL) return;
|
||||
|
||||
@ -4450,24 +4460,27 @@ bool DocxConverter::convert(OOX::Logic::CTableProperty *oox_table_pr, bool base_
|
||||
|
||||
return true;
|
||||
}
|
||||
void DocxConverter::convert(OOX::Logic::CTableRowProperties *oox_table_row_pr, odf_writer::style_table_row_properties * table_row_properties)
|
||||
void DocxConverter::convert(OOX::Logic::CTableRowProperties *oox_table_row_pr, odf_writer::style_table_row_properties *table_row_properties)
|
||||
{
|
||||
if (oox_table_row_pr == NULL) return;
|
||||
if (table_row_properties == NULL) return;
|
||||
|
||||
if (oox_table_row_pr->m_oTblHeight.IsInit())
|
||||
if ((oox_table_row_pr->m_oTblHeight.IsInit()) &&
|
||||
(oox_table_row_pr->m_oTblHeight->m_oVal.IsInit()))
|
||||
{
|
||||
_CP_OPT(odf_types::length) length;
|
||||
convert(dynamic_cast<SimpleTypes::CUniversalMeasure *>(oox_table_row_pr->m_oTblHeight->m_oVal.GetPointer()), length);
|
||||
|
||||
odt_context->table_context()->set_row_height(oox_table_row_pr->m_oTblHeight->m_oVal->ToPoints());
|
||||
|
||||
if (oox_table_row_pr->m_oTblHeight->m_oHRule.IsInit())
|
||||
{
|
||||
switch(oox_table_row_pr->m_oTblHeight->m_oHRule->GetValue())
|
||||
{
|
||||
case SimpleTypes::heightruleAtLeast:
|
||||
table_row_properties->style_table_row_properties_attlist_.style_min_row_height_ = odf_types::length(length->get_value_unit(odf_types::length::cm),odf_types::length::cm); break;
|
||||
table_row_properties->style_table_row_properties_attlist_.style_min_row_height_ = odf_types::length(length->get_value_unit(odf_types::length::cm), odf_types::length::cm); break;
|
||||
case SimpleTypes::heightruleExact:
|
||||
table_row_properties->style_table_row_properties_attlist_.style_row_height_ = odf_types::length(length->get_value_unit(odf_types::length::cm),odf_types::length::cm); break;
|
||||
table_row_properties->style_table_row_properties_attlist_.style_row_height_ = odf_types::length(length->get_value_unit(odf_types::length::cm), odf_types::length::cm); break;
|
||||
case SimpleTypes::heightruleAuto:
|
||||
table_row_properties->style_table_row_properties_attlist_.style_use_optimal_row_height_ = true; break;
|
||||
}
|
||||
@ -4481,7 +4494,7 @@ void DocxConverter::convert(OOX::Logic::CTableRowProperties *oox_table_row_pr)
|
||||
{
|
||||
if (oox_table_row_pr == NULL) return;
|
||||
|
||||
odf_writer::style_table_row_properties * table_row_properties = odt_context->styles_context()->last_state()->get_table_row_properties();
|
||||
odf_writer::style_table_row_properties *table_row_properties = odt_context->styles_context()->last_state()->get_table_row_properties();
|
||||
|
||||
if (oox_table_row_pr->m_oCnfStyle.IsInit())
|
||||
{
|
||||
|
||||
@ -686,7 +686,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRow *oox_row, OOX::Spreadsheet::C
|
||||
level = oox_row->m_oOutlineLevel->GetValue();
|
||||
}
|
||||
|
||||
ods_context->start_row(row_number,1,level,_default);
|
||||
ods_context->start_row(row_number, 1, level,_default);
|
||||
|
||||
if (oox_row->m_oHidden.IsInit()) ods_context->current_table().set_row_hidden(true);
|
||||
if (oox_row->m_oCollapsed.IsInit()) ods_context->current_table().set_row_hidden(true);
|
||||
|
||||
@ -128,7 +128,7 @@ void PtgRef3d::assemble(AssemblerStack& ptg_stack, PtgQueue& extra_data, bool fu
|
||||
}
|
||||
if (ixti != 0xffff)
|
||||
{
|
||||
std::wstring link = global_info->arXti_External[ixti].link;
|
||||
std::wstring link = ixti < global_info->arXti_External.size() ? global_info->arXti_External[ixti].link : L"";
|
||||
if (!link.empty() && !cell_ref.empty())
|
||||
link += L"!";
|
||||
|
||||
|
||||
@ -37,7 +37,8 @@ public :
|
||||
}
|
||||
|
||||
NSString* stringURL = StringWToNSString(m_sFileUrl);
|
||||
NSURL *url = [NSURL URLWithString:stringURL];
|
||||
NSString *escapedURL = [stringURL stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
|
||||
NSURL *url = [NSURL URLWithString:escapedURL];
|
||||
NSData *urlData = [NSData dataWithContentsOfURL:url];
|
||||
if ( urlData )
|
||||
{
|
||||
|
||||
@ -190,6 +190,9 @@ void CSvmFile::PlayMetaFile()
|
||||
case META_ISECTRECTCLIPREGION_ACTION: Read_META_SECTRECTCLIPREGION(); break;
|
||||
case META_ISECTREGIONCLIPREGION_ACTION: Read_META_SECTREGIONCLIPREGION(); break;
|
||||
|
||||
case META_BMPEX_ACTION: Read_META_BMPEX(); break;
|
||||
case META_BMPEXSCALE_ACTION: Read_META_BMPEXSCALE(); break;
|
||||
|
||||
case META_ROUNDRECT_ACTION:
|
||||
case META_ELLIPSE_ACTION:
|
||||
case META_ARC_ACTION:
|
||||
@ -199,8 +202,6 @@ void CSvmFile::PlayMetaFile()
|
||||
case META_POINT_ACTION:
|
||||
|
||||
case META_BMPSCALEPART_ACTION:
|
||||
case META_BMPEX_ACTION:
|
||||
case META_BMPEXSCALE_ACTION:
|
||||
case META_BMPEXSCALEPART_ACTION:
|
||||
case META_MASK_ACTION:
|
||||
case META_MASKSCALE_ACTION:
|
||||
@ -973,135 +974,306 @@ void CSvmFile::Read_META_RASTEROP()
|
||||
|
||||
|
||||
}
|
||||
|
||||
void CSvmFile::Read_META_BMP()
|
||||
{
|
||||
TSvmBitmap bitmap_info;
|
||||
|
||||
BYTE *pBgraBuffer = NULL;
|
||||
unsigned int ulWidth = 0, ulHeight = 0;
|
||||
|
||||
Read_META_BMP(bitmap_info, &pBgraBuffer, &ulWidth, &ulHeight );
|
||||
|
||||
if (bitmap_info.nHeight > (unsigned int)m_oBoundingBox.nBottom &&
|
||||
bitmap_info.nWidth > (unsigned int)m_oBoundingBox.nRight && !m_pOutput)
|
||||
{
|
||||
m_oBoundingBox.nRight = bitmap_info.nWidth;
|
||||
m_oBoundingBox.nBottom = bitmap_info.nHeight;
|
||||
}
|
||||
|
||||
if (pBgraBuffer)
|
||||
{
|
||||
if ( m_pOutput)
|
||||
{
|
||||
m_pOutput->DrawBitmap( m_oCurrnetOffset.x, m_oCurrnetOffset.y, bitmap_info.nWidth, bitmap_info.nHeight, pBgraBuffer, bitmap_info.nWidth, bitmap_info.nHeight);
|
||||
}
|
||||
|
||||
delete []pBgraBuffer;
|
||||
|
||||
UpdateOutputDC();
|
||||
}
|
||||
}
|
||||
void CSvmFile::Read_META_BMP(TSvmBitmap & bitmap_info, BYTE** ppDstBuffer, unsigned int* pulWidth, unsigned int* pulHeight)
|
||||
{
|
||||
unsigned int nHeaderSize = 0;
|
||||
|
||||
unsigned int nTmp32;
|
||||
unsigned short nTmp16 = 0;
|
||||
bool bRet = false;
|
||||
|
||||
m_oStream >> nTmp16;
|
||||
m_oStream >> nHeaderSize;
|
||||
|
||||
if ( ( 0x4D42 == nTmp16 ) || ( 0x4142 == nTmp16 ) )
|
||||
{
|
||||
if ( 0x4142 == nTmp16 )
|
||||
{
|
||||
m_oStream.Skip( 12 );//не то !!!
|
||||
m_oStream >> nTmp16;
|
||||
m_oStream.Skip( 8 );
|
||||
m_oStream >> nTmp32;
|
||||
nHeaderSize = nTmp32 - 28UL;;
|
||||
bRet = ( 0x4D42 == nTmp16 );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oStream.Skip( 4 );
|
||||
m_oStream >> nTmp32;
|
||||
nHeaderSize = nTmp32 - 14;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short nColors;
|
||||
BYTE* pData = NULL;
|
||||
|
||||
m_oStream >> bitmap_info; //size = 40
|
||||
|
||||
int nBitCount = discretizeBitcount(bitmap_info.nBitCount);
|
||||
|
||||
if( nBitCount <= 8 )
|
||||
{
|
||||
if( bitmap_info.nColsUsed )
|
||||
nColors = (USHORT) bitmap_info.nColsUsed;
|
||||
else
|
||||
nColors = ( 1 << bitmap_info.nBitCount );
|
||||
}
|
||||
else
|
||||
nColors = 0;
|
||||
|
||||
if( ZCOMPRESS == bitmap_info.nCompression )
|
||||
{
|
||||
COfficeUtils OfficeUtils(NULL);
|
||||
|
||||
ULONG destSize, srcSize;
|
||||
m_oStream >> srcSize >> destSize >> bitmap_info.nCompression;
|
||||
|
||||
BYTE* srcBuf = m_oStream.GetCurPtr();
|
||||
BYTE* destBuf = new BYTE[destSize];
|
||||
|
||||
if (destSize > 0 && m_pOutput && destBuf )
|
||||
{
|
||||
if (OfficeUtils.Uncompress(destBuf, &destSize, srcBuf, srcSize) != S_OK)
|
||||
{
|
||||
delete []destBuf;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_oStream.Skip(srcSize);
|
||||
|
||||
MetaFile::ReadImage((BYTE*)&bitmap_info, bitmap_info.nSize, destBuf, destSize, ppDstBuffer, pulWidth, pulHeight);
|
||||
delete []destBuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE *Header = new BYTE [ nHeaderSize];
|
||||
memcpy(Header, &bitmap_info, bitmap_info.nSize);
|
||||
|
||||
m_oStream.ReadBytes(Header + bitmap_info.nSize, nHeaderSize - bitmap_info.nSize);
|
||||
|
||||
MetaFile::ReadImage(Header , nHeaderSize, m_oStream.GetCurPtr(), bitmap_info.nSizeImage, ppDstBuffer, pulWidth, pulHeight);
|
||||
m_oStream.Skip(bitmap_info.nSizeImage);
|
||||
delete Header;
|
||||
}
|
||||
}
|
||||
|
||||
void CSvmFile::Read_META_BMPEX()
|
||||
{
|
||||
TSvmBitmap bitmap_info;
|
||||
|
||||
BYTE *pBgraBuffer = NULL;
|
||||
unsigned int ulWidth = 0, ulHeight = 0;
|
||||
|
||||
Read_META_BMP(bitmap_info, &pBgraBuffer, &ulWidth, &ulHeight);
|
||||
|
||||
// if (ulWidth != bitmap_info.nWidth && bitmap_info.nWidth % 2 != 0)
|
||||
{
|
||||
bitmap_info.nWidth = ulWidth;
|
||||
}
|
||||
//иногда наверху неверно вычисляется оригинальный размер - если внутри одиночная картинка
|
||||
|
||||
if (bitmap_info.nHeight > (unsigned int)m_oBoundingBox.nBottom &&
|
||||
bitmap_info.nWidth > (unsigned int)m_oBoundingBox.nRight && !m_pOutput)
|
||||
{
|
||||
m_oBoundingBox.nRight = bitmap_info.nWidth;
|
||||
m_oBoundingBox.nBottom = bitmap_info.nHeight;
|
||||
}
|
||||
unsigned int nMagic1;
|
||||
unsigned int nMagic2;
|
||||
|
||||
m_oStream >> nMagic1 >> nMagic2;
|
||||
|
||||
TSvmBitmap bitmap_info_mask;
|
||||
BYTE *pBgraBufferMask = NULL;
|
||||
unsigned int ulWidthMask = 0, ulHeightMask = 0;
|
||||
|
||||
if ( (0x25091962 == nMagic1) && (0xACB20201 == nMagic2))
|
||||
{
|
||||
BYTE transparentType;
|
||||
m_oStream >> transparentType;
|
||||
|
||||
switch(transparentType)
|
||||
{
|
||||
case 2:// bitmap mask
|
||||
Read_META_BMP(bitmap_info_mask, &pBgraBufferMask, &ulWidthMask, &ulHeightMask);
|
||||
break;
|
||||
case 1:// transparent color
|
||||
TSvmColor oColor;
|
||||
m_oStream >> oColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pBgraBufferMask)
|
||||
{
|
||||
delete []pBgraBufferMask;
|
||||
}
|
||||
|
||||
if (pBgraBuffer)
|
||||
{
|
||||
if ( m_pOutput)
|
||||
{
|
||||
m_pOutput->DrawBitmap( m_oCurrnetOffset.x, m_oCurrnetOffset.y, bitmap_info.nWidth, bitmap_info.nHeight, pBgraBuffer, bitmap_info.nWidth, bitmap_info.nHeight);
|
||||
}
|
||||
|
||||
delete []pBgraBuffer;
|
||||
|
||||
UpdateOutputDC();
|
||||
}
|
||||
}
|
||||
|
||||
void CSvmFile::Read_META_SECTRECTCLIPREGION()
|
||||
{
|
||||
TSvmRect rect;
|
||||
|
||||
m_oStream >> rect;
|
||||
TSvmRect rect;
|
||||
|
||||
m_oStream >> rect;
|
||||
}
|
||||
void CSvmFile::Read_META_SECTREGIONCLIPREGION()
|
||||
{
|
||||
}
|
||||
void CSvmFile::Read_META_BMPEXSCALE()
|
||||
{
|
||||
TSvmBitmap bitmap_info;
|
||||
|
||||
BYTE *pBgraBuffer = NULL;
|
||||
unsigned int ulWidth = 0, ulHeight = 0;
|
||||
|
||||
Read_META_BMP(bitmap_info, &pBgraBuffer, &ulWidth, &ulHeight);
|
||||
|
||||
//иногда наверху неверно вычисляется оригинальный размер - если внутри одиночная картинка
|
||||
|
||||
// if (ulWidth != bitmap_info.nWidth && bitmap_info.nWidth % 2 != 0)
|
||||
{
|
||||
bitmap_info.nWidth = ulWidth;
|
||||
}
|
||||
|
||||
if (bitmap_info.nHeight > (unsigned int)m_oBoundingBox.nBottom &&
|
||||
bitmap_info.nWidth > (unsigned int)m_oBoundingBox.nRight && !m_pOutput)
|
||||
{
|
||||
m_oBoundingBox.nRight = bitmap_info.nWidth;
|
||||
m_oBoundingBox.nBottom = bitmap_info.nHeight;
|
||||
}
|
||||
unsigned int nMagic1;
|
||||
unsigned int nMagic2;
|
||||
|
||||
m_oStream >> nMagic1 >> nMagic2;
|
||||
|
||||
TSvmBitmap bitmap_info_mask;
|
||||
|
||||
BYTE *pBgraBufferMask = NULL;
|
||||
unsigned int ulWidthMask = 0, ulHeightMask = 0;
|
||||
|
||||
if ( (0x25091962 == nMagic1) && (0xACB20201 == nMagic2))
|
||||
{
|
||||
BYTE transparentType;
|
||||
m_oStream >> transparentType;
|
||||
|
||||
switch(transparentType)
|
||||
{
|
||||
case 2:// bitmap mask
|
||||
Read_META_BMP(bitmap_info_mask, &pBgraBufferMask, &ulWidthMask, &ulHeightMask);
|
||||
break;
|
||||
case 1:// transparent color
|
||||
TSvmColor oColor;
|
||||
m_oStream >> oColor;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (pBgraBufferMask)
|
||||
{
|
||||
delete []pBgraBufferMask;
|
||||
}
|
||||
|
||||
TSvmSize size;
|
||||
TSvmPoint point;
|
||||
|
||||
m_oStream >> point;
|
||||
m_oStream >> size.cx;
|
||||
m_oStream >> size.cy;
|
||||
|
||||
if (pBgraBuffer)
|
||||
{
|
||||
if ( m_pOutput)
|
||||
{
|
||||
m_pOutput->DrawBitmap( point.x + m_oCurrnetOffset.x, point.y + m_oCurrnetOffset.y, size.cx, size.cy, pBgraBuffer, bitmap_info.nWidth, bitmap_info.nHeight);
|
||||
}
|
||||
|
||||
delete []pBgraBuffer;
|
||||
|
||||
UpdateOutputDC();
|
||||
}
|
||||
|
||||
}
|
||||
void CSvmFile::Read_META_BMPSCALE()
|
||||
{
|
||||
unsigned int nHeaderSize = 0;
|
||||
|
||||
unsigned int nTmp32;
|
||||
unsigned short nTmp16 = 0;
|
||||
bool bRet = false;
|
||||
TSvmBitmap bitmap_info;
|
||||
|
||||
m_oStream >> nTmp16;
|
||||
m_oStream >> nHeaderSize;
|
||||
BYTE *pBgraBuffer = NULL;
|
||||
|
||||
if ( ( 0x4D42 == nTmp16 ) || ( 0x4142 == nTmp16 ) )
|
||||
{
|
||||
if ( 0x4142 == nTmp16 )
|
||||
{
|
||||
m_oStream.Skip( 12 );//не то !!!
|
||||
m_oStream >> nTmp16;
|
||||
m_oStream.Skip( 8 );
|
||||
m_oStream >> nTmp32;
|
||||
nHeaderSize = nTmp32 - 28UL;;
|
||||
bRet = ( 0x4D42 == nTmp16 );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_oStream.Skip( 4 );
|
||||
m_oStream >> nTmp32;
|
||||
nHeaderSize = nTmp32 - 14;
|
||||
}
|
||||
}
|
||||
unsigned int ulWidth = 0, ulHeight = 0;
|
||||
|
||||
TSvmBitmap bitmap_info;
|
||||
Read_META_BMP(bitmap_info, &pBgraBuffer, &ulWidth, &ulHeight );
|
||||
|
||||
m_oStream >> bitmap_info; //size = 40
|
||||
|
||||
unsigned short nColors;
|
||||
BYTE* pData = NULL;
|
||||
|
||||
int nBitCount = discretizeBitcount(bitmap_info.nBitCount);
|
||||
//иногда наверху неверно вычисляется оригинальный размер - если внутри одиночная картинка
|
||||
//if (ulWidth != bitmap_info.nWidth && bitmap_info.nWidth % 2 != 0)
|
||||
{
|
||||
bitmap_info.nWidth = ulWidth;
|
||||
}
|
||||
|
||||
if( nBitCount <= 8 )
|
||||
{
|
||||
if( bitmap_info.nColsUsed )
|
||||
nColors = (USHORT) bitmap_info.nColsUsed;
|
||||
else
|
||||
nColors = ( 1 << bitmap_info.nBitCount );
|
||||
}
|
||||
else
|
||||
nColors = 0;
|
||||
if (bitmap_info.nHeight > (unsigned int)m_oBoundingBox.nBottom &&
|
||||
bitmap_info.nWidth > (unsigned int)m_oBoundingBox.nRight && !m_pOutput)
|
||||
{
|
||||
m_oBoundingBox.nRight = bitmap_info.nWidth;
|
||||
m_oBoundingBox.nBottom = bitmap_info.nHeight;
|
||||
}
|
||||
|
||||
BYTE *pBgraBuffer = NULL;
|
||||
TSvmSize size;
|
||||
TSvmPoint point;
|
||||
|
||||
unsigned int ulWidth = 0, ulHeight = 0;
|
||||
|
||||
if( ZCOMPRESS == bitmap_info.nCompression )
|
||||
{
|
||||
COfficeUtils OfficeUtils(NULL);
|
||||
|
||||
ULONG destSize, srcSize;
|
||||
m_oStream >> srcSize >> destSize >> bitmap_info.nCompression;
|
||||
m_oStream >> point;
|
||||
m_oStream >> size.cx;
|
||||
m_oStream >> size.cy;
|
||||
|
||||
BYTE* srcBuf = m_oStream.GetCurPtr();
|
||||
BYTE* destBuf = new BYTE[destSize];
|
||||
if (pBgraBuffer)
|
||||
{
|
||||
if ( m_pOutput)
|
||||
{
|
||||
m_pOutput->DrawBitmap( point.x + m_oCurrnetOffset.x, point.y + m_oCurrnetOffset.y, size.cx, size.cy, pBgraBuffer, bitmap_info.nWidth, bitmap_info.nHeight);
|
||||
}
|
||||
|
||||
if (destSize > 0 && m_pOutput && destBuf )
|
||||
{
|
||||
if (OfficeUtils.Uncompress(destBuf, &destSize, srcBuf, srcSize) != S_OK)
|
||||
{
|
||||
delete []destBuf;
|
||||
return;
|
||||
}
|
||||
}
|
||||
m_oStream.Skip(srcSize);
|
||||
|
||||
MetaFile::ReadImage((BYTE*)&bitmap_info, bitmap_info.nSize, destBuf, destSize, &pBgraBuffer, &ulWidth, &ulHeight);
|
||||
delete []destBuf;
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE *Header = new BYTE [ nHeaderSize];
|
||||
memcpy(Header, &bitmap_info, bitmap_info.nSize);
|
||||
delete []pBgraBuffer;
|
||||
|
||||
m_oStream.ReadBytes(Header + bitmap_info.nSize, nHeaderSize - bitmap_info.nSize);
|
||||
|
||||
MetaFile::ReadImage(Header , nHeaderSize, m_oStream.GetCurPtr(), bitmap_info.nSizeImage, &pBgraBuffer, &ulWidth, &ulHeight);
|
||||
m_oStream.Skip(bitmap_info.nSizeImage);
|
||||
delete Header;
|
||||
}
|
||||
//иногда наверху неверно вычисляется оригинальный размер - если внутри одиночная картинка
|
||||
|
||||
if (bitmap_info.nHeight > (unsigned int)m_oBoundingBox.nBottom &&
|
||||
bitmap_info.nWidth > (unsigned int)m_oBoundingBox.nRight && !m_pOutput)
|
||||
{
|
||||
m_oBoundingBox.nRight = bitmap_info.nWidth;
|
||||
m_oBoundingBox.nBottom = bitmap_info.nHeight;
|
||||
}
|
||||
|
||||
TSvmSize size;
|
||||
TSvmPoint point;
|
||||
|
||||
m_oStream >> point;
|
||||
m_oStream >> size.cx;
|
||||
m_oStream >> size.cy;
|
||||
|
||||
if (pBgraBuffer)
|
||||
{
|
||||
if ( m_pOutput)
|
||||
{
|
||||
m_pOutput->DrawBitmap( point.x + m_oCurrnetOffset.x, point.y + m_oCurrnetOffset.y, size.cx, size.cy, pBgraBuffer, bitmap_info.nWidth, bitmap_info.nHeight);
|
||||
}
|
||||
|
||||
delete []pBgraBuffer;
|
||||
|
||||
UpdateOutputDC();
|
||||
}
|
||||
UpdateOutputDC();
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace MetaFile
|
||||
|
||||
@ -226,8 +226,11 @@ class CSvmFile : virtual public IMetaFileBase
|
||||
void Read_META_SETLINECOLOR();
|
||||
void Read_META_FONT();
|
||||
void Read_META_BMPSCALE();
|
||||
void Read_META_BMP();
|
||||
void Read_META_RASTEROP();
|
||||
void Read_META_BMPEXSCALE();
|
||||
void Read_META_BMP();
|
||||
void Read_META_BMP(TSvmBitmap &bitmap_info, BYTE** ppDstBuffer, unsigned int* pulWidth, unsigned int* pulHeight);
|
||||
void Read_META_BMPEX();
|
||||
void Read_META_RASTEROP();
|
||||
void Read_META_PUSH();
|
||||
void Read_META_POP();
|
||||
void Read_META_GRADIENT();
|
||||
|
||||
Reference in New Issue
Block a user