Commit 8fbfd798 authored by Elen.Subbotina's avatar Elen.Subbotina Committed by Alexander Trofimov

(1.0.1.168): ASCOfficeOdfFile

8042 (фоновая заливка страницы)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@53643 954022d7-b5bf-4e40-9824-e11837661b57
parent fa261694
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//0 //0
//1 //1
//166 //168
#define INTVER 1,0,1,166 #define INTVER 1,0,1,168
#define STRVER "1,0,1,166\0" #define STRVER "1,0,1,168\0"
...@@ -251,8 +251,18 @@ std::wstring docx_conversion_context::dump_settings_document() ...@@ -251,8 +251,18 @@ std::wstring docx_conversion_context::dump_settings_document()
{ {
CP_XML_NODE(L"w:evenAndOddHeaders"); CP_XML_NODE(L"w:evenAndOddHeaders");
} }
if (odf::GetProperty(settings_properties_,L"displayBackgroundShape",boolVal))
{
CP_XML_NODE(L"w:displayBackgroundShape");
}
if (odf::GetProperty(settings_properties_,L"zoom",intVal))
{
CP_XML_NODE(L"w:zoom")
{
CP_XML_ATTR(L"w:percent",intVal.get());
}
}
} }
//output << L"<w:zoom w:percent=\"57\"/> ";
} }
return output.str(); return output.str();
} }
......
...@@ -81,7 +81,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf::_property> & ...@@ -81,7 +81,7 @@ void oox_serialize_ln(std::wostream & strm, const std::vector<odf::_property> &
if (dVal) if (dVal)
{ {
CP_XML_ATTR(L"w",static_cast<size_t>(dVal.get()*12700));//in emu (1 pt = 12700) CP_XML_ATTR(L"w",static_cast<size_t>(dVal.get() * 12700));//in emu (1 pt = 12700)
if (color.length()<1)color = L"729FCF"; if (color.length()<1)color = L"729FCF";
} }
......
...@@ -94,6 +94,8 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c ...@@ -94,6 +94,8 @@ bool parse_clipping(std::wstring strClipping,std::wstring fileName, double_4 & c
clip_rect[1] = clip_rect[1]*100/fileHeight; clip_rect[1] = clip_rect[1]*100/fileHeight;
clip_rect[3] = clip_rect[3]*100/fileHeight; clip_rect[3] = clip_rect[3]*100/fileHeight;
if (clip_rect[0]<0.01 && clip_rect[1]<0.01 && clip_rect[2]<0.01 && clip_rect[3]<0.01)
return false;
return true; return true;
} }
return false; return false;
......
...@@ -31,6 +31,18 @@ namespace odf { ...@@ -31,6 +31,18 @@ namespace odf {
namespace fs = ::boost::filesystem; namespace fs = ::boost::filesystem;
namespace { namespace {
bool IsExistProperty(std::vector<_property> Heap,const std::wstring Name)
{
BOOST_FOREACH(_property const & p, Heap)
{
int res = p.name_.find(Name);
if (res>=0)
{
return true;
}
}
return false;
}
_CP_OPT(length) CalcResultLength(const _CP_OPT(length_or_percent) & Value, const _CP_OPT(length) & Base) _CP_OPT(length) CalcResultLength(const _CP_OPT(length_or_percent) & Value, const _CP_OPT(length) & Base)
{ {
...@@ -895,6 +907,13 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context) ...@@ -895,6 +907,13 @@ void draw_shape::docx_convert(oox::docx_conversion_context & Context)
common_draw_docx_convert(Context, common_draw_attlists_, drawing); common_draw_docx_convert(Context, common_draw_attlists_, drawing);
///////// /////////
if (drawing.fill.type < 1 && !IsExistProperty(drawing.additional,L"stroke"))//
{
drawing.fill.solid = oox::oox_solid_fill::create();
drawing.fill.solid->color = L"729FCF";
drawing.fill.type = 1;
}
std::wostream & strm = Context.output_stream(); std::wostream & strm = Context.output_stream();
bool pState = Context.get_paragraph_state(); bool pState = Context.get_paragraph_state();
...@@ -954,6 +973,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context) ...@@ -954,6 +973,7 @@ void draw_image::docx_convert(oox::docx_conversion_context & Context)
drawing.fill.bitmap->isInternal = false; drawing.fill.bitmap->isInternal = false;
drawing.fill.bitmap->rId = Context.add_mediaitem(href, oox::mediaitems::typeImage,drawing.fill.bitmap->isInternal,href); drawing.fill.bitmap->rId = Context.add_mediaitem(href, oox::mediaitems::typeImage,drawing.fill.bitmap->isInternal,href);
drawing.fill.bitmap->bStretch = true;
drawing.id = Context.get_drawing_context().get_current_frame_id(); drawing.id = Context.get_drawing_context().get_current_frame_id();
drawing.name = Context.get_drawing_context().get_current_object_name(); drawing.name = Context.get_drawing_context().get_current_object_name();
......
...@@ -59,7 +59,6 @@ void office_body::xlsx_convert(oox::xlsx_conversion_context & Context) ...@@ -59,7 +59,6 @@ void office_body::xlsx_convert(oox::xlsx_conversion_context & Context)
void office_body::docx_convert(oox::docx_conversion_context & Context) void office_body::docx_convert(oox::docx_conversion_context & Context)
{ {
Context.start_body();
std::vector<style_master_page*> & masterPages = Context.root()->odf_context().pageLayoutContainer().master_pages(); std::vector<style_master_page*> & masterPages = Context.root()->odf_context().pageLayoutContainer().master_pages();
if (!masterPages.empty()) if (!masterPages.empty())
...@@ -68,8 +67,21 @@ void office_body::docx_convert(oox::docx_conversion_context & Context) ...@@ -68,8 +67,21 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
} }
Context.set_page_properties(Context.root()->odf_context().pageLayoutContainer().page_layout_first()->name()); Context.set_page_properties(Context.root()->odf_context().pageLayoutContainer().page_layout_first()->name());
//backcolor (for all pages)
if (content_) if (page_layout_instance * firtsPageLayout = Context.root()->odf_context().pageLayoutContainer().page_layout_by_name(Context.get_page_properties()))
{
if (style_page_layout_properties * prop = firtsPageLayout->properties())
{
if (prop->docx_back_serialize(Context.output_stream(), Context))
{
Context.set_settings_property(odf::_property(L"displayBackgroundShape",true));
}
}
}
//content
Context.start_body();
if (content_)
content_->docx_convert(Context); content_->docx_convert(Context);
Context.get_headers_footers().set_enable_write(true); Context.get_headers_footers().set_enable_write(true);
......
...@@ -177,11 +177,11 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co ...@@ -177,11 +177,11 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
CP_XML_NODE(L"w:spacing") CP_XML_NODE(L"w:spacing")
{ {
CP_XML_ATTR(L"w:after", 0); CP_XML_ATTR(L"w:after", 0);
CP_XML_ATTR(L"w:lineRule", L"exact");
if (Context.get_drop_cap_context().FontSize>0) if (Context.get_drop_cap_context().FontSize>0)
CP_XML_ATTR(L"w:line", Context.get_drop_cap_context().FontSize); CP_XML_ATTR(L"w:line", Context.get_drop_cap_context().FontSize);
else else
CP_XML_ATTR(L"w:line", 240); CP_XML_ATTR(L"w:line", 240);
CP_XML_ATTR(L"w:lineRule", L"exact");
} }
CP_XML_NODE(L"w:textAlignment"){CP_XML_ATTR(L"w:val", L"baseline");} CP_XML_NODE(L"w:textAlignment"){CP_XML_ATTR(L"w:val", L"baseline");}
} }
...@@ -286,14 +286,15 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co ...@@ -286,14 +286,15 @@ void paragraph_format_properties::docx_convert(oox::docx_conversion_context & Co
} }
CP_XML_NODE(L"w:spacing") CP_XML_NODE(L"w:spacing")
{ {
if (!w_line.empty())
CP_XML_ATTR(L"w:line", w_line);
if (!w_after.empty()) if (!w_after.empty())
CP_XML_STREAM() << "w:after=\"" << w_after << "\" "; CP_XML_ATTR(L"w:after", w_after);
if (!w_before.empty()) if (!w_before.empty())
CP_XML_STREAM() << "w:before=\"" << w_before << "\" "; CP_XML_ATTR(L"w:before",w_before);
if (!w_lineRule.empty()) if (!w_lineRule.empty())
CP_XML_STREAM() << "w:lineRule=\"" << w_lineRule << "\" "; CP_XML_ATTR(L"w:lineRule", w_lineRule);
if (!w_line.empty())
CP_XML_STREAM() << "w:line=\"" << w_line << "\" ";
} }
} }
if (fo_margin_left_ || //? + if (fo_margin_left_ || //? +
......
...@@ -1009,7 +1009,20 @@ void style_page_layout_properties::add_child_element( xml::sax * Reader, const : ...@@ -1009,7 +1009,20 @@ void style_page_layout_properties::add_child_element( xml::sax * Reader, const :
{ {
style_page_layout_properties_elements_.add_child_element(Reader, Ns, Name, getContext()); style_page_layout_properties_elements_.add_child_element(Reader, Ns, Name, getContext());
} }
bool style_page_layout_properties::docx_back_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
{
if (!get_style_page_layout_properties_attlist().common_background_color_attlist_.fo_background_color_)return false;
CP_XML_WRITER(strm)
{
CP_XML_NODE(L"w:background")
{
std::wstring color = get_style_page_layout_properties_attlist().common_background_color_attlist_.fo_background_color_->get_color().get_hex_value();
CP_XML_ATTR(L"w:color",color);
}
}
return true;
}
void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context) void style_page_layout_properties::docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context)
{ {
if (Context.get_drawing_context().get_current_level()>0) return; if (Context.get_drawing_context().get_current_level()>0) return;
......
...@@ -1039,6 +1039,8 @@ public: ...@@ -1039,6 +1039,8 @@ public:
void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context); void docx_convert_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
void pptx_convert(oox::pptx_conversion_context & Context); void pptx_convert(oox::pptx_conversion_context & Context);
bool docx_back_serialize(std::wostream & strm, oox::docx_conversion_context & Context);
const style_page_layout_properties_attlist & get_style_page_layout_properties_attlist() const const style_page_layout_properties_attlist & get_style_page_layout_properties_attlist() const
{ {
......
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