Commit 7dbbacf3 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - fix after testing

parent f43a0bbf
...@@ -378,7 +378,8 @@ void docx_conversion_context::start_document() ...@@ -378,7 +378,8 @@ void docx_conversion_context::start_document()
output_stream() << L"xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" "; output_stream() << L"xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" ";
output_stream() << L"xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" "; output_stream() << L"xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" ";
output_stream() << L"xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" "; output_stream() << L"xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" ";
output_stream() << L"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" "; output_stream() << L"xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" ";
output_stream() << L"xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\" ";
output_stream() << L"mc:Ignorable=\"w14 wp14\">"; output_stream() << L"mc:Ignorable=\"w14 wp14\">";
...@@ -406,14 +407,12 @@ void docx_conversion_context::end_document() ...@@ -406,14 +407,12 @@ void docx_conversion_context::end_document()
output_document_->get_word_files().set_notes(notes_context_); output_document_->get_word_files().set_notes(notes_context_);
//////////////////////// ////////////////////////
int count = 0; for (size_t i = 0; i < charts_.size(); i++)
BOOST_FOREACH(const oox_chart_context_ptr& chart, charts_)
{ {
count++;
package::chart_content_ptr content = package::chart_content::create(); package::chart_content_ptr content = package::chart_content::create();
chart->serialize(content->content()); charts_[i]->serialize(content->content());
chart->dump_rels(content->get_rel_file()->get_rels()); charts_[i]->dump_rels(content->get_rel_file()->get_rels());
output_document_->get_word_files().add_charts(content); output_document_->get_word_files().add_charts(content);
...@@ -580,10 +579,10 @@ mc:Ignorable=\"w14 wp14\">"; ...@@ -580,10 +579,10 @@ mc:Ignorable=\"w14 wp14\">";
strm << L"</w:abstractNum>"; strm << L"</w:abstractNum>";
} }
BOOST_FOREACH(int numId, numIds) for (size_t i = 0; i < numIds.size(); i++)
{ {
strm << L"<w:num w:numId=\"" << numId << L"\" >"; strm << L"<w:num w:numId=\"" << numIds[i] << L"\" >";
strm << L"<w:abstractNumId w:val=\"" << numId << "\" />"; strm << L"<w:abstractNumId w:val=\"" << numIds[i] << "\" />";
strm << L"</w:num>"; strm << L"</w:num>";
} }
......
...@@ -319,6 +319,7 @@ namespace ...@@ -319,6 +319,7 @@ namespace
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \ xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \ xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \ xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" >"; xmlns:a14=\"http://schemas.microsoft.com/office/drawing/2010/main\" >";
//mc:Ignorable=\"w14 wp14\" //mc:Ignorable=\"w14 wp14\"
......
...@@ -57,6 +57,7 @@ oox_chart_series::oox_chart_series() ...@@ -57,6 +57,7 @@ oox_chart_series::oox_chart_series()
iSymbolMarkerType_ = 0; iSymbolMarkerType_ = 0;
bLocalTable_ = false; bLocalTable_ = false;
labelPosEnabled_ = true;
} }
void oox_chart_series::setName(std::wstring &value) void oox_chart_series::setName(std::wstring &value)
{ {
...@@ -135,7 +136,7 @@ void oox_chart_series::parse_properties() ...@@ -135,7 +136,7 @@ void oox_chart_series::parse_properties()
if (*intVal == 2) data_labels_->set_showPercent(true); if (*intVal == 2) data_labels_->set_showPercent(true);
} }
odf_reader::GetProperty(content_.properties_, L"label-position", intVal); odf_reader::GetProperty(content_.properties_, L"label-position", intVal);
if (intVal) if (intVal && labelPosEnabled_)
{ {
if (!data_labels_) data_labels_ = oox_data_labels(); if (!data_labels_) data_labels_ = oox_data_labels();
......
...@@ -55,6 +55,7 @@ public: ...@@ -55,6 +55,7 @@ public:
virtual void oox_serialize(std::wostream & _Wostream) = 0; virtual void oox_serialize(std::wostream & _Wostream) = 0;
bool labelPosEnabled_;
_oox_chart_values values_[5]; //cat(labels), common, x, y, bubble, _oox_chart_values values_[5]; //cat(labels), common, x, y, bubble,
int id_; int id_;
std::wstring name_; //tx (Series Text) §21.2.2.215 std::wstring name_; //tx (Series Text) §21.2.2.215
......
...@@ -117,15 +117,15 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream) ...@@ -117,15 +117,15 @@ void oox_data_labels::oox_serialize(std::wostream & _Wostream)
case 1: CP_XML_ATTR(L"val", L"b"); break; case 1: CP_XML_ATTR(L"val", L"b"); break;
case 2: CP_XML_ATTR(L"val", L"b"); break; case 2: CP_XML_ATTR(L"val", L"b"); break;
case 3: CP_XML_ATTR(L"val", L"b"); break; case 3: CP_XML_ATTR(L"val", L"b"); break;
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
case 5: CP_XML_ATTR(L"val", L"inEnd"); break;
case 6: CP_XML_ATTR(L"val", L"l"); break; case 6: CP_XML_ATTR(L"val", L"l"); break;
case 7: CP_XML_ATTR(L"val", L"inBase"); break; case 7: CP_XML_ATTR(L"val", L"inBase"); break;
case 8: CP_XML_ATTR(L"val", L"outEnd"); break;
case 9: CP_XML_ATTR(L"val", L"r"); break; case 9: CP_XML_ATTR(L"val", L"r"); break;
case 10: CP_XML_ATTR(L"val", L"t"); break; case 10: CP_XML_ATTR(L"val", L"t"); break;
case 11: CP_XML_ATTR(L"val", L"t"); break; case 11: CP_XML_ATTR(L"val", L"t"); break;
case 12: CP_XML_ATTR(L"val", L"t"); break; case 12: CP_XML_ATTR(L"val", L"t"); break;
case 5: //CP_XML_ATTR(L"val", L"inEnd"); break;
case 8: //CP_XML_ATTR(L"val", L"outEnd"); break;
case 4: CP_XML_ATTR(L"val", L"ctr"); break;
} }
} }
......
...@@ -171,7 +171,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope ...@@ -171,7 +171,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
if ( color.empty() ) if ( color.empty() )
{ {
if (always_draw) color = L"000000"; if (always_draw) color = L"000000";
else color = L"FFFFFFFF"; else color = L"FFFFFF";
} }
CP_XML_NODE(L"a:srgbClr") CP_XML_NODE(L"a:srgbClr")
...@@ -210,16 +210,15 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope ...@@ -210,16 +210,15 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf_reader::_prope
} }
} }
} }
void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop) void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_property> & prop, const std::wstring & shapeGeomPreset)
{ {
CP_XML_WRITER(strm) CP_XML_WRITER(strm)
{ {
CP_XML_NODE(L"a:avLst") CP_XML_NODE(L"a:avLst")
{ {
_CP_OPT(bool) bModifiers;
_CP_OPT(std::wstring) strModifiers; _CP_OPT(std::wstring) strModifiers;
odf_reader::GetProperty(prop, L"bModifiers", bModifiers);
odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers); odf_reader::GetProperty(prop, L"oox-draw-modifiers", strModifiers);
if (strModifiers) if (strModifiers)
{ {
std::vector< std::wstring > values; std::vector< std::wstring > values;
...@@ -227,17 +226,61 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro ...@@ -227,17 +226,61 @@ void oox_serialize_aLst(std::wostream & strm, const std::vector<odf_reader::_pro
if (!values.empty() && values.back().empty()) values.pop_back(); if (!values.empty() && values.back().empty()) values.pop_back();
std::vector<std::wstring> names;
if (std::wstring::npos != shapeGeomPreset.find(L"math") ||
std::wstring::npos != shapeGeomPreset.find(L"bentConnector") ||
std::wstring::npos != shapeGeomPreset.find(L"curvedConnector")||
std::wstring::npos != shapeGeomPreset.find(L"frame"))
{
names.push_back(L"adj1");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"decagon"))
{
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"heptagon") ||
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");
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"star5")||
std::wstring::npos != shapeGeomPreset.find(L"star7"))
{
names.push_back(L"adj");
names.push_back(L"hf");
names.push_back(L"vf");
}
else if (std::wstring::npos != shapeGeomPreset.find(L"star6") ||
std::wstring::npos != shapeGeomPreset.find(L"star10"))
{
names.push_back(L"adj");
names.push_back(L"hf");
}
for (size_t i = 0; i < values.size(); i++) for (size_t i = 0; i < values.size(); i++)
{ {
if (values[i].empty()) continue; if (values[i].empty()) continue;
CP_XML_NODE(L"a:gd") CP_XML_NODE(L"a:gd")
{ {
//if (values.size() > 1 || bModifiers) if (names.size() > i)
//весьма странное .. для некоторых модификаторов (напр math...) нужно указывать множественность их {
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i+1)); CP_XML_ATTR(L"name", names[i]);
//else }
// CP_XML_ATTR(L"name", L"adj"); else
{
if (values.size() > 1)
CP_XML_ATTR(L"name", L"adj" + std::to_wstring(i + 1));
else
CP_XML_ATTR(L"name", L"adj");
}
CP_XML_ATTR(L"fmla", L"val " + values[i]); CP_XML_ATTR(L"fmla", L"val " + values[i]);
} }
} }
...@@ -321,7 +364,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n ...@@ -321,7 +364,8 @@ void _oox_drawing::serialize_bodyPr(std::wostream & strm, const std::wstring & n
CP_XML_NODE(L"a:prstTxWarp") CP_XML_NODE(L"a:prstTxWarp")
{ {
CP_XML_ATTR(L"prst", shapeType); CP_XML_ATTR(L"prst", shapeType);
oox_serialize_aLst(CP_XML_STREAM(), prop);
oox_serialize_aLst(CP_XML_STREAM(), prop, shapeType);
} }
} }
} }
...@@ -370,7 +414,8 @@ void _oox_drawing::serialize_shape(std::wostream & strm) ...@@ -370,7 +414,8 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
{ {
CP_XML_NODE(L"a:custGeom") CP_XML_NODE(L"a:custGeom")
{ {
oox_serialize_aLst(CP_XML_STREAM(), additional); std::vector<std::wstring> names;
oox_serialize_aLst(CP_XML_STREAM(), additional, L"");
CP_XML_NODE(L"a:ahLst"); CP_XML_NODE(L"a:ahLst");
CP_XML_NODE(L"a:gdLst"); CP_XML_NODE(L"a:gdLst");
...@@ -414,11 +459,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm) ...@@ -414,11 +459,7 @@ void _oox_drawing::serialize_shape(std::wostream & strm)
CP_XML_ATTR(L"prst", shapeGeomPreset); CP_XML_ATTR(L"prst", shapeGeomPreset);
if (!bWordArt) if (!bWordArt)
{ {
if (std::wstring::npos != shapeGeomPreset.find(L"mathPlus")) oox_serialize_aLst(CP_XML_STREAM(), additional, shapeGeomPreset);
{
additional.push_back(odf_reader::_property(L"bModifiers", true));
}
oox_serialize_aLst(CP_XML_STREAM(), additional);
} }
} }
} }
...@@ -525,9 +566,6 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val) ...@@ -525,9 +566,6 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
{ {
CP_XML_NODE(L"a:hlinkClick") CP_XML_NODE(L"a:hlinkClick")
{ {
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
if (!val.action.empty()) if (!val.action.empty())
CP_XML_ATTR(L"action", val.action); CP_XML_ATTR(L"action", val.action);
...@@ -544,6 +582,8 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val) ...@@ -544,6 +582,8 @@ void oox_serialize_action(std::wostream & strm, _action_desc const & val)
CP_XML_ATTR(L"name", L"sound"); CP_XML_ATTR(L"name", L"sound");
} }
} }
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
} }
} }
} }
......
...@@ -118,7 +118,7 @@ namespace oox { ...@@ -118,7 +118,7 @@ namespace oox {
typedef _CP_PTR(_oox_drawing) oox_drawing_ptr; typedef _CP_PTR(_oox_drawing) oox_drawing_ptr;
void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false); void oox_serialize_ln (std::wostream & strm, const std::vector<odf_reader::_property> & val, bool always_draw = false);
void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val); void oox_serialize_aLst (std::wostream & strm, const std::vector<odf_reader::_property> & val, const std::wstring & shapeGeomPreset);
void oox_serialize_action (std::wostream & strm, const _action_desc & val); void oox_serialize_action (std::wostream & strm, const _action_desc & val);
} }
......
...@@ -168,7 +168,7 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val) ...@@ -168,7 +168,7 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{ {
if (val.bitmap->isInternal) if (val.bitmap->isInternal)
{ {
//CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"); CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"r:embed", val.bitmap->rId ); CP_XML_ATTR(L"r:embed", val.bitmap->rId );
} }
else else
......
...@@ -102,6 +102,10 @@ void oox_chart::oox_serialize_common(std::wostream & _Wostream) ...@@ -102,6 +102,10 @@ void oox_chart::oox_serialize_common(std::wostream & _Wostream)
} }
for (size_t i = 0; i < series_.size(); i++) for (size_t i = 0; i < series_.size(); i++)
{ {
if (is3D_ || type_ == CHART_TYPE_AREA || type_ == CHART_TYPE_STOCK)
{
series_[i]->labelPosEnabled_ = false;
}
series_[i]->oox_serialize(_Wostream); series_[i]->oox_serialize(_Wostream);
} }
for (size_t i = 0; i < axisId_.size(); i++) for (size_t i = 0; i < axisId_.size(); i++)
......
...@@ -472,6 +472,13 @@ void pptx_slide_context::set_media_param(std::wstring name, std::wstring value) ...@@ -472,6 +472,13 @@ void pptx_slide_context::set_media_param(std::wstring name, std::wstring value)
void pptx_slide_context::set_image(const std::wstring & path) void pptx_slide_context::set_image(const std::wstring & path)
{ {
int pos_replaicement = path.find(L"ObjectReplacements");
if (pos_replaicement >= 0)
{
if (path.length() - (pos_replaicement + 18) < 2)
return; //object without image
}
if (impl_->object_description_.type_ == typeUnknown) if (impl_->object_description_.type_ == typeUnknown)
{ {
impl_->object_description_.type_ = typeImage; impl_->object_description_.type_ = typeImage;
......
...@@ -299,6 +299,13 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w ...@@ -299,6 +299,13 @@ void xlsx_drawing_context::set_ms_object(const std::wstring & path, const std::w
} }
void xlsx_drawing_context::set_image(const std::wstring & path) void xlsx_drawing_context::set_image(const std::wstring & path)
{ {
int pos_replaicement = path.find(L"ObjectReplacements");
if (pos_replaicement >= 0)
{
if (path.length() - (pos_replaicement + 18) < 2)
return; //object without image
}
if (impl_->object_description_.type_ == typeUnknown) if (impl_->object_description_.type_ == typeUnknown)
{ {
impl_->object_description_.type_ = typeImage; impl_->object_description_.type_ = typeImage;
......
...@@ -108,7 +108,6 @@ font_weight font_weight::parse(const std::wstring & Str) ...@@ -108,7 +108,6 @@ font_weight font_weight::parse(const std::wstring & Str)
return font_weight( W900 ); return font_weight( W900 );
else else
{ {
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return WNormal; return WNormal;
} }
} }
......
...@@ -84,7 +84,6 @@ vertical_align vertical_align::parse(const std::wstring & Str) ...@@ -84,7 +84,6 @@ vertical_align vertical_align::parse(const std::wstring & Str)
return vertical_align( Justify ); return vertical_align( Justify );
else else
{ {
BOOST_THROW_EXCEPTION( errors::invalid_attribute() );
return vertical_align( Baseline ); return vertical_align( Baseline );
} }
} }
......
...@@ -1067,7 +1067,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context) ...@@ -1067,7 +1067,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
return; return;
std::wstring href = common_xlink_attlist_.href_.get_value_or(L""); std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
int pos_replaicement= href.find(L"ObjectReplacements"); int pos_replaicement = href.find(L"ObjectReplacements");
const draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner const draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner
if (!frame) if (!frame)
...@@ -1076,9 +1076,12 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context) ...@@ -1076,9 +1076,12 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get()); oox::_docx_drawing * drawing = dynamic_cast<oox::_docx_drawing *>(frame->oox_drawing_.get());
if (!drawing) return; if (!drawing) return;
if (pos_replaicement >= 0 && !Context.get_drawing_context().get_use_image_replace()) if (pos_replaicement >= 0)
{ {
return; //skip replacement image (math, chart, ...) - возможно записать как альтернативный контент - todooo ??? if (!Context.get_drawing_context().get_use_image_replace())
return; //skip replacement image (math, chart, ...) - возможно записать как альтернативный контент - todooo ???
if (href.length() - (pos_replaicement + 18) < 2)
return; //href="./ObjectReplacements/"
} }
if (drawing->type == oox::typeUnknown) if (drawing->type == oox::typeUnknown)
...@@ -1122,7 +1125,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context) ...@@ -1122,7 +1125,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
drawing->fill.bitmap = oox::oox_bitmap_fill::create(); drawing->fill.bitmap = oox::oox_bitmap_fill::create();
drawing->fill.type = 2; drawing->fill.type = 2;
drawing->fill.bitmap->isInternal = false; drawing->fill.bitmap->isInternal = false;
drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal,href); drawing->fill.bitmap->rId = Context.add_mediaitem(href, oox::typeImage, drawing->fill.bitmap->isInternal, href);
drawing->fill.bitmap->bStretch = true; drawing->fill.bitmap->bStretch = true;
const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_. const std::wstring styleName = frame->common_draw_attlists_.shape_with_text_and_styles_.
...@@ -1388,12 +1391,24 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context) ...@@ -1388,12 +1391,24 @@ void draw_frame::docx_convert(oox::docx_conversion_context & Context)
Context.set_paragraph_state (false); Context.set_paragraph_state (false);
if (!Context.get_drawing_context().in_group() && !runState) if (!Context.get_drawing_context().in_group() && !runState)
Context.add_new_run(_T("")); {
if (!pState)//0115GS3-KeyboardShortcuts.odt
{
Context.start_paragraph();
}
Context.add_new_run(L"");
}
drawing->serialize(Context.output_stream()/*, Context.get_drawing_state_content()*/); drawing->serialize(Context.output_stream()/*, Context.get_drawing_state_content()*/);
if (!Context.get_drawing_context().in_group() && !runState) if (!Context.get_drawing_context().in_group() && !runState)
{
Context.finish_run(); Context.finish_run();
if (!pState)//0115GS3-KeyboardShortcuts.odt
{
Context.finish_paragraph();
}
}
Context.set_run_state (runState); Context.set_run_state (runState);
Context.set_paragraph_state (pState); Context.set_paragraph_state (pState);
...@@ -1406,9 +1421,9 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context) ...@@ -1406,9 +1421,9 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
{ {
try try
{ {
std::wstring href = common_xlink_attlist_.href_.get_value_or(L""); std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
if (!odf_document_) if (!odf_document_ && !href.empty())
{ {
std::wstring folderPath = Context.root()->get_folder(); std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href; std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
......
...@@ -257,9 +257,9 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -257,9 +257,9 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
{ {
try try
{ {
std::wstring href = common_xlink_attlist_.href_.get_value_or(L""); std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
if (!odf_document_) if (!odf_document_ && !href.empty())
{ {
std::wstring folderPath = Context.root()->get_folder(); std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href; std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
......
...@@ -265,7 +265,8 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -265,7 +265,8 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
try try
{ {
std::wstring href = common_xlink_attlist_.href_.get_value_or(L""); std::wstring href = common_xlink_attlist_.href_.get_value_or(L"");
if (!odf_document_)
if (!odf_document_ && !href.empty())
{ {
std::wstring folderPath = Context.root()->get_folder(); std::wstring folderPath = Context.root()->get_folder();
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href; std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
......
...@@ -86,10 +86,15 @@ void text::add_text(const std::wstring & Text) ...@@ -86,10 +86,15 @@ void text::add_text(const std::wstring & Text)
void text::docx_convert(oox::docx_conversion_context & Context) void text::docx_convert(oox::docx_conversion_context & Context)
{ {
if (Context.get_process_note() != oox::docx_conversion_context::noNote &&
Context.get_delete_text_state())
return; //в ms нет рецензирования notes
Context.add_element_to_run(); Context.add_element_to_run();
std::wostream & strm = Context.output_stream(); std::wostream & strm = Context.output_stream();
std::wstring textNode = L"w:t"; std::wstring textNode = L"w:t";
if (Context.get_delete_text_state()) textNode = L"w:delText"; if (Context.get_delete_text_state()) textNode = L"w:delText";
strm << L"<" << textNode; strm << L"<" << textNode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment