Commit 7b3c3dbf authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

исправление багов OdfReader

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@63003 954022d7-b5bf-4e40-9824-e11837661b57
parent 0cb286e9
...@@ -325,10 +325,13 @@ void docx_conversion_context::end_body() ...@@ -325,10 +325,13 @@ void docx_conversion_context::end_body()
} }
void docx_conversion_context::start_office_text() void docx_conversion_context::start_office_text()
{} {
}
void docx_conversion_context::end_office_text() void docx_conversion_context::end_office_text()
{} {
finish_paragraph();
}
namespace namespace
{ {
...@@ -379,7 +382,23 @@ void docx_conversion_context::process_list_styles() ...@@ -379,7 +382,23 @@ void docx_conversion_context::process_list_styles()
if (list_styles.empty()) if (list_styles.empty())
return; return;
strm << L"<w:numbering xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\">"; strm << L"<w:numbering \
xmlns:wpc=\"http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas\" \
xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\" \
xmlns:o=\"urn:schemas-microsoft-com:office:office\" \
xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" \
xmlns:m=\"http://schemas.openxmlformats.org/officeDocument/2006/math\" \
xmlns:v=\"urn:schemas-microsoft-com:vml\" \
xmlns:wp14=\"http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing\" \
xmlns:wp=\"http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing\" \
xmlns:w10=\"urn:schemas-microsoft-com:office:word\" \
xmlns:w=\"http://schemas.openxmlformats.org/wordprocessingml/2006/main\" \
xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\" \
xmlns:wpg=\"http://schemas.microsoft.com/office/word/2010/wordprocessingGroup\" \
xmlns:wpi=\"http://schemas.microsoft.com/office/word/2010/wordprocessingInk\" \
xmlns:wne=\"http://schemas.microsoft.com/office/word/2006/wordml\" \
xmlns:wps=\"http://schemas.microsoft.com/office/word/2010/wordprocessingShape\" \
mc:Ignorable=\"w14 wp14\">";
std::vector<int> numIds; std::vector<int> numIds;
BOOST_FOREACH(odf_reader::list_style_instance_ptr & inst, list_styles.instances()) BOOST_FOREACH(odf_reader::list_style_instance_ptr & inst, list_styles.instances())
......
...@@ -508,8 +508,6 @@ public: ...@@ -508,8 +508,6 @@ public:
bool process_headers_footers_; bool process_headers_footers_;
drop_cap_context & get_drop_cap_context(){return drop_cap_context_;} drop_cap_context & get_drop_cap_context(){return drop_cap_context_;}
private: private:
std::wstringstream document_xml_; std::wstringstream document_xml_;
std::wstringstream styles_xml_; std::wstringstream styles_xml_;
......
...@@ -314,16 +314,16 @@ void oox_serialize_xfrm(std::wostream & strm, _oox_drawing const & val, std::wst ...@@ -314,16 +314,16 @@ void oox_serialize_xfrm(std::wostream & strm, _oox_drawing const & val, std::wst
CP_XML_NODE(L"a:off") CP_XML_NODE(L"a:off")
{ {
CP_XML_ATTR(L"x", static_cast<size_t>(val.x)); CP_XML_ATTR(L"x", val.x);
CP_XML_ATTR(L"y", static_cast<size_t>(val.y)); CP_XML_ATTR(L"y", val.y);
} }
if (val.cx >0 || val.cy >0) if (val.cx >0 || val.cy >0)
{ {
CP_XML_NODE(L"a:ext") CP_XML_NODE(L"a:ext")
{ {
CP_XML_ATTR(L"cx", static_cast<size_t>(val.cx)); CP_XML_ATTR(L"cx", val.cx);
CP_XML_ATTR(L"cy", static_cast<size_t>(val.cy)); CP_XML_ATTR(L"cy", val.cy);
} }
}else }else
{ {
......
...@@ -889,10 +889,18 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio ...@@ -889,10 +889,18 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
if (dVal)drawing.cy = (int)(0.5 + drawing.cy * dVal.get()); if (dVal)drawing.cy = (int)(0.5 + drawing.cy * dVal.get());
GetProperty(drawing.additional,L"svg:translate_x",dVal); GetProperty(drawing.additional,L"svg:translate_x",dVal);
if (dVal)drawing.x+=get_value_emu(dVal.get()); if (dVal)
{
int val = get_value_emu(dVal.get());
drawing.x = val >=0 ? val : 0; //??? todooo ...
}
GetProperty(drawing.additional,L"svg:translate_y",dVal); GetProperty(drawing.additional,L"svg:translate_y",dVal);
if (dVal)drawing.y+=get_value_emu(dVal.get()); if (dVal)
{
int val = get_value_emu(dVal.get());
drawing.y = val >=0 ? val : 0; //??? todooo ...
}
} }
void draw_shape::docx_convert(oox::docx_conversion_context & Context) void draw_shape::docx_convert(oox::docx_conversion_context & Context)
...@@ -927,10 +935,18 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context) ...@@ -927,10 +935,18 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
bool pState = Context.get_paragraph_state(); bool pState = Context.get_paragraph_state();
Context.set_paragraph_state(false); Context.set_paragraph_state(false);
bool new_run = true;
if (pState == false && Context.get_drawing_context().get_current_level() == 1)
{
new_run = false;
}
else
Context.add_new_run();
Context.add_new_run(); docx_serialize(strm, drawing);
docx_serialize(strm,drawing);
Context.finish_run(); if (new_run) Context.finish_run();
Context.set_paragraph_state(pState); Context.set_paragraph_state(pState);
...@@ -1119,7 +1135,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context) ...@@ -1119,7 +1135,7 @@ void draw_text_box::docx_convert(oox::docx_conversion_context & Context)
Context.set_paragraph_state(false); Context.set_paragraph_state(false);
Context.add_new_run(); Context.add_new_run();
docx_serialize(strm,drawing); docx_serialize(strm, drawing);
Context.finish_run(); Context.finish_run();
Context.set_paragraph_state(pState); Context.set_paragraph_state(pState);
...@@ -1204,16 +1220,18 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context) ...@@ -1204,16 +1220,18 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
common_draw_docx_convert(Context, frame->common_draw_attlists_, drawing); common_draw_docx_convert(Context, frame->common_draw_attlists_, drawing);
bool runState = Context.get_run_state(); bool runState = Context.get_run_state();
Context.set_run_state(false); bool pState = Context.get_paragraph_state();
bool pState = Context.get_paragraph_state(); Context.set_run_state(false);
Context.set_paragraph_state(false); Context.set_paragraph_state(false);
std::wostream & strm = Context.output_stream(); std::wostream & strm = Context.output_stream();
Context.add_new_run(); Context.add_new_run();
docx_serialize(strm,drawing);
docx_serialize(strm, drawing);
Context.finish_run(); Context.finish_run();
Context.set_run_state(runState); Context.set_run_state(runState);
......
...@@ -277,10 +277,11 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context) ...@@ -277,10 +277,11 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
// . // .
// //
// //
// ... - -
const std::wstring & styleName = next_par_->paragraph_attrs_.text_style_name_.style_name(); const std::wstring & styleName = next_par_->paragraph_attrs_.text_style_name_.style_name();
const std::wstring masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(styleName); const std::wstring masterPageName = Context.root()->odf_context().styleContainer().master_page_name_by_name(styleName);
if (!masterPageName.empty()) if (!masterPageName.empty() && Context.get_master_page_name() != masterPageName)
{ {
const std::wstring pageLayoutName = Context.root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masterPageName); const std::wstring pageLayoutName = Context.root()->odf_context().pageLayoutContainer().page_layout_name_by_style(masterPageName);
Context.next_dump_page_properties(); Context.next_dump_page_properties();
......
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