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

OdfFormatWriter - эффект_штурмовика.docx - 1 страница (разделы по 1 параграфу)

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@68408 954022d7-b5bf-4e40-9824-e11837661b57
parent a4841e59
...@@ -270,7 +270,20 @@ void odf_drawing_context::set_header_state(bool Val) ...@@ -270,7 +270,20 @@ void odf_drawing_context::set_header_state(bool Val)
{ {
impl_->is_header_ = Val; impl_->is_header_ = Val;
} }
void odf_drawing_context::check_anchor()
{
return;
if ((impl_->is_footer_ || impl_->is_header_) && (impl_->anchor_settings_.run_through_) && (impl_->anchor_settings_.run_through_->get_type() == run_through::Background))
{
set_anchor(anchor_type::Char);
//
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
if (impl_->is_footer_)
set_vertical_pos(0);
}
}
void odf_drawing_context::start_group() void odf_drawing_context::start_group()
{ {
office_element_ptr group_elm = impl_->create_draw_element(5000); office_element_ptr group_elm = impl_->create_draw_element(5000);
...@@ -1094,7 +1107,14 @@ void odf_drawing_context::set_object_foreground(bool Val) ...@@ -1094,7 +1107,14 @@ void odf_drawing_context::set_object_foreground(bool Val)
{ {
if (Val) if (Val)
{ {
impl_->anchor_settings_.run_through_ = run_through(run_through::Foreground); if (impl_->is_footer_|| impl_->is_header_)
{
impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
}
else
{
impl_->anchor_settings_.run_through_ = run_through(run_through::Foreground);
}
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough); impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
} }
} }
...@@ -1145,17 +1165,6 @@ void odf_drawing_context::set_vertical_rel(int from) ...@@ -1145,17 +1165,6 @@ void odf_drawing_context::set_vertical_rel(int from)
case 7: type = vertical_rel::Baseline; break;// relfromvTopMargin ??? case 7: type = vertical_rel::Baseline; break;// relfromvTopMargin ???
} }
if ((impl_->is_footer_ || impl_->is_header_) && ( from ==3 /*|| 5*/))
{
set_anchor(anchor_type::Paragraph);
//
impl_->anchor_settings_.style_wrap_ = style_wrap(style_wrap::RunThrough);
impl_->anchor_settings_.run_through_ = run_through(run_through::Background);
if (impl_->is_footer_)
set_vertical_pos(0);
}
impl_->anchor_settings_.style_vertical_rel_ = vertical_rel(type); impl_->anchor_settings_.style_vertical_rel_ = vertical_rel(type);
if (!impl_->anchor_settings_.style_vertical_pos_) if (!impl_->anchor_settings_.style_vertical_pos_)
...@@ -1739,8 +1748,22 @@ void odf_drawing_context::set_textarea_padding(double left,double top, double ri ...@@ -1739,8 +1748,22 @@ void odf_drawing_context::set_textarea_padding(double left,double top, double ri
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// //
void odf_drawing_context::start_image(std::wstring path) void odf_drawing_context::start_image(std::wstring odf_path)
{ {
if (impl_->is_footer_ || impl_->is_header_)
{
start_shape(142/*SimpleTypes::shapetypeRect*/);
start_bitmap_style();
draw_fill_image * fill_image = dynamic_cast<draw_fill_image *>(impl_->styles_context_->last_state()->get_office_element().get());
if (fill_image)
{
fill_image->xlink_attlist_.href_= odf_path;
}
set_opacity(50);
return;
}
impl_->current_drawing_state_.oox_shape_preset = 3000; impl_->current_drawing_state_.oox_shape_preset = 3000;
start_frame(); start_frame();
...@@ -1762,7 +1785,7 @@ void odf_drawing_context::start_image(std::wstring path) ...@@ -1762,7 +1785,7 @@ void odf_drawing_context::start_image(std::wstring path)
image->common_xlink_attlist_.show_ = xlink_show::Embed; image->common_xlink_attlist_.show_ = xlink_show::Embed;
image->common_xlink_attlist_.actuate_= xlink_actuate::OnLoad; image->common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
if (path.length() >0) image->common_xlink_attlist_.href_= path; //may be later set if (!odf_path.empty()) image->common_xlink_attlist_.href_= odf_path; //may be later set
start_element(image_elm); start_element(image_elm);
...@@ -1797,8 +1820,8 @@ void odf_drawing_context::start_text_box() ...@@ -1797,8 +1820,8 @@ void odf_drawing_context::start_text_box()
start_element(text_box_elm); start_element(text_box_elm);
if (impl_->is_footer_ ==false && impl_->is_header_ ==false) //if (impl_->is_footer_ ==false && impl_->is_header_ ==false)
set_text_box_parent_style(L"Frame"); // set_text_box_parent_style(L"Frame");
start_area_properties(); start_area_properties();
set_no_fill(); set_no_fill();
...@@ -1834,8 +1857,14 @@ void odf_drawing_context::set_text_box_parent_style(std::wstring style_name) ...@@ -1834,8 +1857,14 @@ void odf_drawing_context::set_text_box_parent_style(std::wstring style_name)
void odf_drawing_context::end_image() void odf_drawing_context::end_image()
{ {
if (impl_->is_footer_ || impl_->is_header_)
{
end_bitmap_style();
end_shape();
return;
}
end_element(); end_element();
end_frame(); end_frame();
} }
void odf_drawing_context::end_text_box() void odf_drawing_context::end_text_box()
...@@ -2463,7 +2492,7 @@ void odf_drawing_context::start_bitmap_style() ...@@ -2463,7 +2492,7 @@ void odf_drawing_context::start_bitmap_style()
fill_image->draw_name_ = impl_->styles_context_->find_free_name(style_family::FillImage); fill_image->draw_name_ = impl_->styles_context_->find_free_name(style_family::FillImage);
fill_image->draw_display_name_ = std::wstring(L"User") + fill_image->draw_name_.get() ; fill_image->draw_display_name_ = std::wstring(L"User") + fill_image->draw_name_.get() ;
//fill_image->xlink_attlist_.type_ = xlink_type::Simple; fill_image->xlink_attlist_.type_ = xlink_type::Simple;
fill_image->xlink_attlist_.show_ = xlink_show::Embed; fill_image->xlink_attlist_.show_ = xlink_show::Embed;
fill_image->xlink_attlist_.actuate_ = xlink_actuate::OnLoad; fill_image->xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
...@@ -2503,7 +2532,7 @@ void odf_drawing_context::set_bitmap_tile_align(int align) ...@@ -2503,7 +2532,7 @@ void odf_drawing_context::set_bitmap_tile_align(int align)
} }
void odf_drawing_context::set_image_style_repeat(int style) void odf_drawing_context::set_image_style_repeat(int style)
{ {
if (!impl_->current_graphic_properties)return; if (!impl_->current_graphic_properties) return;
if (style == 1) if (style == 1)
impl_->current_graphic_properties->content().common_draw_fill_attlist_.style_repeat_ = style_repeat(style_repeat::Stretch); impl_->current_graphic_properties->content().common_draw_fill_attlist_.style_repeat_ = style_repeat(style_repeat::Stretch);
...@@ -2555,9 +2584,6 @@ void odf_drawing_context::set_bitmap_link(std::wstring file_path) ...@@ -2555,9 +2584,6 @@ void odf_drawing_context::set_bitmap_link(std::wstring file_path)
if (image == NULL)return; if (image == NULL)return;
image->common_xlink_attlist_.href_= odf_ref_name; image->common_xlink_attlist_.href_= odf_ref_name;
//backgroud image
//set_anchor(anchor_type::Char);
//set_overlap(true);
} }
else else
{ {
......
...@@ -31,6 +31,7 @@ public: ...@@ -31,6 +31,7 @@ public:
void set_header_state(bool Val); void set_header_state(bool Val);
void set_footer_state(bool Val); void set_footer_state(bool Val);
void check_anchor();
void set_margin_left (double valPt); void set_margin_left (double valPt);
void set_margin_right (double valPt); void set_margin_right (double valPt);
......
...@@ -52,6 +52,8 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc ...@@ -52,6 +52,8 @@ odt_conversion_context::odt_conversion_context(package::odf_document * outputDoc
is_header_ = false; is_header_ = false;
is_footer_ = false; is_footer_ = false;
is_paragraph_in_current_section_ = false;
drop_cap_state_.clear(); drop_cap_state_.clear();
} }
...@@ -202,7 +204,7 @@ void odt_conversion_context::end_drawings() ...@@ -202,7 +204,7 @@ void odt_conversion_context::end_drawings()
office_element_ptr & elm = drawing_context()->get_root_element(); office_element_ptr & elm = drawing_context()->get_root_element();
if (elm && text_context()->current_level_.size() > 0)//add to p or h !!!!! if (elm && text_context()->current_level_.size() > 0)//add to 'p' or 'h' !!!!!
{ {
anchor_type::type anchor = drawing_context()->get_anchor(); anchor_type::type anchor = drawing_context()->get_anchor();
...@@ -383,8 +385,13 @@ void odt_conversion_context::start_field(bool in_span) ...@@ -383,8 +385,13 @@ void odt_conversion_context::start_field(bool in_span)
void odt_conversion_context::set_master_page_name(std::wstring master_name) void odt_conversion_context::set_master_page_name(std::wstring master_name)
{ {
if (current_root_elements_.size() < 1) return; if (current_root_elements_.size() < 1)// return; - _.docx - 1 !! ( -
{
is_paragraph_in_current_section_ = true;
return;
}
is_paragraph_in_current_section_ = false;
style *style_ = dynamic_cast<style*>(current_root_elements_[0].style_elm.get()); style *style_ = dynamic_cast<style*>(current_root_elements_[0].style_elm.get());
if (style_)style_->style_master_page_name_ = master_name; if (style_)style_->style_master_page_name_ = master_name;
......
...@@ -111,6 +111,8 @@ public: ...@@ -111,6 +111,8 @@ public:
void set_background(_CP_OPT(color) & color, int type); void set_background(_CP_OPT(color) & color, int type);
bool is_paragraph_in_current_section_;
private: private:
office_text* root_text_; office_text* root_text_;
office_element_ptr root_document_; office_element_ptr root_document_;
......
...@@ -418,8 +418,16 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) ...@@ -418,8 +418,16 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
if ((list_present = odt_context->text_context()->get_list_item_state()) == false) odt_context->set_no_list(); if ((list_present = odt_context->text_context()->get_list_item_state()) == false) odt_context->set_no_list();
if (bStartNewParagraph) odt_context->start_paragraph(bStyled); if (bStartNewParagraph)
{
odt_context->start_paragraph(bStyled);
if (odt_context->is_paragraph_in_current_section_)
{
odt_context->set_master_page_name(odt_context->page_layout_context()->last_master() ?
odt_context->page_layout_context()->last_master()->get_name() : L"");
}
}
for (unsigned int nIndex = 0; nIndex < oox_paragraph->m_arrItems.size(); nIndex++ ) for (unsigned int nIndex = 0; nIndex < oox_paragraph->m_arrItems.size(); nIndex++ )
{ {
// Paragraph - - // Paragraph - -
...@@ -434,6 +442,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) ...@@ -434,6 +442,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
break; break;
} }
} }
if (odt_context->text_context()->get_KeepNextParagraph()) odt_context->end_drop_cap(); if (odt_context->text_context()->get_KeepNextParagraph()) odt_context->end_drop_cap();
if (!odt_context->text_context()->get_KeepNextParagraph()) odt_context->end_paragraph(); if (!odt_context->text_context()->get_KeepNextParagraph()) odt_context->end_paragraph();
...@@ -442,6 +451,9 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) ...@@ -442,6 +451,9 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
{ {
odt_context->end_list_item(); odt_context->end_list_item();
} }
} }
void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87 math 17.3.2.25 void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87 math 17.3.2.25
{ {
...@@ -956,9 +968,6 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r ...@@ -956,9 +968,6 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
odt_context->page_layout_context()->start_master_page(root ? L"Standard" : L""); odt_context->page_layout_context()->start_master_page(root ? L"Standard" : L"");
odt_context->set_master_page_name(odt_context->page_layout_context()->last_master() ?
odt_context->page_layout_context()->last_master()->get_name() : L"");
bool present_header = false; bool present_header = false;
bool present_footer = false; bool present_footer = false;
...@@ -1107,6 +1116,10 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r ...@@ -1107,6 +1116,10 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
} }
} }
//-------------------------------------------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------------------------------------------
odt_context->set_master_page_name(odt_context->page_layout_context()->last_master() ?
odt_context->page_layout_context()->last_master()->get_name() : L"");
// - // -
if (!root)odt_context->add_section(continuous); if (!root)odt_context->add_section(continuous);
...@@ -2131,6 +2144,8 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor) ...@@ -2131,6 +2144,8 @@ void DocxConverter::convert(OOX::Drawing::CAnchor *oox_anchor)
} }
OoxConverter::convert(oox_anchor->m_oDocPr.GetPointer()); OoxConverter::convert(oox_anchor->m_oDocPr.GetPointer());
convert(oox_anchor->m_oGraphic.GetPointer()); convert(oox_anchor->m_oGraphic.GetPointer());
odf_context()->drawing_context()->check_anchor();
} }
void DocxConverter::convert(OOX::Drawing::CInline *oox_inline) void DocxConverter::convert(OOX::Drawing::CInline *oox_inline)
{ {
...@@ -2757,7 +2772,7 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style) ...@@ -2757,7 +2772,7 @@ void DocxConverter::convert(OOX::CDocDefaults *def_style)
// ?! OpenOffice / - oO !!! // ?! OpenOffice / - oO !!!
odt_context->styles_context()->create_style(L"Frame", odf_types::style_family::Graphic,false,true); odt_context->styles_context()->create_style(L"Frame", odf_types::style_family::Graphic,false,true);
odf_writer::style_graphic_properties * graphic_properties = odt_context->styles_context()->last_state()->get_graphic_properties(); odf_writer::style_graphic_properties * graphic_properties = odt_context->styles_context()->last_state()->get_graphic_properties();
if (graphic_properties)graphic_properties->content().common_background_color_attlist_.fo_background_color_ = odf_types::background_color(odf_types::background_color::Transparent); //if (graphic_properties)graphic_properties->content().common_background_color_attlist_.fo_background_color_ = odf_types::background_color(odf_types::background_color::Transparent);
} }
......
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