mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-07-19 23:02:34 +08:00
fix group ole/math_equation in sheets from/to ods
This commit is contained in:
@ -494,19 +494,19 @@
|
||||
<Filter>Logic\Path2D</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\Runs\Br.h">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\Runs\Fld.h">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\Runs\MathParaWrapper.h">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\Runs\Run.h">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\Runs\RunBase.h">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\Table\Table.h">
|
||||
<Filter>Logic\Table</Filter>
|
||||
@ -949,9 +949,6 @@
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\NvSpPr.h">
|
||||
<Filter>Logic</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\Paragraph.h">
|
||||
<Filter>Logic</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\PartTitle.h">
|
||||
<Filter>Logic</Filter>
|
||||
</ClInclude>
|
||||
@ -1081,6 +1078,9 @@
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\XmlId.h">
|
||||
<Filter>Logic</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\PPTXFormat\Logic\Paragraph.h">
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\FileContainer.cpp" />
|
||||
@ -1102,7 +1102,7 @@
|
||||
<Filter>Logic\Media</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Runs\MathParaWrapper.cpp">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Table\TableCell.cpp">
|
||||
<Filter>Logic\Table</Filter>
|
||||
@ -1323,16 +1323,16 @@
|
||||
<Filter>Logic\Path2D</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Runs\Br.cpp">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Runs\Fld.cpp">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Runs\Run.cpp">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Runs\RunBase.cpp">
|
||||
<Filter>Logic\Run</Filter>
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Table\Table.cpp">
|
||||
<Filter>Logic\Table</Filter>
|
||||
@ -1508,9 +1508,6 @@
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\NvSpPr.cpp">
|
||||
<Filter>Logic</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Paragraph.cpp">
|
||||
<Filter>Logic</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\PartTitle.cpp">
|
||||
<Filter>Logic</Filter>
|
||||
</ClCompile>
|
||||
@ -2159,6 +2156,9 @@
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Transitions\ZoomTransition.cpp">
|
||||
<Filter>Logic\Transition</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\PPTXFormat\Logic\Paragraph.cpp">
|
||||
<Filter>Logic\Text</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Limits">
|
||||
@ -2185,9 +2185,6 @@
|
||||
<Filter Include="Logic\Path2D">
|
||||
<UniqueIdentifier>{c3ea8511-a68e-47b3-8b84-b28c8cc782f5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Logic\Run">
|
||||
<UniqueIdentifier>{55fb0e4f-f959-4e64-ba5c-696a63abf2ae}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Logic\Table">
|
||||
<UniqueIdentifier>{2ff27397-b6ce-4764-94f7-d5948530c211}</UniqueIdentifier>
|
||||
</Filter>
|
||||
@ -2209,5 +2206,8 @@
|
||||
<Filter Include="ViewProps">
|
||||
<UniqueIdentifier>{79724603-f046-4794-939c-1fca08505a20}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Logic\Text">
|
||||
<UniqueIdentifier>{55fb0e4f-f959-4e64-ba5c-696a63abf2ae}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@ -38,13 +38,13 @@ namespace oox {
|
||||
|
||||
struct _rect
|
||||
{
|
||||
_rect() : x(0), y(0), cx(0), cy(0) {}
|
||||
_rect(){}
|
||||
_rect(double cx_, double cy_, double x_, double y_) : x(x_), y(y_), cx(cx_), cy(cy_) {}
|
||||
|
||||
double cx;
|
||||
double cy;
|
||||
double x;
|
||||
double y;
|
||||
double cx = 0;
|
||||
double cy = 0;
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
};
|
||||
enum _anchor_rel
|
||||
{
|
||||
|
||||
@ -351,75 +351,82 @@ void xml_serialize(std::wostream & strm, _xlsx_drawing & val, const std::wstring
|
||||
}
|
||||
|
||||
|
||||
void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
void _xlsx_drawing::serialize(std::wostream & strm, const std::wstring & ns, bool local)
|
||||
{
|
||||
if (inGroup)
|
||||
return xml_serialize(strm, *this, ns);
|
||||
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
if (type_anchor == 1)
|
||||
if (false == local)
|
||||
{
|
||||
CP_XML_NODE(ns + L":twoCellAnchor")
|
||||
if (type_anchor == 1)
|
||||
{
|
||||
CP_XML_ATTR(L"editAs", L"oneCell");//"absolute");oneCell
|
||||
CP_XML_NODE(ns + L":twoCellAnchor")
|
||||
{
|
||||
CP_XML_ATTR(L"editAs", L"oneCell");//"absolute");oneCell
|
||||
|
||||
from_.serialize (CP_XML_STREAM());
|
||||
to_.serialize (CP_XML_STREAM());
|
||||
from_.serialize(CP_XML_STREAM());
|
||||
to_.serialize(CP_XML_STREAM());
|
||||
|
||||
xml_serialize (CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
xml_serialize(CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
else if (type_anchor == 2)
|
||||
{
|
||||
CP_XML_NODE(ns + L":absoluteAnchor")
|
||||
{
|
||||
CP_XML_NODE(ns + L":pos")
|
||||
{
|
||||
CP_XML_ATTR(L"x", x);
|
||||
CP_XML_ATTR(L"y", y);
|
||||
}
|
||||
CP_XML_NODE(ns + L":ext")
|
||||
{
|
||||
CP_XML_ATTR(L"cx", cx);
|
||||
CP_XML_ATTR(L"cy", cy);
|
||||
}
|
||||
xml_serialize(CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
else if (type_anchor == 3)
|
||||
{
|
||||
CP_XML_NODE(ns + L":relSizeAnchor")
|
||||
{
|
||||
CP_XML_NODE(ns + L":from")
|
||||
{
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y / *owner_cy_);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(ns + L":to")
|
||||
{
|
||||
_INT32 x1 = x + cx;
|
||||
_INT32 y1 = y + cy;
|
||||
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x1 / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y1 / *owner_cy_);
|
||||
}
|
||||
}
|
||||
xml_serialize(CP_XML_STREAM(), *this, ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (type_anchor == 2)
|
||||
else
|
||||
{
|
||||
CP_XML_NODE(ns + L":absoluteAnchor")
|
||||
{
|
||||
CP_XML_NODE(ns + L":pos")
|
||||
{
|
||||
CP_XML_ATTR(L"x", x);
|
||||
CP_XML_ATTR(L"y", y);
|
||||
}
|
||||
CP_XML_NODE(ns + L":ext")
|
||||
{
|
||||
CP_XML_ATTR(L"cx", cx);
|
||||
CP_XML_ATTR(L"cy", cy);
|
||||
}
|
||||
xml_serialize(CP_XML_STREAM(), *this, ns);
|
||||
CP_XML_NODE(ns + L":clientData");
|
||||
}
|
||||
}
|
||||
else if (type_anchor == 3)
|
||||
{
|
||||
CP_XML_NODE(ns + L":relSizeAnchor")
|
||||
{
|
||||
CP_XML_NODE(ns + L":from")
|
||||
{
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y / *owner_cy_);
|
||||
}
|
||||
}
|
||||
CP_XML_NODE(ns + L":to")
|
||||
{
|
||||
_INT32 x1 = x + cx;
|
||||
_INT32 y1 = y + cy;
|
||||
|
||||
CP_XML_NODE(ns + L":x")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)x1 / *owner_cx_);
|
||||
}
|
||||
CP_XML_NODE(ns + L":y")
|
||||
{
|
||||
CP_XML_STREAM() << ((double)y1 / *owner_cy_);
|
||||
}
|
||||
}
|
||||
xml_serialize(CP_XML_STREAM(), *this, ns);
|
||||
}
|
||||
xml_serialize(strm, *this, ns);
|
||||
}
|
||||
|
||||
}
|
||||
@ -443,12 +450,13 @@ void _xlsx_drawing::serialize_object (std::wostream & strm)
|
||||
{
|
||||
CP_XML_ATTR(L"r:id", fill.bitmap->rId);
|
||||
}
|
||||
|
||||
CP_XML_NODE(L"anchor")
|
||||
{
|
||||
CP_XML_ATTR(L"moveWithCells", 1);
|
||||
|
||||
from_.serialize (CP_XML_STREAM(), L"", L"");
|
||||
to_.serialize (CP_XML_STREAM(), L"", L"");
|
||||
from_.serialize(CP_XML_STREAM(), L"", L"");
|
||||
to_.serialize(CP_XML_STREAM(), L"", L"");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,9 +65,11 @@ public:
|
||||
|
||||
std::wstring content_group_;
|
||||
|
||||
virtual void serialize (std::wostream & strm) {return serialize(strm, L"xdr");}
|
||||
std::vector<_xlsx_drawing> childs_;
|
||||
|
||||
void serialize (std::wostream & strm, const std::wstring & ns);
|
||||
virtual void serialize (std::wostream & strm) { return serialize(strm, L"xdr", false); }
|
||||
|
||||
void serialize (std::wostream & strm, const std::wstring & ns, bool local);
|
||||
void serialize_vml (std::wostream & strm);
|
||||
void serialize_object (std::wostream & strm);
|
||||
void serialize_control (std::wostream & strm);
|
||||
|
||||
@ -146,9 +146,9 @@ public:
|
||||
|
||||
mediaitems_ptr & get_mediaitems() { return handle_->impl_->get_mediaitems(); }
|
||||
|
||||
void serialize(std::wostream & strm, const std::wstring & ns = L"xdr")
|
||||
void serialize(std::wostream & strm, const std::wstring & ns, bool local)
|
||||
{
|
||||
xlsx_drawings_->serialize(strm, ns);
|
||||
xlsx_drawings_->serialize(strm, ns, local);
|
||||
}
|
||||
void serialize_vml(std::wostream & strm)
|
||||
{
|
||||
@ -176,9 +176,10 @@ private:
|
||||
};
|
||||
|
||||
|
||||
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h)
|
||||
xlsx_drawing_context::xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h, bool in_text)
|
||||
: impl_(new xlsx_drawing_context::Impl(h))
|
||||
{
|
||||
{
|
||||
in_text_ = in_text;
|
||||
hlinks_size_ = 0;
|
||||
clear();
|
||||
}
|
||||
@ -394,8 +395,8 @@ void xlsx_drawing_context::end_frame()
|
||||
else
|
||||
{
|
||||
impl_->current_level_->push_back(impl_->object_description_);
|
||||
clear();
|
||||
}
|
||||
clear();
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::set_chart(const std::wstring & path)
|
||||
@ -541,7 +542,7 @@ void xlsx_drawing_context::process_common_properties(drawing_object_description
|
||||
drawing.type_anchor = 2; // absolute
|
||||
}
|
||||
|
||||
if (drawing.type_anchor == 1)
|
||||
if (drawing.type_anchor == 1 || obj.type_ == typeMsObject || obj.type_ == typeOleObject || obj.type_ == typeControl)
|
||||
{
|
||||
xlsx_table_position from, to;
|
||||
|
||||
@ -595,7 +596,7 @@ void xlsx_drawing_context::process_position_properties(drawing_object_descriptio
|
||||
|
||||
if (obj.svg_rect_)
|
||||
{
|
||||
x = obj.svg_rect_->x;
|
||||
x = obj.svg_rect_->x;
|
||||
y = obj.svg_rect_->y;
|
||||
cx = obj.svg_rect_->cx;
|
||||
cy = obj.svg_rect_->cy;
|
||||
@ -746,7 +747,12 @@ void xlsx_drawing_context::process_object(drawing_object_description & obj, xlsx
|
||||
}
|
||||
|
||||
if (drawing.inGroup)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_, false, false); // не объект
|
||||
{// не объекты
|
||||
if (obj.type_ == typeControl || obj.type_ == typeComment)
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_, false, false);
|
||||
else
|
||||
impl_->get_drawings()->add(isMediaInternal, drawing.objectId, ref, obj.type_, true, false);
|
||||
}
|
||||
}
|
||||
void xlsx_drawing_context::process_shape(drawing_object_description & obj,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
@ -757,15 +763,17 @@ void xlsx_drawing_context::process_shape(drawing_object_description & obj,_xlsx_
|
||||
xlsx_drawings_->add(drawing, isMediaInternal, rId, ref, obj.type_);
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_table_metrics & table_metrics,_xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_table_metrics & table_metrics, _xlsx_drawing & drawing, xlsx_drawings_ptr xlsx_drawings_)
|
||||
{
|
||||
xlsx_drawings_ptr xlsx_drawings_child(xlsx_drawings::create(true));
|
||||
|
||||
process_group_objects ( obj.child_objects_, table_metrics, xlsx_drawings_child);
|
||||
process_group_objects( obj.child_objects_, table_metrics, xlsx_drawings_child);
|
||||
|
||||
drawing.childs_ = xlsx_drawings_child->get();
|
||||
|
||||
std::wstringstream strm;
|
||||
|
||||
xlsx_drawings_child->serialize(strm, L"xdr");
|
||||
xlsx_drawings_child->serialize(strm, L"xdr", in_text_);
|
||||
|
||||
drawing.content_group_ = strm.str();
|
||||
|
||||
@ -828,9 +836,9 @@ void xlsx_drawing_context::process_group_objects(std::vector<drawing_object_desc
|
||||
}
|
||||
}
|
||||
|
||||
void xlsx_drawing_context::serialize(std::wostream & strm, const std::wstring& ns)
|
||||
void xlsx_drawing_context::serialize(std::wostream & strm, const std::wstring& ns, bool local)
|
||||
{
|
||||
impl_->serialize(strm, ns);
|
||||
impl_->serialize(strm, ns, local);
|
||||
}
|
||||
void xlsx_drawing_context::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
|
||||
@ -86,7 +86,7 @@ typedef _CP_PTR(xlsx_drawing_context_handle) xlsx_drawing_context_handle_ptr;
|
||||
class xlsx_drawing_context
|
||||
{
|
||||
public:
|
||||
xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h);
|
||||
xlsx_drawing_context(xlsx_drawing_context_handle_ptr & h, bool in_text = false);
|
||||
~xlsx_drawing_context();
|
||||
|
||||
bool isDefault();
|
||||
@ -145,7 +145,7 @@ public:
|
||||
|
||||
void clear();
|
||||
|
||||
void serialize(std::wostream & strm, const std::wstring& ns = L"xdr");
|
||||
void serialize(std::wostream & strm, const std::wstring& ns = L"xdr", bool local = false);
|
||||
void serialize_vml(std::wostream & strm);
|
||||
|
||||
std::wstring dump_path(std::vector<svg_path::_polyline> & path, double w,double h);
|
||||
@ -177,8 +177,11 @@ private:
|
||||
int hlinks_size_;
|
||||
std::wstring odf_packet_path_ ;
|
||||
float dpi_;
|
||||
|
||||
bool in_text_ = false;
|
||||
|
||||
};
|
||||
typedef _CP_PTR(xlsx_drawing_context) xlsx_drawing_context_ptr;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void serialize(std::wostream & strm, const std::wstring & ns)
|
||||
void serialize(std::wostream & strm, const std::wstring & ns, bool local)
|
||||
{
|
||||
if (drawings_.empty()) return;
|
||||
|
||||
@ -118,30 +118,40 @@ public:
|
||||
{
|
||||
for (size_t i = 0 ; i < drawings_.size(); i++)
|
||||
{
|
||||
drawings_[i].serialize(strm, ns);
|
||||
drawings_[i].serialize(strm, ns, local);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CP_XML_WRITER(strm)
|
||||
{
|
||||
CP_XML_NODE(ns + L":wsDr")
|
||||
if (false == local)
|
||||
{
|
||||
if (ns == L"xdr")
|
||||
CP_XML_NODE(ns + L":wsDr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||
}
|
||||
if (ns == L"cdr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing");
|
||||
}
|
||||
CP_XML_ATTR(L"xmlns:a" , L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r" , L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:a14", L"http://schemas.microsoft.com/office/drawing/2010/main");
|
||||
if (ns == L"xdr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:xdr", L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing");
|
||||
}
|
||||
if (ns == L"cdr")
|
||||
{
|
||||
CP_XML_ATTR(L"xmlns:cdr", L"http://schemas.openxmlformats.org/drawingml/2006/chartDrawing");
|
||||
}
|
||||
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
|
||||
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
|
||||
CP_XML_ATTR(L"xmlns:a14", L"http://schemas.microsoft.com/office/drawing/2010/main");
|
||||
|
||||
for (size_t i = 0 ; i < drawings_.size(); i++)
|
||||
for (size_t i = 0; i < drawings_.size(); i++)
|
||||
{
|
||||
drawings_[i].serialize(CP_XML_STREAM(), ns, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < drawings_.size(); i++)
|
||||
{
|
||||
drawings_[i].serialize(CP_XML_STREAM(), ns);
|
||||
drawings_[i].serialize(strm, ns, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -220,16 +230,12 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
void serialize_objects(std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0 ; i < drawings_.size(); i++)
|
||||
{
|
||||
if (drawings_[i].type != typeOleObject && drawings_[i].type != typeMsObject) continue;
|
||||
|
||||
drawings_[i].serialize_object(strm);
|
||||
}
|
||||
}
|
||||
void serialize_controls(std::wostream & strm)
|
||||
|
||||
void serialize_objects(std::wostream & strm)
|
||||
{
|
||||
serialize_objects(drawings_, strm);
|
||||
}
|
||||
void serialize_controls(std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0 ; i < vml_drawings_.size(); i++)
|
||||
{
|
||||
@ -291,9 +297,25 @@ public:
|
||||
(xlsx_sheet_rels_[i].is_internal ? L"" : L"External")) );
|
||||
}
|
||||
}
|
||||
bool inGroup;
|
||||
|
||||
std::vector<_xlsx_drawing> get()
|
||||
{
|
||||
return drawings_;
|
||||
}
|
||||
bool inGroup = false;
|
||||
private:
|
||||
void serialize_objects(std::vector<_xlsx_drawing> & drawings, std::wostream & strm)
|
||||
{
|
||||
for (size_t i = 0; i < drawings.size(); i++)
|
||||
{
|
||||
if (drawings[i].type == typeGroupShape)
|
||||
{
|
||||
return serialize_objects(drawings[i].childs_, strm);
|
||||
}
|
||||
if (drawings[i].type != typeOleObject && drawings[i].type != typeMsObject) continue;
|
||||
|
||||
drawings[i].serialize_object(strm);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<_xlsx_drawing> drawings_;
|
||||
std::vector<_xlsx_drawing> vml_drawings_;
|
||||
@ -311,7 +333,10 @@ xlsx_drawings::xlsx_drawings(bool inGroup_) : impl_( new xlsx_drawings::Impl() )
|
||||
xlsx_drawings::~xlsx_drawings()
|
||||
{
|
||||
}
|
||||
|
||||
std::vector<_xlsx_drawing> xlsx_drawings::get()
|
||||
{
|
||||
return impl_->get();
|
||||
}
|
||||
void xlsx_drawings::add(_xlsx_drawing & d, bool isInternal, std::wstring const & rid,
|
||||
std::wstring const & ref, _rels_type type, bool sheet_rel)
|
||||
{
|
||||
@ -323,9 +348,9 @@ void xlsx_drawings::add( bool isInternal, std::wstring const & rid, std::wstring
|
||||
impl_->add(isInternal, rid, ref, type, sheet_rel, vml_rel);
|
||||
}
|
||||
|
||||
void xlsx_drawings::serialize(std::wostream & strm, const std::wstring & ns)
|
||||
void xlsx_drawings::serialize(std::wostream & strm, const std::wstring & ns, bool local)
|
||||
{
|
||||
impl_->serialize(strm, ns);
|
||||
impl_->serialize(strm, ns, local);
|
||||
}
|
||||
void xlsx_drawings::serialize_vml(std::wostream & strm)
|
||||
{
|
||||
|
||||
@ -73,10 +73,12 @@ public:
|
||||
void dump_rels_drawing (rels & Rels);
|
||||
void dump_rels_vml_drawing (rels & Rels);
|
||||
|
||||
void serialize (std::wostream & _Wostream, const std::wstring & ns);
|
||||
void serialize (std::wostream & _Wostream, const std::wstring & ns, bool local);
|
||||
void serialize_vml (std::wostream & _Wostream);
|
||||
void serialize_objects (std::wostream & _Wostream);
|
||||
void serialize_controls (std::wostream & _Wostream);
|
||||
|
||||
std::vector<_xlsx_drawing> get();
|
||||
private:
|
||||
class Impl;
|
||||
_CP_SCOPED_PTR(Impl) impl_;
|
||||
|
||||
@ -36,10 +36,10 @@ namespace oox {
|
||||
|
||||
struct xlsx_table_position
|
||||
{
|
||||
size_t col;
|
||||
double colOff;
|
||||
size_t row;
|
||||
double rowOff;
|
||||
size_t col = 0;
|
||||
double colOff = 0;
|
||||
size_t row = 0;
|
||||
double rowOff = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -632,6 +632,18 @@ void xlsx_conversion_context::start_paragraph(const std::wstring & styleName)
|
||||
|
||||
void xlsx_conversion_context::end_paragraph()
|
||||
{
|
||||
if (xlsx_text_context_.is_drawing_context())
|
||||
{
|
||||
get_drawing_context().process_objects(get_table_metrics());
|
||||
|
||||
if (false == get_drawing_context().empty())
|
||||
{
|
||||
std::wstringstream strm;
|
||||
get_drawing_context().serialize(strm, L"a", true);
|
||||
|
||||
xlsx_text_context_.add_paragraph(strm.str());
|
||||
}
|
||||
}
|
||||
xlsx_text_context_.end_paragraph();
|
||||
}
|
||||
|
||||
@ -761,10 +773,22 @@ xlsx_table_metrics & xlsx_conversion_context::get_table_metrics()
|
||||
{
|
||||
return get_table_context().get_table_metrics();
|
||||
}
|
||||
|
||||
void xlsx_conversion_context::start_drawing_context()
|
||||
{//todooo если делать множественную вложенность -> vector
|
||||
if (xlsx_drawing_context_) return;
|
||||
|
||||
xlsx_drawing_context_ = boost::shared_ptr<xlsx_drawing_context>(new xlsx_drawing_context(get_drawing_context_handle(), true));
|
||||
}
|
||||
void xlsx_conversion_context::end_drawing_context()
|
||||
{
|
||||
xlsx_drawing_context_.reset();
|
||||
}
|
||||
xlsx_drawing_context & xlsx_conversion_context::get_drawing_context()
|
||||
{
|
||||
return get_table_context().get_drawing_context();
|
||||
if (xlsx_drawing_context_)
|
||||
return *xlsx_drawing_context_;
|
||||
else
|
||||
return get_table_context().get_drawing_context();
|
||||
}
|
||||
xlsx_conditionalFormatting_context & xlsx_conversion_context::get_conditionalFormatting_context()
|
||||
{
|
||||
@ -811,7 +835,7 @@ void xlsx_conversion_context::end_hyperlink(std::wstring const & href)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::wstring hId = get_drawing_context().add_hyperlink(href);
|
||||
std::wstring hId = get_table_context().get_drawing_context().add_hyperlink(href); // на внешний объект
|
||||
xlsx_text_context_.end_hyperlink(hId);
|
||||
|
||||
xlsx_text_context_.end_span2();
|
||||
|
||||
@ -173,6 +173,9 @@ public:
|
||||
xlsx_comments_context_handle & get_comments_context_handle();
|
||||
xlsx_conditionalFormatting_context & get_conditionalFormatting_context();
|
||||
|
||||
void start_drawing_context();
|
||||
void end_drawing_context();
|
||||
|
||||
xlsx_dataValidations_context & get_dataValidations_context() { return xlsx_dataValidations_context_;}
|
||||
|
||||
xlsx_drawing_context_handle_ptr & get_drawing_context_handle();
|
||||
@ -214,6 +217,7 @@ private:
|
||||
xlsx_comments_context_handle xlsx_comments_context_handle_;
|
||||
xlsx_dataValidations_context xlsx_dataValidations_context_;
|
||||
xlsx_drawing_context_handle_ptr drawing_context_handle_;
|
||||
xlsx_drawing_context_ptr xlsx_drawing_context_;
|
||||
|
||||
math_context math_context_;
|
||||
forms_context forms_context_;
|
||||
|
||||
@ -131,6 +131,10 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
const std::wstring textStyleName = common_draw_attlist_.common_shape_draw_attlist_.draw_text_style_name_.get_value_or(L"");
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
if (Context.get_text_context().is_drawing_context())
|
||||
{
|
||||
Context.get_drawing_context().set_text_box();
|
||||
}
|
||||
|
||||
bool bInnerFrame = Context.get_drawing_context().start_frame();
|
||||
|
||||
@ -211,8 +215,9 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
office_element_ptr const & elm = content_[i];
|
||||
elm->xlsx_convert(Context);
|
||||
}
|
||||
Context.get_drawing_context().end_frame();
|
||||
Context.get_drawing_context().end_drawing();
|
||||
|
||||
Context.get_drawing_context().end_frame();
|
||||
}
|
||||
|
||||
void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
@ -251,13 +256,15 @@ void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
Context.get_drawing_context().set_image(href);
|
||||
|
||||
////////////////////////////////////в принципе достаточно общая часть ...
|
||||
Context.get_text_context().start_drawing_content();//... если в объекте есть текст он привяжется к объекту - иначе к ячейке
|
||||
Context.get_text_context().start_drawing_content(); //... если в объекте есть текст он привяжется к объекту - иначе к ячейке
|
||||
Context.start_drawing_context();
|
||||
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
Context.end_drawing_context();
|
||||
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
@ -296,6 +303,7 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
Context.get_drawing_context().set_text_box();
|
||||
|
||||
Context.get_text_context().start_drawing_content();
|
||||
Context.start_drawing_context();
|
||||
|
||||
for (size_t i = 0 ; i < content_.size(); i++)
|
||||
{
|
||||
@ -303,6 +311,7 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
}
|
||||
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
Context.end_drawing_context();
|
||||
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
|
||||
@ -145,6 +145,7 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////
|
||||
Context.get_text_context().start_drawing_content();
|
||||
Context.start_drawing_context();
|
||||
|
||||
if (word_art_)
|
||||
{
|
||||
@ -156,6 +157,7 @@ void draw_shape::common_xlsx_convert(oox::xlsx_conversion_context & Context)
|
||||
content_[i]->xlsx_convert(Context);
|
||||
}
|
||||
std::wstring text_content_ = Context.get_text_context().end_drawing_content();
|
||||
Context.end_drawing_context();
|
||||
|
||||
if (!text_content_.empty())
|
||||
{
|
||||
|
||||
@ -46,6 +46,9 @@ EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Oox2OdfConverter", "..\..\..\OdfFile\Projects\Windows\Oox2OdfConverter.vcxproj", "{BEE01B53-244A-44E6-8947-ED9342D9247E}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(Performance) = preSolution
|
||||
HasPerformanceSessions = true
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Debug|x64 = Debug|x64
|
||||
|
||||
Reference in New Issue
Block a user