Commit 8d358a09 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormat..

parent 2b0c5147
......@@ -44,6 +44,7 @@
#include "../odf/odfcontext.h"
#include "../odf/style_paragraph_properties.h"
#include "../odf/style_text_properties.h"
#include "../odf/style_table_properties.h"
#include "../odf/style_graphic_properties.h"
#include "../odf/datatypes/style_ref.h"
......@@ -1301,6 +1302,8 @@ void docx_conversion_context::start_changes()
text_tracked_context_.dumpPPr_.clear();
text_tracked_context_.dumpRPr_.clear();
text_tracked_context_.dumpRPrInsDel_.clear();
text_tracked_context_.dumpTcPr_.clear();
text_tracked_context_.dumpTblPr_.clear();
for (map_changes_iterator it = map_current_changes_.begin(); it != map_current_changes_.end(); it++)
{
......@@ -1329,45 +1332,63 @@ void docx_conversion_context::start_changes()
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();
odf_reader::style_paragraph_properties * props = styleInst->content()->get_style_paragraph_properties();
odf_reader::style_text_properties * props_text = styleInst->content()->get_style_text_properties();
text_tracked_context_.dumpPPr_ += L"<w:pPrChange" + change_attr;
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>";
text_tracked_context_.dumpPPr_ += get_styles_context().paragraph_attr().str();
}
text_tracked_context_.dumpPPr_ += L">";
if (props) text_tracked_context_.dumpPPr_ += get_styles_context().paragraph_nodes().str();
if (props_text)
{
props_text->docx_convert(*this);
text_tracked_context_.dumpPPr_ += L"<w:rPr>";
text_tracked_context_.dumpPPr_ += get_styles_context().text_style().str();
text_tracked_context_.dumpPPr_ += L"</w:rPr>";
}
else
text_tracked_context_.dumpPPr_ = L"<w:pPrChange/>";
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))
{
text_tracked_context_.dumpRPr_ = L"<w:rPrChange" + change_attr + L">";
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/>";
}
text_tracked_context_.dumpRPr_ += L"</w:rPrChange>";
}
else
else if (styleInst = root()->odf_context().styleContainer().style_by_name(state.style_name, odf_types::style_family::Table, false))
{
text_tracked_context_.dumpTblPr_ = L"<w:TblPrChange" + change_attr + L">";
odf_reader::style_table_properties * props = styleInst->content()->get_style_table_properties();
odf_reader::style_table_cell_properties * props_cell = styleInst->content()->get_style_table_cell_properties();
if (props)
{
props->docx_convert(*this);
text_tracked_context_.dumpTblPr_ += get_styles_context().table_style().str();
}
text_tracked_context_.dumpTblPr_ += L"</w:TblPrChange>";
}
else if (styleInst = root()->odf_context().styleContainer().style_by_name(state.style_name, odf_types::style_family::TableCell, false))
{
text_tracked_context_.dumpTcPr_ = L"<w:TcPrChange" + change_attr + L">";
odf_reader::style_table_cell_properties * props = styleInst->content()->get_style_table_cell_properties();
if (props)
{
props->docx_convert(*this);
text_tracked_context_.dumpTcPr_ += get_styles_context().table_style().str();
}
text_tracked_context_.dumpTcPr_ += L"</w:TcPrChange>";
}
}
}
......@@ -1386,6 +1407,8 @@ void docx_conversion_context::end_changes()
// if (state.type == 2) output_stream() << L"</w:del>";
//}
text_tracked_context_.dumpTcPr_.clear();
text_tracked_context_.dumpTblPr_.clear();
text_tracked_context_.dumpRPrInsDel_.clear();
text_tracked_context_.dumpPPr_.clear();
text_tracked_context_.dumpRPr_.clear();
......
......@@ -509,6 +509,8 @@ public:
std::wstring dumpPPr_;
std::wstring dumpRPr_;
std::wstring dumpRPrInsDel_;
std::wstring dumpTblPr_;
std::wstring dumpTcPr_;
text_tracked_context(docx_conversion_context & context);
......@@ -719,6 +721,9 @@ public:
bool delayed_converting_;
bool convert_delayed_enabled_;
void start_changes();
void end_changes();
private:
std::wstringstream document_xml_;
std::wstringstream styles_xml_;
......@@ -791,10 +796,6 @@ private:
// цепочки переименований нумераций
boost::unordered_map<std::wstring, std::wstring> list_style_renames_;
void start_changes();
void end_changes();
};
}
......
......@@ -124,7 +124,7 @@ void styles_context::docx_serialize_text_style(std::wostream & strm, std::wstrin
}
}
void styles_context::docx_serialize_table_style(std::wostream & strm)
void styles_context::docx_serialize_table_style(std::wostream & strm, std::wstring & strChange)
{
if (!table_style_.str().empty())
{
......@@ -133,6 +133,11 @@ void styles_context::docx_serialize_table_style(std::wostream & strm)
CP_XML_NODE(L"w:tblPr")
{
CP_XML_STREAM() << table_style_.str();
if (!strChange.empty())//tblPrChange
{
CP_XML_STREAM() << strChange;
strChange.clear();
}
}
}
}
......
......@@ -58,10 +58,10 @@ public:
std::wstringstream & table_style();
std::wstringstream & list_style();
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_text_style (std::wostream & strm, std::wstring parenStyleId, std::wstring & strChange);
void docx_serialize_table_style (std::wostream & strm, std::wstring & strChange);
void pptx_serialize_table_style(std::wostream & strm);
void pptx_serialize_table_style (std::wostream & strm);
std::wstring & extern_node(){return extern_node_;}
std::wstring & hlinkClick(){return hlinkClick_;}
......
......@@ -154,6 +154,8 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
_Wostream << L"<w:tbl>";
Context.start_changes(); //TblPrChange
Context.get_table_context().start_table(tableStyleName);
style_instance * inst =
......@@ -164,7 +166,8 @@ void table_table::docx_convert(oox::docx_conversion_context & Context)
if (inst && inst->content())
inst->content()->docx_convert(Context);
Context.get_styles_context().docx_serialize_table_style(_Wostream);
Context.get_styles_context().docx_serialize_table_style(_Wostream, Context.get_text_tracked_context().dumpTblPr_);
_Wostream << L"<w:tblGrid>";
table_columns_and_groups_.docx_convert(Context);
......
......@@ -56,6 +56,7 @@ namespace OOX
class CTrPrChange;
class CTcPrChange;
class CTblPrChange;
class CTblGridChange;
class CParagraph;
class CParagraphProperty;
class CPTab;
......@@ -208,6 +209,7 @@ namespace Oox2Odf
int convert(OOX::Logic::CTrPrChange *oox_tr_prop_change);
int convert(OOX::Logic::CTcPrChange *oox_tc_prop_change);
int convert(OOX::Logic::CTblPrChange *oox_table_prop_change);
int convert(OOX::Logic::CTblGridChange *oox_table_grid_prop_change);
void convert(OOX::Logic::CAlternateContent *oox_alt_content);
void convert(OOX::Logic::CDrawing *oox_drawing);
......@@ -261,7 +263,7 @@ namespace Oox2Odf
bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, int col = -1);
bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, odf_writer::style_table_cell_properties *table_cell_properties/*,odf_writer::style_table_cell_properties * table_cell_properties = NULL*/);
bool convert(OOX::Logic::CTableProperty *oox_table_pr, bool base_styled);
bool convert(OOX::Logic::CTableProperty *oox_table_pr, bool base_styled);
bool convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_properties *table_properties);
void convert(OOX::Logic::CTableProperty *oox_table_pr, odf_writer::style_table_cell_properties *table_cell_properties);
void convert(OOX::Logic::CTableRowProperties *oox_table_row_pr);
......
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