Commit 755ea97a authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - fix same bugs

parent 0f9669aa
......@@ -1102,7 +1102,7 @@ void docx_conversion_context::docx_serialize_list_properties(std::wostream & str
void docx_conversion_context::add_delayed_element(odf_reader::office_element * Elm)
{
delayed_elements_.push_back(Elm);
delayed_elements_.push_back(Elm);
}
void docx_conversion_context::docx_convert_delayed()
......@@ -1110,14 +1110,15 @@ void docx_conversion_context::docx_convert_delayed()
if (delayed_elements_.empty()) return;
if(delayed_converting_)return; //зацикливание иначе
if(get_drawing_context().get_current_level() > 0 )return; //вложенный frame
if(get_drawing_context().get_current_level() > 0 )
return; //вложенный frame
delayed_converting_ = true;
while(!delayed_elements_.empty())
{
odf_reader::office_element * elm = delayed_elements_.front();
elm->docx_convert(*this);
delayed_elements_.pop_front();
delayed_elements_.pop_front();
}
delayed_converting_=false;
}
......
......@@ -435,7 +435,6 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
CP_XML_ATTR(L"y",0);
}
CP_XML_NODE(L"wp:positionH")
{
std::wstring relativeFrom = L"margin";
......@@ -453,15 +452,14 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
else
{
CP_XML_NODE(L"wp:posOffset") {CP_XML_STREAM() << val.posOffsetH;}
}
}
}
CP_XML_NODE(L"wp:positionV")
{
std::wstring relativeFrom = L"paragraph";
if (val.styleVerticalRel)relativeFrom = val.styleVerticalRel->get_type_str();
CP_XML_ATTR(L"relativeFrom",relativeFrom);
if (val.styleVerticalPos &&
......@@ -481,7 +479,6 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
}
}
}
CP_XML_NODE(L"wp:extent")
{
CP_XML_ATTR(L"cx",val.cx);
......@@ -492,6 +489,35 @@ void docx_serialize_wps(std::wostream & strm, _docx_drawing & val)
}
docx_serialize_common(CP_XML_STREAM(), val);
if (val.pctWidth)
{
std::wstring relativeFrom = L"margin";
if (val.styleHorizontalRel) relativeFrom =val.styleHorizontalRel->get_type_str();
CP_XML_NODE(L"wp14:sizeRelH")
{
CP_XML_ATTR(L"relativeFrom", relativeFrom);
CP_XML_NODE(L"wp14:pctWidth")
{
CP_XML_STREAM() << (val.pctWidth.get() * 1000);
}
}
}
if (val.pctHeight)
{
std::wstring relativeFrom = L"paragraph";
if (val.styleVerticalRel)relativeFrom = val.styleVerticalRel->get_type_str();
CP_XML_NODE(L"wp14:sizeRelV")
{
CP_XML_ATTR(L"relativeFrom", relativeFrom);
CP_XML_NODE(L"wp14:pctHeight")
{
CP_XML_STREAM() << (val.pctHeight.get() * 1000);
}
}
}
}
}
}
......
......@@ -49,17 +49,18 @@ struct _docx_drawing : _oox_drawing
_docx_drawing():_oox_drawing(), parallel(0), isInline(false), number_wrapped_paragraphs(0), posOffsetV(0), posOffsetH(0)
{
}
unsigned int parallel;
bool isInline;
unsigned int parallel;
//_CP_OPT(run_through) styleRunThrough ;
//_CP_OPT(run_through) styleRunThrough ;
_CP_OPT(odf_types::horizontal_rel) styleHorizontalRel;
_CP_OPT(odf_types::horizontal_pos) styleHorizontalPos;
_CP_OPT(odf_types::vertical_pos) styleVerticalPos;
_CP_OPT(odf_types::vertical_rel) styleVerticalRel;
_CP_OPT(odf_types::style_wrap) styleWrap;
_CP_OPT(odf_types::style_wrap) styleWrap;
bool isInline;
int number_wrapped_paragraphs;
std::wstring relativeHeight;
......@@ -67,6 +68,9 @@ struct _docx_drawing : _oox_drawing
int posOffsetV;
int posOffsetH;
_CP_OPT(int) pctWidth;
_CP_OPT(int) pctHeight;
int margin_rect[4];//0-left, 1 -top, 2- right, 3 - bottom
//std::wstring distB;
......
......@@ -533,8 +533,9 @@ void common_draw_rel_size_attlist::apply_from(const common_draw_rel_size_attlist
void common_draw_rel_size_attlist::serialize(CP_ATTR_NODE)
{
common_draw_size_attlist_.serialize(CP_GET_XML_NODE());
CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_);
CP_XML_ATTR_OPT(L"style:rel-height", style_rel_height_);
CP_XML_ATTR_OPT(L"style:rel-width", style_rel_width_);
CP_XML_ATTR_OPT(L"style:rel-height", style_rel_height_);
}
//////////////////////////////////////////////////////////////////////////////////////////////////
......
......@@ -443,10 +443,10 @@ public:
void apply_from(const common_draw_rel_size_attlist & Other);
void serialize(CP_ATTR_NODE);
public:
common_draw_size_attlist common_draw_size_attlist_;
_CP_OPT(percent_or_scale) style_rel_width_;
_CP_OPT(percent_or_scale) style_rel_height_;
common_draw_size_attlist common_draw_size_attlist_;
_CP_OPT(percent_or_scale) style_rel_width_;
_CP_OPT(percent_or_scale) style_rel_height_;
};
/// common-vertical-rel-attlist
......
......@@ -185,6 +185,7 @@ static const _shape_converter _OO_OOX_custom_shapes[]=
{L"mso-spt179" ,L"" ,0 ,0 ,0 },
{L"mso-spt180" ,L"" ,0 ,0 ,0 },
{L"mso-spt182" ,L"leftRightUpArrow" ,0 ,0 ,0 },
{L"mso-spt188" ,L"flowChartPunchedTape",0 ,0 ,0 },
{L"mso-spt189" ,L"actionButtonBlank" ,0 ,0 ,0 },
{L"mso-spt190" ,L"actionButtonHome" ,0 ,0 ,0 },
{L"mso-spt191" ,L"actionButtonHelp" ,0 ,0 ,0 },
......@@ -284,7 +285,7 @@ static const _shape_converter _OO_OOX_wordart[]=
{L"fontwork-triangle-up" ,L"textTriangle" ,0 ,0 ,0 },
{L"fontwork-triangle-down" ,L"textTriangleInverted" ,0 ,0 ,0 },
{L"fontwork-circle-pour" ,L"textCirclePour" ,0 ,0 ,0 },
{L"fontwork-circle-pour" ,L"textCirclePour" ,0 ,0 ,0 },
{L"fontwork-circle-curve" ,L"textCircle" ,0 ,0 ,0 },
{L"fontwork-open-circle-curve" ,L"textPlain" ,1 ,30000 , 70000 },
{L"fontwork-open-circle-pour" ,L"textPlain" ,1 ,30000 , 70000 },
......@@ -296,18 +297,18 @@ static const _shape_converter _OO_OOX_wordart[]=
{L"mso-spt142" ,L"textRingInside" ,0 ,0 ,0 },
{L"mso-spt143" ,L"textRingOutside" ,0 ,0 ,0 },
{L"mso-spt157" ,L"textWave2" ,0 ,0 ,0 },
{L"mso-spt157" ,L"textWave2" ,0 ,0 ,0 },
{L"mso-spt158" ,L"textDoubleWave1" ,0 ,0 ,0 },
{L"mso-spt159" ,L"textWave4" ,0 ,0 ,0 },
{L"mso-spt160" ,L"textInflate" ,0 ,0 ,0 },//???
{L"mso-spt161" ,L"textDeflate" ,0 ,0 ,0 },
{L"mso-spt159" ,L"textWave4" ,0 ,0 ,0 },
{L"mso-spt160" ,L"textInflate" ,0 ,0 ,0 },//???
{L"mso-spt161" ,L"textDeflate" ,0 ,0 ,0 },
{L"mso-spt162" ,L"textInflateBottom" ,0 ,0 ,0 },
{L"mso-spt163" ,L"textDeflateBottom" ,0 ,0 ,0 },
{L"mso-spt164" ,L"textInflateTop" ,0 ,0 ,0 },
{L"mso-spt165" ,L"textDeflateTop" ,0 ,0 ,0 },
{L"mso-spt166" ,L"textDeflateInflateDeflate" ,0 ,0 ,0 },
{L"mso-spt174" ,L"textCanUp" ,0 ,0 ,0 },
{L"mso-spt175" ,L"textCanDown" ,0 ,0 ,0 },
{L"mso-spt174" ,L"textCanUp" ,0 ,0 ,0 },
{L"mso-spt175" ,L"textCanDown" ,0 ,0 ,0 },
{L"mso-spt188" ,L"textDoubleWave1" ,0 ,0 ,0 },
};
\ No newline at end of file
......@@ -855,7 +855,6 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
drawing. behindDoc = L"1";
}
drawing.margin_rect[0] = GetMargin(graphicProperties, sideLeft);
drawing.margin_rect[1] = GetMargin(graphicProperties, sideTop);
drawing.margin_rect[2] = GetMargin(graphicProperties, sideRight);
......@@ -864,6 +863,17 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
drawing.posOffsetH = ComputeMarginX(pagePropertiesNode, pageProperties, attlists_, graphicProperties, drawing.additional);
drawing.posOffsetV = ComputeMarginY( pageProperties, attlists_, graphicProperties, drawing.additional);
if (attlists_.rel_size_.style_rel_width_)
{
int type = attlists_.rel_size_.style_rel_width_->get_type();
drawing.pctWidth = attlists_.rel_size_.style_rel_width_->get_percent().get_value();
}
if (attlists_.rel_size_.style_rel_height_ )
{
int type = attlists_.rel_size_.style_rel_height_->get_type();
drawing.pctHeight = attlists_.rel_size_.style_rel_height_->get_percent().get_value();
}
}
drawing.number_wrapped_paragraphs=graphicProperties.style_number_wrapped_paragraphs_.
get_value_or( integer_or_nolimit( integer_or_nolimit::NoLimit) ).get_value();
......@@ -998,7 +1008,7 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
}
void draw_shape::docx_convert(oox::docx_conversion_context & Context)
{
/////...../////
//--------------------------------------------------------------------------------------------------
oox::_docx_drawing drawing = oox::_docx_drawing();
......@@ -1016,10 +1026,17 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
}
Context.get_drawing_context().clear_stream_shape();
/////////
common_draw_docx_convert(Context, common_draw_attlists_, drawing);
/////////
if (bad_shape_ && drawing.fill.bitmap) // CV_Kucheruk_Maria(rus).odt - картинка по дебильному
{
drawing.sub_type = 1;
bad_shape_ = false;
}
if (drawing.fill.type < 1 && !IsExistProperty(drawing.additional,L"stroke"))//бывает что и не определено ничего
{
drawing.fill.solid = oox::oox_solid_fill::create();
......@@ -1027,6 +1044,12 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
drawing.fill.type = 1;
}
if (bad_shape_)
{
Context.get_drawing_context().stop_shape();
return;
}
std::wostream & strm = Context.output_stream();
bool pState = Context.get_paragraph_state();
......@@ -1170,13 +1193,6 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
{
// if (Context.get_drawing_context().get_current_level() > 1 )
//{
// if(Context.delayed_converting_ == false)
// Context.add_delayed_element(Context.get_drawing_context().get_current_frame());
// return;
//}
//тут может быть не только текст , но и таблицы, другие объекты ...
oox::StreamsManPtr prev = Context.get_stream_man();
......@@ -1185,11 +1201,11 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
bool pState = Context.get_paragraph_state ();
bool runState = Context.get_run_state ();
bool keepState = Context.get_paragraph_keep ();
Context.set_run_state (false);
Context.set_paragraph_state (false);
bool drState = Context.get_drawing_state_content();
Context.set_drawing_state_content(true);
......@@ -1205,6 +1221,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
Context.set_run_state (runState);
Context.set_paragraph_state (pState);
Context.set_drawing_state_content (drState);
Context.set_paragraph_keep (keepState);
/////...../////
......@@ -1229,6 +1246,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
//+ локальные
bool auto_fit_text = false;
bool auto_fit_shape = false;
if (!draw_text_box_attlist_.fo_min_height_) draw_text_box_attlist_.fo_min_height_ = frame->draw_frame_attlist_.fo_min_height_;
if (!draw_text_box_attlist_.fo_min_width_) draw_text_box_attlist_.fo_min_width_ = frame->draw_frame_attlist_.fo_min_width_;
......@@ -1238,19 +1256,25 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
size_t min_y = get_value_emu(draw_text_box_attlist_.fo_min_height_->get_length());
if (drawing.cy < min_y)
{
drawing.cy = min_y;
auto_fit_text = true;
drawing.cy = min_y;
}
if (drawing.cy < 36000) auto_fit_shape = true;
}
if ((draw_text_box_attlist_.fo_min_width_) && (draw_text_box_attlist_.fo_min_width_->get_type()==length_or_percent::Length))
{
size_t min_x = get_value_emu(draw_text_box_attlist_.fo_min_width_->get_length());
if (drawing.cx < min_x)
{
drawing.cx = min_x;
auto_fit_text = true;
drawing.cx = min_x;
}
if (drawing.cx < 36000) auto_fit_shape = true;
}
if ((draw_text_box_attlist_.fo_max_height_) && (draw_text_box_attlist_.fo_max_height_->get_type()==length_or_percent::Length))
{
size_t max_y = get_value_emu(draw_text_box_attlist_.fo_max_height_->get_length());
......@@ -1261,9 +1285,12 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
size_t max_x = get_value_emu(draw_text_box_attlist_.fo_max_width_->get_length());
if (drawing.cx > max_x) drawing.cy = max_x;
}
if (auto_fit_text)
if (auto_fit_shape)
drawing.additional.push_back(_property(L"auto-grow-height", auto_fit_shape));
else if (auto_fit_text)
drawing.additional.push_back(_property(L"fit-to-size", auto_fit_text));
///////////////////////////////////////////////////////////////////
std::wostream & strm = Context.output_stream();
......@@ -1277,6 +1304,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
Context.set_paragraph_keep(true);
pState = Context.get_paragraph_state();
}
keepState = Context.get_paragraph_keep();
Context.set_paragraph_state(false);
......@@ -1288,7 +1316,8 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
if (!Context.get_drawing_context().in_group())
Context.finish_run();
Context.set_paragraph_state(pState);
Context.set_paragraph_state (pState);
Context.set_paragraph_keep (keepState);
}
void draw_g::docx_convert(oox::docx_conversion_context & Context)
{
......@@ -1406,7 +1435,6 @@ void draw_g::docx_convert(oox::docx_conversion_context & Context)
}
void draw_frame::docx_convert(oox::docx_conversion_context & Context)
{
//if ((!Context.get_paragraph_state() && !Context.get_drawing_context().in_group()) && !Context.delayed_converting_)
if (Context.get_drawing_context().get_current_level() > 0 && !Context.get_drawing_context().in_group() )
{
Context.add_delayed_element(this);
......
......@@ -467,8 +467,6 @@ void draw_enhanced_geometry::add_child_element( xml::sax * Reader, const std::ws
}
void draw_enhanced_geometry::find_draw_type_oox()
{
word_art_ = false;
if (draw_enhanced_geometry_attlist_.draw_text_path_ &&
*draw_enhanced_geometry_attlist_.draw_text_path_ == true)
{
......@@ -489,12 +487,13 @@ void draw_enhanced_geometry::find_draw_type_oox()
{
if (_OO_OOX_wordart[i].odf_reader == odf_type)
{
word_art_ = true;
draw_type_oox_index_ = i;
break;
}
}
}
else
if (!draw_type_oox_index_)
{
int count = sizeof(_OO_OOX_custom_shapes) / sizeof(_shape_converter);
int pos = odf_type.find(L"ooxml-");
......@@ -546,7 +545,7 @@ void draw_enhanced_geometry::find_draw_type_oox()
catch(...)
{
}
if (min <0 ) min=0;
if (min < 0 ) min=0;
try
{
......
......@@ -65,6 +65,8 @@ public:
static const ElementType type = typeDrawShape;
static const xml::NodeType xml_type = xml::typeElement;
draw_shape() : bad_shape_(false), word_art_(false) {}
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void add_child_element( xml::sax * Reader, const std::wstring & Ns, const std::wstring & Name);
......@@ -87,6 +89,7 @@ public:
CPDOCCORE_DEFINE_VISITABLE();
friend class odf_document;
//----------------------------------------------------------------------------------------------
bool bad_shape_;
bool word_art_;
int sub_type_;
std::vector<odf_reader::_property> additional_;
......
......@@ -60,8 +60,6 @@ namespace cpdoccore {
namespace odf_reader {
void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
{
Context.get_drawing_context().start_shape(this);
......@@ -115,7 +113,6 @@ void draw_shape::common_docx_convert(oox::docx_conversion_context & Context)
}
void draw_rect::docx_convert(oox::docx_conversion_context & Context)
{
//if (Context.get_drawing_context().get_current_level() >0 )return;
if (Context.get_drawing_context().get_current_level() > 0 && !Context.get_drawing_context().in_group() )
{
if(Context.delayed_converting_ == false)
......@@ -245,17 +242,21 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
shape->word_art_ = word_art_;
bool set_shape = false;
if (draw_type_oox_index_)
{
shape->additional_.push_back(_property(L"odf-custom-draw-index", draw_type_oox_index_.get()));
if (shape->word_art_ == true)
shape->additional_.push_back(_property(L"wordArt", true));
shape->additional_.push_back(_property(L"wordArt", true));
set_shape = true;
}
if (sub_type_)
{
shape->sub_type_ = sub_type_.get();
set_shape = true;
}
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
......@@ -279,6 +280,8 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
std::wstringstream output_;
svg_path::oox_serialize(output_, o_Polyline);
shape->additional_.push_back(odf_reader::_property(L"custom_path", output_.str()));
set_shape = true;
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)
{
......@@ -303,12 +306,9 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
}
}
}
else if (!draw_type_oox_index_)
{
draw_type_oox_index_ = 0;
}
}
else if (draw_enhanced_geometry_attlist_.draw_modifiers_)
if (draw_enhanced_geometry_attlist_.draw_modifiers_)
{
shape->additional_.push_back(_property(L"draw-modifiers",draw_enhanced_geometry_attlist_.draw_modifiers_.get()));
if (draw_handle_geometry_.size()>0)
......@@ -320,6 +320,12 @@ void draw_enhanced_geometry::docx_convert(oox::docx_conversion_context & Context
}
}
}
if (!set_shape)
{
shape->bad_shape_ = true;
}
}
}
}
\ No newline at end of file
......@@ -747,11 +747,11 @@ const wchar_t * style_column::name = L"column";
void style_column::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
CP_APPLY_ATTR(L"fo:start-indent", fo_start_indent_, length(0.0, length::cm));
CP_APPLY_ATTR(L"fo:end-indent", fo_end_indent_, length(0.0, length::cm));
CP_APPLY_ATTR(L"fo:space-before", fo_space_before_, length(0.0, length::cm));
CP_APPLY_ATTR(L"fo:space-after", fo_space_after_, length(0.0, length::cm));
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
CP_APPLY_ATTR(L"fo:start-indent", fo_start_indent_, length(0.0, length::cm));
CP_APPLY_ATTR(L"fo:end-indent", fo_end_indent_, length(0.0, length::cm));
CP_APPLY_ATTR(L"fo:space-before", fo_space_before_, length(0.0, length::cm));
CP_APPLY_ATTR(L"fo:space-after", fo_space_after_, length(0.0, length::cm));
}
......@@ -1219,13 +1219,13 @@ void style_page_layout_properties_attlist::pptx_convert(oox::pptx_conversion_con
// style-footnote-sep-attlist
void style_footnote_sep_attlist::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"style:width", style_width_);
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
CP_APPLY_ATTR(L"style:color", style_color_);
CP_APPLY_ATTR(L"style:line-style", style_line_style_);
CP_APPLY_ATTR(L"style:type", style_adjustment_, style_type(style_type::Left)); // default Left
CP_APPLY_ATTR(L"style:distance-before-sep", style_distance_before_sep_);
CP_APPLY_ATTR(L"style:distance-after-sep", style_distance_after_sep_);
CP_APPLY_ATTR(L"style:width", style_width_);
CP_APPLY_ATTR(L"style:rel-width", style_rel_width_);
CP_APPLY_ATTR(L"style:color", style_color_);
CP_APPLY_ATTR(L"style:line-style", style_line_style_);
CP_APPLY_ATTR(L"style:type", style_adjustment_, style_type(style_type::Left)); // default Left
CP_APPLY_ATTR(L"style:distance-before-sep", style_distance_before_sep_);
CP_APPLY_ATTR(L"style:distance-after-sep", style_distance_after_sep_);
}
/// style:footnote-sep
......
......@@ -754,7 +754,7 @@ namespace svg_path
}
}
if ((aCurrPoly.points.size() > 0 || !bIsClosed) && !aCurrPoly.command.empty())
if ((aCurrPoly.points.size() > 0 || !bIsClosed) && !aCurrPoly.command.empty() && aCurrPoly.command != L"a:cubicBezTo")
{
// end-process last poly
......
......@@ -188,21 +188,26 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
const std::wstring id = Context.styles_map_.get( styleInst->name(), styleInst->type() );
Context.output_stream() << L"<w:pPr>";
//todooo причесать
if (Context.is_paragraph_header() && !Context.get_section_context().dump_.empty())
if (!Context.get_section_context().dump_.empty() &&
!Context.get_table_context().in_table() &&
(Context.get_process_note() == oox::docx_conversion_context::noNote))
{
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
if (Context.is_paragraph_header() )
{
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
Context.output_stream() << L"</w:pPr>";
Context.finish_paragraph();
Context.start_paragraph();
Context.output_stream() << L"<w:pPr>";
Context.output_stream() << L"</w:pPr>";
Context.finish_paragraph();
Context.start_paragraph();
Context.output_stream() << L"<w:pPr>";
}
else
{
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
}
}
else if ( !Context.get_table_context().in_table())
{
Context.output_stream() << Context.get_section_context().dump_;
Context.get_section_context().dump_.clear();
}
Context.output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
......@@ -231,7 +236,9 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
}
}
}
if (!Context.get_section_context().dump_.empty() && !Context.get_table_context().in_table())
if (!Context.get_section_context().dump_.empty() &&
!Context.get_table_context().in_table() &&
(Context.get_process_note() == oox::docx_conversion_context::noNote))
{
Context.output_stream() << L"<w:pPr>";
Context.output_stream() << Context.get_section_context().dump_;
......@@ -352,6 +359,8 @@ void paragraph::drop_cap_docx_convert(oox::docx_conversion_context & Context)
}
void paragraph::docx_convert(oox::docx_conversion_context & Context)
{
const std::wstring & styleName = attrs_.text_style_name_.style_name();
bool drawing = false;
if (Context.get_drawing_context().get_current_shape() || Context.get_drawing_context().get_current_frame())
......@@ -361,31 +370,22 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
bool bIsNewParagraph = true;
if (Context.get_paragraph_state() && (Context.get_process_note() == oox::docx_conversion_context::noNote) && !drawing && !Context.get_delete_text_state())
{//вложеннные элементы
if (content_.empty())//??
{
Context.output_stream() << L"<w:p>";
Context.output_stream() << emptyParagraphContent;
Context.output_stream() << L"</w:p>";
bool is_empty = content_.empty();
return;
}
else
if (Context.get_paragraph_state() && (Context.get_process_note() == oox::docx_conversion_context::noNote) && !drawing)
{//вложеннные элементы ... или после графики embedded_linux_kernel_and_drivers_labs_zh_TW.odt
bIsNewParagraph = false;
if (!Context.get_paragraph_keep())// например Appendix I_IPP.odt - tracked elements
{
bIsNewParagraph = false;
if (!Context.get_paragraph_keep())
for (int i = 0; i < content_.size(); i++)
{
for (int i = 0; i < content_.size(); i++)
{
content_[i]->docx_convert(Context);
}
return;
content_[i]->docx_convert(Context);
}
Context.set_paragraph_state(false);
return;
}
}
bool is_empty = content_.empty();
if (bIsNewParagraph)
Context.start_paragraph(is_header_);
......@@ -413,7 +413,6 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
is_empty = false;
}
const std::wstring & styleName = attrs_.text_style_name_.style_name();
const _CP_OPT(std::wstring) masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(styleName);
if (masterPageName)
......@@ -1078,21 +1077,22 @@ void text_unknown_base_change::docx_convert(oox::docx_conversion_context & Conte
{
Context.get_text_tracked_context().start_changes_content();
{
h *h_ = dynamic_cast<h*>(content_[i].get());
p *p_ = dynamic_cast<p*>(content_[i].get());
paragraph *para = NULL;
if (h_) para = &h_->paragraph_;
if (p_) para = &p_->paragraph_;
if (para)
{
for (int j = 0; j < para->content_.size(); j++)
{
para->content_[j]->docx_convert(Context);
}
}
content_[i]->docx_convert(Context);
//h *h_ = dynamic_cast<h*>(content_[i].get());
//p *p_ = dynamic_cast<p*>(content_[i].get());
//paragraph *para = NULL;
//if (h_) para = &h_->paragraph_;
//if (p_) para = &p_->paragraph_;
//if (para)
//{
// for (int j = 0; j < para->content_.size(); j++)
// {
// para->content_[j]->docx_convert(Context);
// }
//}
}
Context.get_text_tracked_context().end_changes_content();
}
......
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