Commit da18ecd8 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatReader - fix same small bags

parent 7ae68b53
...@@ -89,11 +89,14 @@ void pptx_xml_slide::write_to(std::wostream & strm) ...@@ -89,11 +89,14 @@ void pptx_xml_slide::write_to(std::wostream & strm)
{ {
CP_XML_NODE(L"p:sld") CP_XML_NODE(L"p:sld")
{ {
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main"); CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"); CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main"); CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
CP_XML_NODE(L"p:cSld") CP_XML_ATTR(L"xmlns:p15", L"http://schemas.microsoft.com/office/powerpoint/2012/main");
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
CP_XML_NODE(L"p:cSld")
{ {
CP_XML_ATTR(L"name", name()); CP_XML_ATTR(L"name", name());
...@@ -147,15 +150,19 @@ void pptx_xml_slideLayout::write_to(std::wostream & strm) ...@@ -147,15 +150,19 @@ void pptx_xml_slideLayout::write_to(std::wostream & strm)
{ {
CP_XML_NODE(L"p:sldLayout") CP_XML_NODE(L"p:sldLayout")
{ {
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
CP_XML_ATTR(L"xmlns:p15", L"http://schemas.microsoft.com/office/powerpoint/2012/main");
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
//if (slideLayoutData_.str().length()<0) //if (slideLayoutData_.str().length()<0)
// CP_XML_ATTR(L"type",L"cust");//---------------------------!!!!!!!!!!!! // CP_XML_ATTR(L"type",L"cust");//---------------------------!!!!!!!!!!!!
//else //else
// CP_XML_ATTR(L"type",L"cust"); // CP_XML_ATTR(L"type",L"cust");
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"); CP_XML_NODE(L"p:cSld")
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_NODE(L"p:cSld")
{ {
CP_XML_NODE(L"p:spTree") CP_XML_NODE(L"p:spTree")
{ {
...@@ -239,9 +246,12 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm) ...@@ -239,9 +246,12 @@ void pptx_xml_slideMaster::write_to(std::wostream & strm)
{ {
CP_XML_NODE(L"p:sldMaster") CP_XML_NODE(L"p:sldMaster")
{ {
CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main"); CP_XML_ATTR(L"xmlns:a", L"http://schemas.openxmlformats.org/drawingml/2006/main");
CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"); CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main");
CP_XML_ATTR(L"xmlns:p", L"http://schemas.openxmlformats.org/presentationml/2006/main"); CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
CP_XML_ATTR(L"xmlns:p14", L"http://schemas.microsoft.com/office/powerpoint/2010/main");
CP_XML_ATTR(L"xmlns:p15", L"http://schemas.microsoft.com/office/powerpoint/2012/main");
CP_XML_ATTR(L"xmlns:mc", L"http://schemas.openxmlformats.org/markup-compatibility/2006");
CP_XML_NODE(L"p:cSld") CP_XML_NODE(L"p:cSld")
{ {
......
...@@ -363,19 +363,20 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm) ...@@ -363,19 +363,20 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
odf_reader::paragraph_format_properties paragraph_properties_; odf_reader::paragraph_format_properties paragraph_properties_;
ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_,odf_types::style_family::Paragraph); ApplyParagraphProperties (paragraph_style_name_, paragraph_properties_,odf_types::style_family::Paragraph);
ApplyListProperties (paragraph_properties_,level);//выравнивания листа накатим на свойства параграфа ApplyListProperties (paragraph_properties_, level);//выравнивания листа накатим на свойства параграфа
paragraph_properties_.pptx_convert(pptx_context_); paragraph_properties_.pptx_convert(pptx_context_);
const std::wstring & paragraphAttr = get_styles_context().paragraph_attr().str(); const std::wstring & paragraphAttr = get_styles_context().paragraph_attr().str();
const std::wstring & paragraphNodes = get_styles_context().paragraph_nodes().str(); const std::wstring & paragraphNodes = get_styles_context().paragraph_nodes().str();
if (level < 0 && paragraphAttr.length() <1 && paragraphNodes.length()<1) return; if (level < 0 && paragraphAttr.length() < 1 && !paragraphNodes.empty()) return;
strm << L"<a:pPr "; strm << L"<a:pPr ";
if (level>=0) if (level >= 0)
{ {
if (level > 8) level = 0;
strm << L"lvl=\"" << level << L"\" "; strm << L"lvl=\"" << level << L"\" ";
} }
...@@ -384,7 +385,7 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm) ...@@ -384,7 +385,7 @@ void pptx_text_context::Impl::write_pPr(std::wostream & strm)
strm << ">"; strm << ">";
strm << paragraphNodes; strm << paragraphNodes;
if (level >=0 ) if (level >= 0 )
{ {
......
...@@ -31,12 +31,11 @@ ...@@ -31,12 +31,11 @@
*/ */
#include "length.h" #include "length.h"
#include "../../../../Common/DocxFormat/Source/Base/Types_32.h"
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <boost/lexical_cast.hpp>
namespace cpdoccore { namespace odf_types { namespace cpdoccore { namespace odf_types {
std::wostream & operator << (std::wostream & _Wostream, const length::unit _Unit) std::wostream & operator << (std::wostream & _Wostream, const length::unit _Unit)
...@@ -223,9 +222,9 @@ double to_pt(const length & Val) ...@@ -223,9 +222,9 @@ double to_pt(const length & Val)
return 0.0; return 0.0;
} }
int pt_to_emu(double Val) _INT64 pt_to_emu(double Val)
{ {
return static_cast<int>(Val * 360000 * 2.54) / 72; return static_cast<_INT64>(Val * 360000 * 2.54) / 72;
} }
} }
......
...@@ -109,8 +109,8 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context) ...@@ -109,8 +109,8 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
double x_pt = common_draw_attlists_.position_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt); double x_pt = common_draw_attlists_.position_.svg_x_.get_value_or(length(0)).get_value_unit(length::pt);
double y_pt = common_draw_attlists_.position_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt); double y_pt = common_draw_attlists_.position_.svg_y_.get_value_or(length(0)).get_value_unit(length::pt);
if (x_pt <0) x_pt =0; if (x_pt < 0) x_pt =0;
if (y_pt <0) y_pt =0; if (y_pt < 0) y_pt =0;
Context.get_slide_context().set_rect(width_pt, height_pt, x_pt, y_pt); Context.get_slide_context().set_rect(width_pt, height_pt, x_pt, y_pt);
} }
......
...@@ -166,8 +166,6 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context) ...@@ -166,8 +166,6 @@ void draw_shape::common_pptx_convert(oox::pptx_conversion_context & Context)
{ {
Context.get_slide_context().set_property(_property(L"text-content",text_content_)); Context.get_slide_context().set_property(_property(L"text-content",text_content_));
} }
//Context.get_slide_context().end_drawing();
} }
void draw_rect::pptx_convert(oox::pptx_conversion_context & Context) void draw_rect::pptx_convert(oox::pptx_conversion_context & Context)
{ {
...@@ -304,6 +302,8 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context ...@@ -304,6 +302,8 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
{ {
find_draw_type_oox(); find_draw_type_oox();
bool set_shape = false;
if (draw_type_oox_index_) if (draw_type_oox_index_)
{ {
Context.get_slide_context().set_property(_property(L"odf-custom-draw-index", draw_type_oox_index_.get())); Context.get_slide_context().set_property(_property(L"odf-custom-draw-index", draw_type_oox_index_.get()));
...@@ -311,10 +311,12 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context ...@@ -311,10 +311,12 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
if (word_art_ == true) if (word_art_ == true)
Context.get_slide_context().set_property(_property(L"wordArt", true)); Context.get_slide_context().set_property(_property(L"wordArt", true));
set_shape = true;
} }
if (sub_type_) if (sub_type_)
{ {
Context.get_slide_context().start_shape(sub_type_.get()); Context.get_slide_context().start_shape(sub_type_.get());
set_shape = true;
} }
if (draw_enhanced_geometry_attlist_.draw_enhanced_path_) if (draw_enhanced_geometry_attlist_.draw_enhanced_path_)
...@@ -339,6 +341,8 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context ...@@ -339,6 +341,8 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
svg_path::oox_serialize(output_, o_Polyline); svg_path::oox_serialize(output_, o_Polyline);
Context.get_slide_context().set_property(odf_reader::_property(L"custom_path", output_.str())); Context.get_slide_context().set_property(odf_reader::_property(L"custom_path", output_.str()));
set_shape = true;
if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_) if (draw_enhanced_geometry_attlist_.drawooo_sub_view_size_)
{ {
std::vector< std::wstring > splitted; std::vector< std::wstring > splitted;
...@@ -362,10 +366,6 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context ...@@ -362,10 +366,6 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
} }
} }
} }
else if (!draw_type_oox_index_)
{
draw_type_oox_index_ = 0;
}
} }
if (draw_enhanced_geometry_attlist_.draw_modifiers_) if (draw_enhanced_geometry_attlist_.draw_modifiers_)
{ {
...@@ -380,6 +380,10 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context ...@@ -380,6 +380,10 @@ void draw_enhanced_geometry::pptx_convert(oox::pptx_conversion_context & Context
} }
} }
} }
if (!set_shape)
{
Context.get_slide_context().start_shape(1); //restart type shape
}
} }
} }
} }
\ No newline at end of file
...@@ -345,11 +345,11 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context & ...@@ -345,11 +345,11 @@ void text_format_properties_content::pptx_convert(oox::pptx_conversion_context &
} }
if (fo_text_transform_) if (fo_text_transform_)
{ {
if (fo_font_variant_->get_type() == text_transform::Uppercase) if (fo_text_transform_->get_type() == text_transform::Uppercase)
{ {
CP_XML_ATTR(L"cap", "all"); CP_XML_ATTR(L"cap", "all");
} }
else if (fo_font_variant_->get_type() == text_transform::Lowercase) else if (fo_text_transform_->get_type() == text_transform::Lowercase)
{ {
CP_XML_ATTR(L"cap", "small"); CP_XML_ATTR(L"cap", "small");
} }
......
...@@ -1177,20 +1177,23 @@ void style_page_layout_properties_attlist::pptx_convert(oox::pptx_conversion_con ...@@ -1177,20 +1177,23 @@ void style_page_layout_properties_attlist::pptx_convert(oox::pptx_conversion_con
if (fo_page_width_ || fo_page_height_ || style_print_orientation_) if (fo_page_width_ || fo_page_height_ || style_print_orientation_)
{ {
std::wstring w_w = L"",w_h = L""; std::wstring w_w, w_h;
int h=0,w=0; _INT64 h = 0, w = 0;
if (fo_page_width_) if (fo_page_width_)
{ {
w = fo_page_width_->get_value_unit(length::emu); w = fo_page_width_->get_value_unit(length::emu);
if (w < 914400) w = 914400;
w_w = boost::lexical_cast<std::wstring>(w); w_w = std::to_wstring(w);
} }
if (fo_page_height_) if (fo_page_height_)
{ {
h = fo_page_height_->get_value_unit(length::emu); h = fo_page_height_->get_value_unit(length::emu);
w_h = boost::lexical_cast<std::wstring>(h); if (h < 914400) h = 914400;
w_h = std::to_wstring(h);
} }
std::wstring w_orient = L"custom"; std::wstring w_orient = L"custom";
......
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