Commit 42d1b8df authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormat Reader/Writer - review

parent e71342c4
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "docx_conversion_context.h" #include "docx_conversion_context.h"
#include "../odf/odfcontext.h" #include "../odf/odfcontext.h"
#include "../odf/style_paragraph_properties.h"
#include "../odf/style_text_properties.h" #include "../odf/style_text_properties.h"
#include "../odf/style_graphic_properties.h" #include "../odf/style_graphic_properties.h"
#include "../odf/datatypes/style_ref.h" #include "../odf/datatypes/style_ref.h"
...@@ -108,6 +109,11 @@ void text_tracked_context::set_user_info (std::wstring &author, std::wstring &da ...@@ -108,6 +109,11 @@ void text_tracked_context::set_user_info (std::wstring &author, std::wstring &da
current_state_.author = author; current_state_.author = author;
current_state_.date = date; current_state_.date = date;
} }
void text_tracked_context::set_style_name (std::wstring style_name)
{
current_state_.style_name = style_name;
}
text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wstring id) text_tracked_context::_state & text_tracked_context::get_tracked_change(std::wstring id)
{ {
std::map<std::wstring, _state>::iterator it = mapChanges_.find(id); std::map<std::wstring, _state>::iterator it = mapChanges_.find(id);
...@@ -206,7 +212,7 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId) ...@@ -206,7 +212,7 @@ void docx_conversion_context::add_element_to_run(std::wstring parenStyleId)
textProp->content().docx_convert(*this); textProp->content().docx_convert(*this);
} }
get_styles_context().docx_serialize_text_style( output_stream(), parenStyleId); get_styles_context().docx_serialize_text_style( output_stream(), parenStyleId, text_tracked_context_.dumpRPr_);
} }
} }
...@@ -818,7 +824,7 @@ void docx_conversion_context::end_process_style_content(bool in_styles) ...@@ -818,7 +824,7 @@ void docx_conversion_context::end_process_style_content(bool in_styles)
docx_serialize_paragraph_style(output_stream(), automatic_parent_style_, in_styles); docx_serialize_paragraph_style(output_stream(), automatic_parent_style_, in_styles);
if (automatic_parent_style_.empty()) if (automatic_parent_style_.empty())
styles_context_.docx_serialize_text_style( output_stream(), _T("")); styles_context_.docx_serialize_text_style( output_stream(), L"", text_tracked_context_.dumpRPr_);
} }
void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & strm, const std::wstring & ParentId, bool in_styles) void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & strm, const std::wstring & ParentId, bool in_styles)
...@@ -860,7 +866,12 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str ...@@ -860,7 +866,12 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
} }
CP_XML_STREAM() << paragraph_style.str(); CP_XML_STREAM() << paragraph_style.str();
docx_serialize_list_properties(CP_XML_STREAM()); docx_serialize_list_properties(CP_XML_STREAM());
if (!get_text_tracked_context().dumpPPr_.empty())
{
CP_XML_STREAM() << get_text_tracked_context().dumpPPr_;
get_text_tracked_context().dumpPPr_.clear();
}
if (run_style.tellp() > 0 && in_styles == false) if (run_style.tellp() > 0 && in_styles == false)
{ {
CP_XML_NODE(L"w:rPr") CP_XML_NODE(L"w:rPr")
...@@ -1286,18 +1297,70 @@ void docx_conversion_context::start_changes() ...@@ -1286,18 +1297,70 @@ void docx_conversion_context::start_changes()
{ {
text_tracked_context::_state &state = it->second; text_tracked_context::_state &state = it->second;
if (state.type == 3) continue; //format change ... todooo
if (state.type == 0) continue; //unknown change ... todooo if (state.type == 0) continue; //unknown change ... todooo
if (state.type == 1) output_stream() << L"<w:ins"; std::wstring change_attr;
if (state.type == 2) output_stream() << L"<w:del"; change_attr += L" w:date=\"" + state.date + L"\"";
change_attr += L" w:author=\"" + state.author + L"\"";
change_attr += L" w:id=\"" + std::to_wstring(current_id_changes++) + L"\"";
output_stream() << L" w:date=\"" << state.date << "\""; if (state.type == 1)
output_stream() << L" w:author=\"" << state.author << "\""; {
output_stream() << L" w:id=\"" << std::to_wstring(current_id_changes++) << "\""; output_stream() << L"<w:ins" << change_attr << L">";
output_stream() << L">"; }
if (state.type == 2) output_stream() << state.content; if (state.type == 2)
{
output_stream() << L"<w:del" << change_attr << L">";
output_stream() << state.content;
}
if (state.type == 3)
{
odf_reader::style_instance * styleInst = root()->odf_context().styleContainer().style_by_name(state.style_name, odf_types::style_family::Paragraph, false);
if (styleInst)
{
odf_reader::style_paragraph_properties * props = NULL;
props = styleInst->content()->get_style_paragraph_properties();
if (props)
{
props->docx_convert(*this);
odf_reader::style_text_properties * t_props = NULL;
t_props = styleInst->content()->get_style_text_properties();
if (t_props)
props->docx_convert(*this);
std::wstring attr = get_styles_context().paragraph_attr().str();
text_tracked_context_.dumpPPr_ = L"<w:pPrChange" + change_attr + (attr.empty() ? L">" : (L" " + attr + L">"));
text_tracked_context_.dumpPPr_ += get_styles_context().paragraph_nodes().str();
if (t_props)
{
text_tracked_context_.dumpPPr_ += L"<w:rPr>";
text_tracked_context_.dumpPPr_ += get_styles_context().text_style().str();
text_tracked_context_.dumpPPr_ += L"</w:rPr>";
}
text_tracked_context_.dumpPPr_ += L"</w:pPrChange>";
}
else
text_tracked_context_.dumpPPr_ = L"<w:pPrChange/>";
}
else if (styleInst = root()->odf_context().styleContainer().style_by_name(state.style_name, odf_types::style_family::Text, false))
{
odf_reader::style_text_properties * props = NULL;
props = styleInst->content()->get_style_text_properties();
if (props)
{
props->docx_convert(*this);
text_tracked_context_.dumpRPr_ = L"<w:rPrChange" + change_attr + L">";
text_tracked_context_.dumpRPr_ += get_styles_context().text_style().str();
text_tracked_context_.dumpRPr_ += L"</w:rPrChange>";
}else
text_tracked_context_.dumpRPr_ = L"<w:rPrChange/>";
}
else
{
}
}
} }
} }
...@@ -1307,12 +1370,15 @@ void docx_conversion_context::end_changes() ...@@ -1307,12 +1370,15 @@ void docx_conversion_context::end_changes()
{ {
text_tracked_context::_state &state = it->second; text_tracked_context::_state &state = it->second;
if (state.type == 3) continue; //format change ... todooo if (state.type == 0) continue; //unknown change ... libra format change skip
if (state.type == 0) continue; //unknown change ... todooo if (state.type == 3) continue;
if (state.type == 1) output_stream() << L"</w:ins>"; if (state.type == 1) output_stream() << L"</w:ins>";
if (state.type == 2) output_stream() << L"</w:del>"; if (state.type == 2) output_stream() << L"</w:del>";
} }
text_tracked_context_.dumpPPr_.clear();
text_tracked_context_.dumpRPr_.clear();
} }
void docx_conversion_context::end_text_changes (std::wstring id) void docx_conversion_context::end_text_changes (std::wstring id)
{ {
......
...@@ -494,7 +494,8 @@ public: ...@@ -494,7 +494,8 @@ public:
std::wstring author; std::wstring author;
std::wstring date; std::wstring date;
int type; int type;
std::wstring content; //delete elements std::wstring content; //delete elements
std::wstring style_name;
void clear() void clear()
{ {
...@@ -505,6 +506,8 @@ public: ...@@ -505,6 +506,8 @@ public:
content.clear(); content.clear();
} }
}; };
std::wstring dumpPPr_;
std::wstring dumpRPr_;
text_tracked_context(docx_conversion_context & context); text_tracked_context(docx_conversion_context & context);
...@@ -516,6 +519,7 @@ public: ...@@ -516,6 +519,7 @@ public:
void set_user_info (std::wstring &author, std::wstring &date); void set_user_info (std::wstring &author, std::wstring &date);
void set_type (int type); void set_type (int type);
void set_style_name (std::wstring style_name);
_state & get_tracked_change (std::wstring id); _state & get_tracked_change (std::wstring id);
......
...@@ -99,7 +99,7 @@ std::wstringstream & styles_context::list_style() ...@@ -99,7 +99,7 @@ std::wstringstream & styles_context::list_style()
return list_style_; return list_style_;
} }
void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstring parenStyleId) void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstring parenStyleId, std::wstring & strChange)
{ {
if (!text_style_.str().empty()) if (!text_style_.str().empty())
{ {
...@@ -107,12 +107,18 @@ void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstrin ...@@ -107,12 +107,18 @@ void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstrin
{ {
CP_XML_NODE(L"w:rPr") CP_XML_NODE(L"w:rPr")
{ {
if (parenStyleId.length() > 0) if (!parenStyleId.empty())
{ {
CP_XML_STREAM() << L"<w:rStyle w:val=\"" << parenStyleId << L"\" />"; CP_XML_STREAM() << L"<w:rStyle w:val=\"" << parenStyleId << L"\" />";
} }
const std::wstring & test_str = text_style_.str(); const std::wstring & test_str = text_style_.str();
CP_XML_STREAM() << test_str; CP_XML_STREAM() << test_str;
if (!strChange.empty())//rPrChange
{
CP_XML_STREAM() << strChange;
strChange.clear();
}
} }
} }
} }
......
...@@ -58,7 +58,7 @@ public: ...@@ -58,7 +58,7 @@ public:
std::wstringstream & table_style(); std::wstringstream & table_style();
std::wstringstream & list_style(); std::wstringstream & list_style();
void docx_serialize_text_style(std::wostream & strm, std::wstring parenStyleId); void docx_serialize_text_style(std::wostream & strm, std::wstring parenStyleId, std::wstring & strChange);
void docx_serialize_table_style(std::wostream & strm); void docx_serialize_table_style(std::wostream & strm);
void pptx_serialize_table_style(std::wostream & strm); void pptx_serialize_table_style(std::wostream & strm);
......
...@@ -325,12 +325,11 @@ xlsx_font::xlsx_font ( const odf_reader::text_format_properties_content * textP ...@@ -325,12 +325,11 @@ xlsx_font::xlsx_font ( const odf_reader::text_format_properties_content * textP
// sz = 10.;//kDefaultFontSize; //todooo ... вытащить как в math // sz = 10.;//kDefaultFontSize; //todooo ... вытащить как в math
//} //}
if (textProp->style_text_underline_type_ && if ((textProp->style_text_underline_type_ &&
textProp->style_text_underline_type_->get_type() != odf_types::line_type::Non || textProp->style_text_underline_type_->get_type() != odf_types::line_type::None) ||
textProp->style_text_underline_style_ && (textProp->style_text_underline_style_ &&
textProp->style_text_underline_style_->get_type() != odf_types::line_style::None textProp->style_text_underline_style_->get_type() != odf_types::line_style::None))
)
{ {
if (textProp->style_text_underline_type_ && if (textProp->style_text_underline_type_ &&
textProp->style_text_underline_type_->get_type() == odf_types::line_type::Double) textProp->style_text_underline_type_->get_type() == odf_types::line_type::Double)
...@@ -338,12 +337,12 @@ xlsx_font::xlsx_font ( const odf_reader::text_format_properties_content * textP ...@@ -338,12 +337,12 @@ xlsx_font::xlsx_font ( const odf_reader::text_format_properties_content * textP
else else
u = XUNDERLINE_SINGLE; u = XUNDERLINE_SINGLE;
} }
if ((textProp->style_text_line_through_type_ &&
textProp->style_text_line_through_type_->get_type() != odf_types::line_type::None) ||
if (textProp->style_text_line_through_type_ && (textProp->style_text_line_through_style_ &&
textProp->style_text_line_through_type_->get_type() != odf_types::line_type::Non || textProp->style_text_line_through_style_->get_type() != odf_types::line_style::None))
textProp->style_text_line_through_style_ &&
textProp->style_text_line_through_style_->get_type() != odf_types::line_style::None)
{ {
strike = true; strike = true;
} }
......
...@@ -40,7 +40,7 @@ std::wostream & operator << (std::wostream & _Wostream, const line_type & _Val) ...@@ -40,7 +40,7 @@ std::wostream & operator << (std::wostream & _Wostream, const line_type & _Val)
{ {
switch(_Val.get_type()) switch(_Val.get_type())
{ {
case line_type::Non: case line_type::None:
_Wostream << "none"; _Wostream << "none";
break; break;
case line_type::Single: case line_type::Single:
...@@ -61,15 +61,14 @@ line_type line_type::parse(const std::wstring & Str) ...@@ -61,15 +61,14 @@ line_type line_type::parse(const std::wstring & Str)
boost::algorithm::to_lower(tmp); boost::algorithm::to_lower(tmp);
if (tmp == L"none") if (tmp == L"none")
return line_type( Non ); return line_type( None );
else if (tmp == L"single") else if (tmp == L"single")
return line_type( Single ); return line_type( Single );
else if (tmp == L"double") else if (tmp == L"double")
return line_type( Double ); return line_type( Double );
else else
{ {
BOOST_THROW_EXCEPTION( errors::invalid_attribute() ); return None;
return Non;
} }
} }
......
...@@ -29,12 +29,7 @@ ...@@ -29,12 +29,7 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode * terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
* *
*/ */
#ifndef _CPDOCCORE_ODF_LINETYPE_H_
#define _CPDOCCORE_ODF_LINETYPE_H_
#ifdef _MSC_VER
#pragma once #pragma once
#endif
#include <string> #include <string>
#include <iosfwd> #include <iosfwd>
...@@ -48,7 +43,7 @@ class line_type ...@@ -48,7 +43,7 @@ class line_type
public: public:
enum type enum type
{ {
Non, None,
Single, Single,
Double Double
}; };
...@@ -78,5 +73,3 @@ std::wostream & operator << (std::wostream & _Wostream, const line_type & _Val); ...@@ -78,5 +73,3 @@ std::wostream & operator << (std::wostream & _Wostream, const line_type & _Val);
APPLY_PARSE_XML_ATTRIBUTES(odf_types::line_type); APPLY_PARSE_XML_ATTRIBUTES(odf_types::line_type);
} }
#endif
...@@ -184,7 +184,7 @@ const std::wstring & style_instance::data_style_name() const ...@@ -184,7 +184,7 @@ const std::wstring & style_instance::data_style_name() const
return data_style_name_; return data_style_name_;
} }
style_instance * styles_container::style_by_name(const std::wstring & Name, style_family::type Type,bool object_in_styles) const style_instance * styles_container::style_by_name(const std::wstring & Name, style_family::type Type, bool object_in_styles) const
{ {
std::wstring n = L""; std::wstring n = L"";
if (object_in_styles) n = L"common:"; if (object_in_styles) n = L"common:";
...@@ -200,7 +200,7 @@ style_instance * styles_container::style_by_name(const std::wstring & Name, styl ...@@ -200,7 +200,7 @@ style_instance * styles_container::style_by_name(const std::wstring & Name, styl
else else
return NULL; return NULL;
} }
style_instance * styles_container::style_by_display_name(const std::wstring & Name, style_family::type Type,bool object_in_styles) const style_instance * styles_container::style_by_display_name(const std::wstring & Name, style_family::type Type, bool object_in_styles) const
{ {
std::wstring n = L""; std::wstring n = L"";
if (object_in_styles) n = L"common:"; if (object_in_styles) n = L"common:";
......
...@@ -88,17 +88,18 @@ void text::add_text(const std::wstring & Text) ...@@ -88,17 +88,18 @@ 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)
{ {
Context.add_element_to_run(); Context.add_element_to_run();
std::wostream & _Wostream = 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";
_Wostream << L"<" << textNode; strm << L"<" << textNode;
if (preserve_ && !Context.get_delete_text_state()) _Wostream << L" xml:space=\"preserve\">"; if (preserve_ && !Context.get_delete_text_state())
_Wostream << L">"; strm << L" xml:space=\"preserve\"";
strm << L">";
_Wostream << xml::utils::replace_text_to_xml( text_ ); strm << xml::utils::replace_text_to_xml( text_ );
_Wostream << L"</" << textNode << L">"; strm << L"</" << textNode << L">";
} }
void text::xlsx_convert(oox::xlsx_conversion_context & Context) void text::xlsx_convert(oox::xlsx_conversion_context & Context)
...@@ -150,8 +151,8 @@ void s::docx_convert(oox::docx_conversion_context & Context) ...@@ -150,8 +151,8 @@ void s::docx_convert(oox::docx_conversion_context & Context)
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;
if (!Context.get_delete_text_state()) if (!Context.get_delete_text_state())
L" xml:space=\"preserve\""; strm << L" xml:space=\"preserve\"";
strm << L">"; strm << L">";
text_to_stream(strm); text_to_stream(strm);
strm << L"</" << textNode << L">"; strm << L"</" << textNode << L">";
...@@ -739,7 +740,7 @@ void title::docx_convert(oox::docx_conversion_context & Context) ...@@ -739,7 +740,7 @@ void title::docx_convert(oox::docx_conversion_context & Context)
strm << L"<" << textNode; strm << L"<" << textNode;
if (!Context.get_delete_text_state()) if (!Context.get_delete_text_state())
L" xml:space=\"preserve\""; strm << L" xml:space=\"preserve\"";
strm << L">"; strm << L">";
text_to_stream(strm); text_to_stream(strm);
strm << L"</" << textNode << L">"; strm << L"</" << textNode << L">";
...@@ -803,7 +804,7 @@ void subject::docx_convert(oox::docx_conversion_context & Context) ...@@ -803,7 +804,7 @@ void subject::docx_convert(oox::docx_conversion_context & Context)
strm << L"<" << textNode; strm << L"<" << textNode;
if (!Context.get_delete_text_state()) if (!Context.get_delete_text_state())
L" xml:space=\"preserve\""; strm << L" xml:space=\"preserve\"";
strm << L">"; strm << L">";
text_to_stream(strm); text_to_stream(strm);
strm << L"</" << textNode << L">"; strm << L"</" << textNode << L">";
...@@ -866,7 +867,7 @@ void chapter::docx_convert(oox::docx_conversion_context & Context) ...@@ -866,7 +867,7 @@ void chapter::docx_convert(oox::docx_conversion_context & Context)
strm << L"<" << textNode; strm << L"<" << textNode;
if (!Context.get_delete_text_state()) if (!Context.get_delete_text_state())
L" xml:space=\"preserve\""; strm << L" xml:space=\"preserve\"";
strm << L">"; strm << L">";
text_to_stream(strm); text_to_stream(strm);
strm << L"</" << textNode << L">"; strm << L"</" << textNode << L">";
...@@ -1098,7 +1099,7 @@ void text_date::docx_convert(oox::docx_conversion_context & Context) ...@@ -1098,7 +1099,7 @@ void text_date::docx_convert(oox::docx_conversion_context & Context)
strm << L"<" << textNode; strm << L"<" << textNode;
if (!Context.get_delete_text_state()) if (!Context.get_delete_text_state())
L" xml:space=\"preserve\""; strm << L" xml:space=\"preserve\"";
strm << L">"; strm << L">";
text_to_stream(strm); text_to_stream(strm);
strm << L"</" << textNode << L">"; strm << L"</" << textNode << L">";
...@@ -1210,7 +1211,7 @@ void text_time::docx_convert(oox::docx_conversion_context & Context) ...@@ -1210,7 +1211,7 @@ void text_time::docx_convert(oox::docx_conversion_context & Context)
strm << L"<" << textNode; strm << L"<" << textNode;
if (!Context.get_delete_text_state()) if (!Context.get_delete_text_state())
L" xml:space=\"preserve\""; strm << L" xml:space=\"preserve\"";
strm << L">"; strm << L">";
text_to_stream(strm); text_to_stream(strm);
strm << L"</" << textNode << L">"; strm << L"</" << textNode << L">";
......
...@@ -473,15 +473,12 @@ void style_tab_stop::docx_convert(oox::docx_conversion_context & Context) ...@@ -473,15 +473,12 @@ void style_tab_stop::docx_convert(oox::docx_conversion_context & Context)
{ {
std::wstring leader; std::wstring leader;
if (style_leader_type_ && style_leader_type_->get_type() == line_type::Non || if ((style_leader_type_ && style_leader_type_->get_type() == line_type::None) ||
style_leader_style_ && style_leader_style_->get_type() == line_style::None) (style_leader_style_ && style_leader_style_->get_type() == line_style::None))
{ {
leader = L"none"; leader = L"none";
} }
else if ( else if (!style_leader_type_ || style_leader_type_ && style_leader_type_->get_type() != line_type::None)
!style_leader_type_ ||
style_leader_type_ && style_leader_type_->get_type() != line_type::Non
)
{ {
if (style_leader_style_) if (style_leader_style_)
{ {
......
...@@ -344,28 +344,26 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context & ...@@ -344,28 +344,26 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
} }
} }
// underline // underline
line_width under = style_text_underline_width_.get_value_or(line_width::Auto); line_width under = style_text_underline_width_.get_value_or(line_width::Auto);
bool underlineBold = under.get_type() == line_width::Bold || bool underlineBold = under.get_type() == line_width::Bold ||
under.get_type() == line_width::Thick; under.get_type() == line_width::Thick;
std::wstring underline = L""; std::wstring underline = L"";
if ( style_text_underline_type_ && style_text_underline_type_->get_type() == line_type::Non || if ((style_text_underline_type_ && style_text_underline_type_->get_type() == line_type::None) ||
style_text_underline_style_ && style_text_underline_style_->get_type() == line_style::None (style_text_underline_style_ && style_text_underline_style_->get_type() == line_style::None))
)
{ {
underline = L"none"; underline = L"none";
} }
else if (style_text_underline_type_ && else if (style_text_underline_type_ &&
(!style_text_underline_style_ || style_text_underline_style_ && style_text_underline_style_->get_type() == line_style::Solid) ) (!style_text_underline_style_ || style_text_underline_style_ && style_text_underline_style_->get_type() == line_style::Solid) )
{ {
if (underlineBold) underline = L"thick"; if (underlineBold) underline = L"thick";
switch (style_text_underline_type_->get_type()) switch (style_text_underline_type_->get_type())
{ {
case line_type::Single: underline = L"sng"; case line_type::Single: underline = L"sng"; break;
break; case line_type::Double: underline = L"double"; break;
case line_type::Double: underline = L"double";
break;
} }
} }
else if (style_text_underline_style_) else if (style_text_underline_style_)
...@@ -520,8 +518,6 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context & ...@@ -520,8 +518,6 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
{ {
_rPr << L"<w:rStyle w:val=\"" << *r_style_ << L"\" />"; _rPr << L"<w:rStyle w:val=\"" << *r_style_ << L"\" />";
} }
// 17.3.2.1
{ {
const int W = process_font_weight(fo_font_weight_); const int W = process_font_weight(fo_font_weight_);
if (W) if (W)
...@@ -543,14 +539,10 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context & ...@@ -543,14 +539,10 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
_rPr << L"<w:bCs w:val=\"false\" />"; _rPr << L"<w:bCs w:val=\"false\" />";
} }
} }
// 17.3.2.5
if (fo_text_transform_) if (fo_text_transform_)
{ {
_rPr << (fo_text_transform_->get_type() == text_transform::Uppercase ? L"<w:caps w:val=\"true\" />" : L"<w:caps w:val=\"false\" />"); _rPr << (fo_text_transform_->get_type() == text_transform::Uppercase ? L"<w:caps w:val=\"true\" />" : L"<w:caps w:val=\"false\" />");
} }
// 17.3.2.16
{ {
const int fontStyle = process_font_style(fo_font_style_); const int fontStyle = process_font_style(fo_font_style_);
if (fontStyle) if (fontStyle)
...@@ -572,15 +564,10 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context & ...@@ -572,15 +564,10 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
_rPr << L"<w:iCs w:val=\"false\" />"; _rPr << L"<w:iCs w:val=\"false\" />";
} }
} }
// 17.3.2.33
if (fo_font_variant_) if (fo_font_variant_)
{ {
_rPr << (fo_font_variant_->get_type() == font_variant::SmallCaps ? L"<w:smallCaps w:val=\"true\" />" : L"<w:smallCaps w:val=\"true\" />" ); _rPr << (fo_font_variant_->get_type() == font_variant::SmallCaps ? L"<w:smallCaps w:val=\"true\" />" : L"<w:smallCaps w:val=\"true\" />" );
} }
// 17.3.2.13
// 17.3.2.18
if (style_font_relief_) if (style_font_relief_)
{ {
if (style_font_relief_->get_type() == font_relief::Embossed) if (style_font_relief_->get_type() == font_relief::Embossed)
...@@ -593,27 +580,20 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context & ...@@ -593,27 +580,20 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
_rPr << L"<w:imprint w:val=\"false\" />"; _rPr << L"<w:imprint w:val=\"false\" />";
} }
} }
// 17.3.2.23
if (style_text_outline_) if (style_text_outline_)
{ {
_rPr << ((*style_text_outline_ == true) ? L"<w:outline w:val=\"true\" />" : L"<w:outline w:val=\"false\" />" ); _rPr << ((*style_text_outline_ == true) ? L"<w:outline w:val=\"true\" />" : L"<w:outline w:val=\"false\" />" );
} }
// 17.3.2.31
if (fo_text_shadow_) if (fo_text_shadow_)
{ {
_rPr << ((fo_text_shadow_->get_type() == shadow_type::Enable) ? L"<w:shadow w:val=\"true\" />" : L"<w:shadow w:val=\"false\" />" ); _rPr << ((fo_text_shadow_->get_type() == shadow_type::Enable) ? L"<w:shadow w:val=\"true\" />" : L"<w:shadow w:val=\"false\" />" );
} }
// 17.3.2.41
if (text_display_) if (text_display_)
{ {
if (text_display_->get_type() == text_display::None) if (text_display_->get_type() == text_display::None)
_rPr << L"<w:vanish />"; _rPr << L"<w:vanish />";
} }
// 17.3.2.40
// underline // underline
{ {
line_width under = style_text_underline_width_.get_value_or(line_width::Auto); line_width under = style_text_underline_width_.get_value_or(line_width::Auto);
...@@ -621,9 +601,8 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context & ...@@ -621,9 +601,8 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
under.get_type() == line_width::Thick; under.get_type() == line_width::Thick;
std::wstring underline = L""; std::wstring underline = L"";
if ( style_text_underline_type_ && style_text_underline_type_->get_type() == line_type::Non || if (( style_text_underline_type_ && style_text_underline_type_->get_type() == line_type::None) ||
style_text_underline_style_ && style_text_underline_style_->get_type() == line_style::None (style_text_underline_style_ && style_text_underline_style_->get_type() == line_style::None))
)
{ {
// подчеркивание выключено // подчеркивание выключено
underline = L"none"; underline = L"none";
...@@ -709,13 +688,9 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context & ...@@ -709,13 +688,9 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
_rPr << L"/>"; _rPr << L"/>";
} }
} }
// 17.3.2.9
// 17.3.2.37
{ {
if (style_text_line_through_type_ && style_text_line_through_type_->get_type() == line_type::Non || if ((style_text_line_through_type_ && style_text_line_through_type_->get_type() == line_type::None) ||
style_text_line_through_style_ && style_text_line_through_style_->get_type() == line_style::None (style_text_line_through_style_ && style_text_line_through_style_->get_type() == line_style::None))
)
{ {
_rPr << L"<w:dstrike w:val=\"false\" />"; _rPr << L"<w:dstrike w:val=\"false\" />";
_rPr << L"<w:strike w:val=\"false\" />"; _rPr << L"<w:strike w:val=\"false\" />";
...@@ -1116,9 +1091,8 @@ void text_format_properties_content::oox_convert (std::wostream & _rPr, bool gra ...@@ -1116,9 +1091,8 @@ void text_format_properties_content::oox_convert (std::wostream & _rPr, bool gra
under.get_type() == line_width::Thick; under.get_type() == line_width::Thick;
std::wstring underline = L""; std::wstring underline = L"";
if ( style_text_underline_type_ && style_text_underline_type_->get_type() == line_type::Non || if ((style_text_underline_type_ && style_text_underline_type_->get_type() == line_type::None) ||
style_text_underline_style_ && style_text_underline_style_->get_type() == line_style::None (style_text_underline_style_ && style_text_underline_style_->get_type() == line_style::None))
)
{ {
// подчеркивание выключено // подчеркивание выключено
underline = L"none"; underline = L"none";
...@@ -1204,9 +1178,8 @@ void text_format_properties_content::oox_convert (std::wostream & _rPr, bool gra ...@@ -1204,9 +1178,8 @@ void text_format_properties_content::oox_convert (std::wostream & _rPr, bool gra
_rPr << L"/>"; _rPr << L"/>";
} }
} }
if (style_text_line_through_type_ && style_text_line_through_type_->get_type() == line_type::Non || if ((style_text_line_through_type_ && style_text_line_through_type_->get_type() == line_type::None) ||
style_text_line_through_style_ && style_text_line_through_style_->get_type() == line_style::None (style_text_line_through_style_ && style_text_line_through_style_->get_type() == line_style::None))
)
{ {
_rPr << L"<w:dstrike w:val=\"false\" />"; _rPr << L"<w:dstrike w:val=\"false\" />";
_rPr << L"<w:strike w:val=\"false\" />"; _rPr << L"<w:strike w:val=\"false\" />";
......
...@@ -441,14 +441,16 @@ void text_list_level_style_number::docx_convert(oox::docx_conversion_context & C ...@@ -441,14 +441,16 @@ void text_list_level_style_number::docx_convert(oox::docx_conversion_context & C
CP_XML_ATTR(L"w:hanging",((int)( hanging + 0.5))); CP_XML_ATTR(L"w:hanging",((int)( hanging + 0.5)));
} }
} }
} }
} }
if (style_text_properties * textProperties = dynamic_cast<style_text_properties *>(style_text_properties_.get())) if (style_text_properties * textProperties = dynamic_cast<style_text_properties *>(style_text_properties_.get()))
{ {
Context.get_styles_context().start(); Context.get_styles_context().start();
textProperties->content().docx_convert(Context);//to style_context //to style_context
Context.get_styles_context().docx_serialize_text_style( CP_XML_STREAM(), _T(""));//serialize style_context textProperties->content().docx_convert(Context);
//serialize style_context
Context.get_styles_context().docx_serialize_text_style( CP_XML_STREAM(), L"", Context.get_text_tracked_context().dumpRPr_);
} }
} }
} }
...@@ -640,7 +642,7 @@ void text_list_level_style_bullet::docx_convert(oox::docx_conversion_context & C ...@@ -640,7 +642,7 @@ void text_list_level_style_bullet::docx_convert(oox::docx_conversion_context & C
{ {
Context.get_styles_context().start(); Context.get_styles_context().start();
textProperties->content().docx_convert(Context); textProperties->content().docx_convert(Context);
Context.get_styles_context().docx_serialize_text_style(CP_XML_STREAM(), _T("")); Context.get_styles_context().docx_serialize_text_style(CP_XML_STREAM(), L"", Context.get_text_tracked_context().dumpRPr_);
} }
} }
} }
...@@ -778,7 +780,7 @@ void text_list_level_style_image::docx_convert(oox::docx_conversion_context & Co ...@@ -778,7 +780,7 @@ void text_list_level_style_image::docx_convert(oox::docx_conversion_context & Co
{ {
Context.get_styles_context().start(); Context.get_styles_context().start();
textProperties->content().docx_convert(Context); textProperties->content().docx_convert(Context);
Context.get_styles_context().docx_serialize_text_style(CP_XML_STREAM(), _T("")); Context.get_styles_context().docx_serialize_text_style(CP_XML_STREAM(), L"", Context.get_text_tracked_context().dumpRPr_);
} }
} }
} }
......
...@@ -133,13 +133,14 @@ void process_paragraph_drop_cap_attr(const paragraph_attrs & Attr, oox::docx_con ...@@ -133,13 +133,14 @@ void process_paragraph_drop_cap_attr(const paragraph_attrs & Attr, oox::docx_con
} }
return; return;
} }
typedef std::map<std::wstring, oox::text_tracked_context::_state>::iterator map_changes_iterator;
int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_context & Context) int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_context & Context)
{ {
if (!Attr.text_style_name_.empty()) if (!Attr.text_style_name_.empty())
{ {
if (style_instance * styleInst = if (style_instance * styleInst =
Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_.style_name(), style_family::Paragraph,Context.process_headers_footers_) Context.root()->odf_context().styleContainer().style_by_name(Attr.text_style_name_.style_name(), style_family::Paragraph, Context.process_headers_footers_)
) )
{ {
process_page_break_after(styleInst, Context); process_page_break_after(styleInst, Context);
...@@ -186,7 +187,7 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co ...@@ -186,7 +187,7 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
{ {
const std::wstring id = Context.styles_map_.get( styleInst->name(), styleInst->type() ); const std::wstring id = Context.styles_map_.get( styleInst->name(), styleInst->type() );
Context.output_stream() << L"<w:pPr>"; Context.output_stream() << L"<w:pPr>";
//todooo причесать //todooo причесать
if (Context.is_paragraph_header() && !Context.get_section_context().dump_.empty()) if (Context.is_paragraph_header() && !Context.get_section_context().dump_.empty())
{ {
Context.output_stream() << Context.get_section_context().dump_; Context.output_stream() << Context.get_section_context().dump_;
...@@ -204,6 +205,13 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co ...@@ -204,6 +205,13 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
} }
Context.output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />"; Context.output_stream() << L"<w:pStyle w:val=\"" << id << L"\" />";
if (!Context.output_stream() << Context.get_text_tracked_context().dumpPPr_.empty())
{
Context.output_stream() << Context.get_text_tracked_context().dumpPPr_;
Context.get_text_tracked_context().dumpPPr_.clear();
}
Context.docx_serialize_list_properties(Context.output_stream()); Context.docx_serialize_list_properties(Context.output_stream());
if ((Attr.outline_level_) && (*Attr.outline_level_ > 0)) if ((Attr.outline_level_) && (*Attr.outline_level_ > 0))
...@@ -1082,10 +1090,18 @@ void text_deletion::docx_convert(oox::docx_conversion_context & Context) ...@@ -1082,10 +1090,18 @@ void text_deletion::docx_convert(oox::docx_conversion_context & Context)
const wchar_t * text_format_change::ns = L"text"; const wchar_t * text_format_change::ns = L"text";
const wchar_t * text_format_change::name = L"format-change"; const wchar_t * text_format_change::name = L"format-change";
void text_format_change::add_attributes( const xml::attributes_wc_ptr & Attributes )
{
CP_APPLY_ATTR(L"text:style-name", text_style_name_);
}
void text_format_change::docx_convert(oox::docx_conversion_context & Context) void text_format_change::docx_convert(oox::docx_conversion_context & Context)
{ {
Context.get_text_tracked_context().set_type(3); Context.get_text_tracked_context().set_type(3);
if (text_style_name_)
Context.get_text_tracked_context().set_style_name(*text_style_name_);
text_unknown_base_change::docx_convert(Context); text_unknown_base_change::docx_convert(Context);
} }
//---------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------
......
...@@ -501,7 +501,10 @@ public: ...@@ -501,7 +501,10 @@ public:
static const xml::NodeType xml_type = xml::typeElement; static const xml::NodeType xml_type = xml::typeElement;
static const ElementType type = typeTextFormatChange; static const ElementType type = typeTextFormatChange;
virtual void add_attributes( const xml::attributes_wc_ptr & Attributes );
virtual void docx_convert(oox::docx_conversion_context & Context); virtual void docx_convert(oox::docx_conversion_context & Context);
_CP_OPT(std::wstring) text_style_name_; //не по снецификации ... но КАК сохранить то что было изменено в формате?????
}; };
CP_REGISTER_OFFICE_ELEMENT2(text_format_change); CP_REGISTER_OFFICE_ELEMENT2(text_format_change);
......
...@@ -319,7 +319,7 @@ void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length, ...@@ -319,7 +319,7 @@ void odf_conversion_context::add_tab(_CP_OPT(int) type, _CP_OPT(length) _length,
case 3: tab->style_leader_type_ = line_type::Single ; case 3: tab->style_leader_type_ = line_type::Single ;
tab->style_leader_style_= line_style::LongDash; tab->style_leader_style_= line_style::LongDash;
break; // tabtlcMiddleDot = 3, break; // tabtlcMiddleDot = 3,
case 4: tab->style_leader_type_ = line_type::Non; case 4: tab->style_leader_type_ = line_type::None;
break; // tabtlcNone = 4, break; // tabtlcNone = 4,
case 5: tab->style_leader_type_ = line_type::Single; case 5: tab->style_leader_type_ = line_type::Single;
tab->style_leader_style_= line_style::Solid; tab->style_leader_style_= line_style::Solid;
......
...@@ -90,7 +90,6 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc ...@@ -90,7 +90,6 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc
is_paragraph_in_current_section_ = false; is_paragraph_in_current_section_ = false;
text_changes_state_.main_text_context = NULL; //header, footer, drawing, main, .. text_changes_state_.main_text_context = NULL; //header, footer, drawing, main, ..
text_changes_state_.level = 0;
drop_cap_state_.clear(); drop_cap_state_.clear();
} }
...@@ -288,9 +287,6 @@ void odt_conversion_context::start_paragraph(bool styled) ...@@ -288,9 +287,6 @@ void odt_conversion_context::start_paragraph(bool styled)
} }
void odt_conversion_context::add_paragraph_break(int type) void odt_conversion_context::add_paragraph_break(int type)
{ {
//office_element_ptr elm;
//create_element(L"text", L"soft-page-break", elm, this);
if (current_root_elements_.size() > 0) if (current_root_elements_.size() > 0)
{ {
//text_p* para = NULL; //text_p* para = NULL;
...@@ -798,14 +794,16 @@ void odt_conversion_context::end_note() ...@@ -798,14 +794,16 @@ void odt_conversion_context::end_note()
text_context()->current_level_.pop_back(); text_context()->current_level_.pop_back();
} }
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
void odt_conversion_context::start_change (int id, int type, std::wstring &author, std::wstring &userId, std::wstring &date) void odt_conversion_context::start_change (int id, int type, std::wstring &author, std::wstring &userId, std::wstring &date, std::wstring style_name)
{ {
if (!text_changes_state_.main_text_context) if (id < 0) return;
{ //if (!text_changes_state_.main_text_context)
text_changes_state_.main_text_context = text_context(); //{
} // text_changes_state_.main_text_context = text_context();
text_changes_state_.level++; //}
if (!text_changes_state_.main_text_context) return; //if (!text_changes_state_.main_text_context) return;
text_changes_state_.current_types.push_back(type);
std::wstring strId = L"ct" + std::to_wstring(id); std::wstring strId = L"ct" + std::to_wstring(id);
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
...@@ -818,8 +816,12 @@ void odt_conversion_context::start_change (int id, int type, std::wstring &autho ...@@ -818,8 +816,12 @@ void odt_conversion_context::start_change (int id, int type, std::wstring &autho
text_add_change* change = dynamic_cast<text_add_change*>(start_elm.get()); text_add_change* change = dynamic_cast<text_add_change*>(start_elm.get());
if (change) change->text_change_id_ = strId; if (change) change->text_change_id_ = strId;
text_changes_state_.main_text_context->start_element(start_elm); text_context()->start_element(start_elm);
text_changes_state_.main_text_context->end_element(); add_to_root();//добавление/удаление параграфов и т д
text_context()->end_element();
//text_changes_state_.main_text_context->start_element(start_elm);
//text_changes_state_.main_text_context->end_element();
//--------------------------------------------------------------------------------- //---------------------------------------------------------------------------------
office_element_ptr region_elm; office_element_ptr region_elm;
create_element(L"text", L"changed-region", region_elm, this); create_element(L"text", L"changed-region", region_elm, this);
...@@ -843,18 +845,16 @@ void odt_conversion_context::start_change (int id, int type, std::wstring &autho ...@@ -843,18 +845,16 @@ void odt_conversion_context::start_change (int id, int type, std::wstring &autho
info_elm->add_child_element(creator_elm); info_elm->add_child_element(creator_elm);
dc_creator* creator = dynamic_cast<dc_creator*>(creator_elm.get()); dc_creator* creator = dynamic_cast<dc_creator*>(creator_elm.get());
if (!creator)return; if (creator)
creator->content_ = author;
creator->content_ = author;
office_element_ptr date_elm; office_element_ptr date_elm;
create_element(L"dc", L"date", date_elm, this); create_element(L"dc", L"date", date_elm, this);
info_elm->add_child_element(date_elm); info_elm->add_child_element(date_elm);
dc_date* date_ = dynamic_cast<dc_date*>(date_elm.get()); dc_date* date_ = dynamic_cast<dc_date*>(date_elm.get());
if (!date_) return; if (date_)
date_->content_ = date;
date_->content_ = date;
} }
if (is_header_ || is_footer_) page_layout_context()->root_header_footer_->add_child_element(region_elm); if (is_header_ || is_footer_) page_layout_context()->root_header_footer_->add_child_element(region_elm);
...@@ -862,20 +862,31 @@ void odt_conversion_context::start_change (int id, int type, std::wstring &autho ...@@ -862,20 +862,31 @@ void odt_conversion_context::start_change (int id, int type, std::wstring &autho
region_elm->add_child_element(child_elm); region_elm->add_child_element(child_elm);
if (type == 3 && !style_name.empty())
{
//не по спецификации !!!
text_format_change * format_change = dynamic_cast<text_format_change*> (child_elm.get());
if (format_change)
format_change->text_style_name_ = style_name;
}
if (type == 2)//delete if (type == 2)//delete
{ {
start_text_context(); start_text_context();
text_context()->start_element(child_elm); text_context()->start_element(child_elm);
text_context()->start_paragraph();//ваще то не по стандарту .. может мы уже в параграфе (ради Libra! ... гы)
} }
} }
void odt_conversion_context::end_change (int id, int type) void odt_conversion_context::end_change (int id, int type)
{ {
if (!text_changes_state_.main_text_context) return; //if (!text_changes_state_.main_text_context) return;
std::wstring strId = L"ct" + std::to_wstring(id); std::wstring strId = L"ct" + std::to_wstring(id);
if (type == 2)//delete if (type == 2)//delete
{ {
text_context()->end_paragraph();
text_context()->end_element(); text_context()->end_element();
end_text_context(); end_text_context();
} }
...@@ -887,13 +898,17 @@ void odt_conversion_context::end_change (int id, int type) ...@@ -887,13 +898,17 @@ void odt_conversion_context::end_change (int id, int type)
text_add_change* change = dynamic_cast<text_add_change*>(end_elm.get()); text_add_change* change = dynamic_cast<text_add_change*>(end_elm.get());
if (change) change->text_change_id_ = strId; if (change) change->text_change_id_ = strId;
text_changes_state_.main_text_context->start_element(end_elm); text_context()->start_element(end_elm);
text_changes_state_.main_text_context->end_element(); add_to_root();
text_context()->end_element();
} }
text_changes_state_.level--; text_changes_state_.current_types.pop_back();
}
bool odt_conversion_context::is_delete_changes()
{
if (text_changes_state_.current_types.empty()) return false;
if (text_changes_state_.level < 1) return (text_changes_state_.current_types.back() == 2);
text_changes_state_.main_text_context = NULL;
} }
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
void odt_conversion_context::start_image(const std::wstring & image_file_name) void odt_conversion_context::start_image(const std::wstring & image_file_name)
......
...@@ -123,8 +123,9 @@ public: ...@@ -123,8 +123,9 @@ public:
void end_note_content (); void end_note_content ();
void end_note (); void end_note ();
void start_change (int id, int type, std::wstring &author, std::wstring &userId, std::wstring &date); void start_change (int id, int type, std::wstring &author, std::wstring &userId, std::wstring &date, std::wstring style_name = L"");
void end_change (int id, int type); void end_change (int id, int type);
bool is_delete_changes ();
void start_table (bool styled = false); void start_table (bool styled = false);
void start_table_columns (); void start_table_columns ();
...@@ -191,7 +192,7 @@ private: ...@@ -191,7 +192,7 @@ private:
struct _text_changes_state struct _text_changes_state
{ {
odf_text_context *main_text_context; odf_text_context *main_text_context;
int level; std::vector<int> current_types;
}text_changes_state_; }text_changes_state_;
bool is_hyperlink_; bool is_hyperlink_;
......
...@@ -484,6 +484,8 @@ void text_format_change::serialize(std::wostream & _Wostream) ...@@ -484,6 +484,8 @@ void text_format_change::serialize(std::wostream & _Wostream)
{ {
CP_XML_NODE_SIMPLE() CP_XML_NODE_SIMPLE()
{ {
CP_XML_ATTR_OPT(L"text:style-name", text_style_name_);
if (office_change_info_) if (office_change_info_)
office_change_info_->serialize(CP_XML_STREAM()); office_change_info_->serialize(CP_XML_STREAM());
......
...@@ -380,6 +380,9 @@ public: ...@@ -380,6 +380,9 @@ public:
static const ElementType type = typeTextFormatChange; static const ElementType type = typeTextFormatChange;
virtual void serialize(std::wostream & _Wostream); virtual void serialize(std::wostream & _Wostream);
_CP_OPT(std::wstring) text_style_name_; //не по снецификации ... но КАК сохранить то что было изменено в формате?????
}; };
CP_REGISTER_OFFICE_ELEMENT2(text_format_change); CP_REGISTER_OFFICE_ELEMENT2(text_format_change);
......
...@@ -1270,7 +1270,7 @@ void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf_writer:: ...@@ -1270,7 +1270,7 @@ void OoxConverter::convert(OOX::Drawing::CRunProperty * oox_run_pr, odf_writer::
switch(type) switch(type)
{ {
case SimpleTypes::underlineNone : case SimpleTypes::underlineNone :
text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Non);break; text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::None);break;
case SimpleTypes::underlineDash : case SimpleTypes::underlineDash :
case SimpleTypes::underlineDashedHeavy: case SimpleTypes::underlineDashedHeavy:
text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Dash);break; text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Dash);break;
......
...@@ -114,6 +114,7 @@ namespace ComplexTypes ...@@ -114,6 +114,7 @@ namespace ComplexTypes
class CFramePr; class CFramePr;
class CTblWidth; class CTblWidth;
class CPageBorder; class CPageBorder;
class CTrackChange;
} }
} }
namespace cpdoccore namespace cpdoccore
...@@ -198,6 +199,7 @@ namespace Oox2Odf ...@@ -198,6 +199,7 @@ namespace Oox2Odf
void convert(OOX::Logic::CSmartTag *oox_tag); void convert(OOX::Logic::CSmartTag *oox_tag);
void convert(OOX::Logic::CPTab *oox_ptab); void convert(OOX::Logic::CPTab *oox_ptab);
int convert(ComplexTypes::Word::CTrackChange *oox_change, int type);
void convert(OOX::Logic::CIns *oox_ins); void convert(OOX::Logic::CIns *oox_ins);
void convert(OOX::Logic::CDel *oox_del); void convert(OOX::Logic::CDel *oox_del);
int convert(OOX::Logic::CPPrChange *oox_para_prop_change); int convert(OOX::Logic::CPPrChange *oox_para_prop_change);
...@@ -206,7 +208,6 @@ namespace Oox2Odf ...@@ -206,7 +208,6 @@ namespace Oox2Odf
int convert(OOX::Logic::CTrPrChange *oox_tr_prop_change); int convert(OOX::Logic::CTrPrChange *oox_tr_prop_change);
int convert(OOX::Logic::CTcPrChange *oox_tc_prop_change); int convert(OOX::Logic::CTcPrChange *oox_tc_prop_change);
int convert(OOX::Logic::CTblPrChange *oox_table_prop_change); int convert(OOX::Logic::CTblPrChange *oox_table_prop_change);
void convert(OOX::Logic::CAlternateContent *oox_alt_content); void convert(OOX::Logic::CAlternateContent *oox_alt_content);
void convert(OOX::Logic::CDrawing *oox_drawing); void convert(OOX::Logic::CDrawing *oox_drawing);
......
...@@ -615,7 +615,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRPr *oox_run_pr) ...@@ -615,7 +615,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRPr *oox_run_pr)
} }
convert(oox_run_pr->m_oColor.GetPointer(),text_properties->content().fo_color_); convert(oox_run_pr->m_oColor.GetPointer(),text_properties->content().fo_color_);
text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Non); text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::None);
if (oox_run_pr->m_oUnderline.IsInit()) if (oox_run_pr->m_oUnderline.IsInit())
{ {
text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Solid); text_properties->content().style_text_underline_style_ = odf_types::line_style(odf_types::line_style::Solid);
...@@ -631,7 +631,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRPr *oox_run_pr) ...@@ -631,7 +631,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CRPr *oox_run_pr)
text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Double);break; text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Double);break;
case SimpleTypes::Spreadsheet::underlineNone : case SimpleTypes::Spreadsheet::underlineNone :
text_properties->content().style_text_underline_style_ = boost::none; text_properties->content().style_text_underline_style_ = boost::none;
text_properties->content().style_text_underline_type_ = odf_types::line_type(odf_types::line_type::Non);break; text_properties->content().style_text_underline_type_ = odf_types::line_type(odf_types::line_type::None);break;
case SimpleTypes::Spreadsheet::underlineSingle : case SimpleTypes::Spreadsheet::underlineSingle :
case SimpleTypes::Spreadsheet::underlineSingleAccounting : case SimpleTypes::Spreadsheet::underlineSingleAccounting :
text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Single);break; text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Single);break;
...@@ -1172,7 +1172,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf_writer::style_te ...@@ -1172,7 +1172,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CFont * font, odf_writer::style_te
text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Double);break; text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Double);break;
case SimpleTypes::Spreadsheet::underlineNone : case SimpleTypes::Spreadsheet::underlineNone :
text_properties->content().style_text_underline_style_ = boost::none; text_properties->content().style_text_underline_style_ = boost::none;
text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Non);break; text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::None);break;
case SimpleTypes::Spreadsheet::underlineSingle : case SimpleTypes::Spreadsheet::underlineSingle :
case SimpleTypes::Spreadsheet::underlineSingleAccounting : case SimpleTypes::Spreadsheet::underlineSingleAccounting :
text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Single);break; text_properties->content().style_text_underline_type_= odf_types::line_type(odf_types::line_type::Single);break;
......
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