Commit 4ab14c9c authored by ElenaSubbotina's avatar ElenaSubbotina Committed by Alexander Trofimov

OdfFormatReader - правка багов по результатам тестирования

parent 0e37afed
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<Configurations> <Configurations>
<Configuration <Configuration
Name="Debug|Win32" Name="Debug|Win32"
OutputDirectory="$(ConfigurationName)" OutputDirectory="WORD_EXAMPLE.odtWORD_EXAMPLE.odt"
IntermediateDirectory="$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="1" ConfigurationType="1"
CharacterSet="1" CharacterSet="1"
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include "mediaitems.h" #include "mediaitems.h"
#include "oox_drawing_fills.h" #include "oox_drawing_fills.h"
#include "../../../common/docxformat/source/base/types_32.h"
static const int _odf_to_oox_ShapeType[]= static const int _odf_to_oox_ShapeType[]=
{ 4,4,4,34,}; { 4,4,4,34,};
...@@ -45,8 +47,8 @@ namespace oox { ...@@ -45,8 +47,8 @@ namespace oox {
std::wstring name; std::wstring name;
size_t x, y; _INT32 x, y;
size_t cx, cy; _INT32 cx, cy;
_oox_fill fill; _oox_fill fill;
......
...@@ -857,6 +857,15 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio ...@@ -857,6 +857,15 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
drawing.cx = get_value_emu(attlists_.rel_size_.common_draw_size_attlist_.svg_width_); drawing.cx = get_value_emu(attlists_.rel_size_.common_draw_size_attlist_.svg_width_);
drawing.cy = get_value_emu(attlists_.rel_size_.common_draw_size_attlist_.svg_height_); drawing.cy = get_value_emu(attlists_.rel_size_.common_draw_size_attlist_.svg_height_);
if (drawing.cx < 0) //frame textbox int WORD_EXAMPLE.odt = 45 inch !!!!
{
drawing.cx = -drawing.cx;
drawing.additional.push_back(_property(L"fit-to-size", true));
}
if (drawing.cy < 0)
drawing.cy = 0;
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
if ((drawing.styleWrap) && (drawing.styleWrap->get_type() == style_wrap::Dynamic)) // if ((drawing.styleWrap) && (drawing.styleWrap->get_type() == style_wrap::Dynamic)) //
{ {
...@@ -1231,25 +1240,27 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context) ...@@ -1231,25 +1240,27 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
std::wstring objectPath = folderPath +FILE_SEPARATOR_STR + href; std::wstring objectPath = folderPath +FILE_SEPARATOR_STR + href;
//normalize path ??? todooo //normalize path ??? todooo
boost::algorithm::replace_all(objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
cpdoccore::odf_reader::odf_document objectSubDoc(objectPath,NULL); cpdoccore::odf_reader::odf_document objectSubDoc(objectPath ,NULL);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
office_element *contentSubDoc = objectSubDoc.get_impl()->get_content(); office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
if (!contentSubDoc) draw_frame *frame = NULL;
return;
chart_build objectBuild; chart_build objectBuild;
if (contentSubDoc)//Diagramma.odt -
{
process_build_chart process_build_object_(objectBuild, objectSubDoc.odf_context().styleContainer(), objectSubDoc.odf_context().drawStyles()); process_build_chart process_build_object_(objectBuild, objectSubDoc.odf_context().styleContainer(), objectSubDoc.odf_context().drawStyles());
contentSubDoc->accept(process_build_object_); contentSubDoc->accept(process_build_object_);
objectBuild.docx_convert(Context); objectBuild.docx_convert(Context);
draw_frame * frame = Context.get_drawing_context().get_current_frame();//owner frame = Context.get_drawing_context().get_current_frame();//owner
if (!frame) }
return;
//------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------
if (objectBuild.object_type_ == 1 ) // if (objectBuild.object_type_ == 1 && frame) //
{ {
oox::_docx_drawing drawing = oox::_docx_drawing(); oox::_docx_drawing drawing = oox::_docx_drawing();
...@@ -1278,7 +1289,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context) ...@@ -1278,7 +1289,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
Context.set_run_state(runState); Context.set_run_state(runState);
Context.set_paragraph_state(pState); Context.set_paragraph_state(pState);
} }
else if (objectBuild.object_type_ == 3) // else if (objectBuild.object_type_ == 3 && frame) //
{ {
oox::_docx_drawing drawing = oox::_docx_drawing(); oox::_docx_drawing drawing = oox::_docx_drawing();
...@@ -1328,7 +1339,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context) ...@@ -1328,7 +1339,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
} }
else if (objectBuild.object_type_ == 0) else if (objectBuild.object_type_ == 0)
{ {
// - ( ) // ( )
bool & use_image_replace = Context.get_drawing_context().get_use_image_replace(); bool & use_image_replace = Context.get_drawing_context().get_use_image_replace();
use_image_replace = true; use_image_replace = true;
......
...@@ -252,6 +252,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -252,6 +252,7 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href; std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
//normalize path ??? todooo //normalize path ??? todooo
boost::algorithm::replace_all(objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
cpdoccore::odf_reader::odf_document objectSubDoc(objectPath, NULL); cpdoccore::odf_reader::odf_document objectSubDoc(objectPath, NULL);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
......
...@@ -220,6 +220,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -220,6 +220,7 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href; std::wstring objectPath = folderPath + FILE_SEPARATOR_STR + href;
// normalize path ???? todooo // normalize path ???? todooo
boost::algorithm::replace_all(objectPath, FILE_SEPARATOR_STR + std::wstring(L"./"), FILE_SEPARATOR_STR);
cpdoccore::odf_reader::odf_document objectSubDoc(objectPath,NULL); cpdoccore::odf_reader::odf_document objectSubDoc(objectPath,NULL);
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -227,13 +228,13 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -227,13 +228,13 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// //
const office_element *contentSubDoc = objectSubDoc.get_impl()->get_content(); const office_element *contentSubDoc = objectSubDoc.get_impl()->get_content();
if (!contentSubDoc)return;
chart_build objectBuild; chart_build objectBuild;
if (contentSubDoc)
{
process_build_chart process_build_object_(objectBuild, objectSubDoc.odf_context().styleContainer(), objectSubDoc.odf_context().drawStyles() ); process_build_chart process_build_object_(objectBuild, objectSubDoc.odf_context().styleContainer(), objectSubDoc.odf_context().drawStyles() );
contentSubDoc->accept(process_build_object_); contentSubDoc->accept(process_build_object_);
}
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
......
...@@ -100,6 +100,13 @@ std::wstring process_margin(const _CP_OPT(length_or_percent) & margin, double Mu ...@@ -100,6 +100,13 @@ std::wstring process_margin(const _CP_OPT(length_or_percent) & margin, double Mu
void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Context) void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Context)
{ {
bool drawing = false;
if (Context.get_drawing_context().get_current_shape() || Context.get_drawing_context().get_current_frame())
{
drawing = true;
}
std::wstringstream & _pPr = Context.get_styles_context().paragraph_nodes(); std::wstringstream & _pPr = Context.get_styles_context().paragraph_nodes();
CP_XML_WRITER(_pPr) CP_XML_WRITER(_pPr)
...@@ -203,7 +210,8 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co ...@@ -203,7 +210,8 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
{ {
CP_XML_NODE(L"w:widowControl"){CP_XML_ATTR(L"w:val", bool (*fo_widows_ > 0));} CP_XML_NODE(L"w:widowControl"){CP_XML_ATTR(L"w:val", bool (*fo_widows_ > 0));}
} }
if (fo_border_ || fo_border_top_ || fo_border_bottom_ || fo_border_left_ || fo_border_right_)
if ((fo_border_ || fo_border_top_ || fo_border_bottom_ || fo_border_left_ || fo_border_right_) && drawing == false)
{ {
std::wstring w_shadow; std::wstring w_shadow;
......
...@@ -381,6 +381,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context) ...@@ -381,6 +381,7 @@ void paragraph::docx_convert(oox::docx_conversion_context & Context)
{ {
if (Context.get_page_break()) if (Context.get_page_break())
{ {
if (Context.process_headers_footers_ == false)
_Wostream << L"<w:lastRenderedPageBreak/>"; _Wostream << L"<w:lastRenderedPageBreak/>";
Context.set_page_break(false); Context.set_page_break(false);
} }
...@@ -448,6 +449,9 @@ void paragraph::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -448,6 +449,9 @@ void paragraph::pptx_convert(oox::pptx_conversion_context & Context)
/////////////////////////////////////////// ///////////////////////////////////////////
void soft_page_break::docx_convert(oox::docx_conversion_context & Context) void soft_page_break::docx_convert(oox::docx_conversion_context & Context)
{ {
if (Context.process_headers_footers_)
return;
if (!Context.get_page_break_after() && !Context.get_page_break_before()) if (!Context.get_page_break_after() && !Context.get_page_break_before())
{ {
Context.output_stream() << L"<w:lastRenderedPageBreak/>"; Context.output_stream() << L"<w:lastRenderedPageBreak/>";
......
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