Commit 21012285 authored by ElenaSubbotina's avatar ElenaSubbotina

OdfFormatWriter - fix border page (type = none)

parent 29167713
......@@ -385,6 +385,9 @@ bool odf_page_layout_context::add_header(int type)
create_element(L"style", L"header", elm, odf_context_);
if (!elm)return false;
if (master_state_list_.empty())
start_master_page(L"");
master_state_list_.back().add_header(elm);
////////////////////////////////////////////////////////////////////////
......@@ -425,8 +428,10 @@ bool odf_page_layout_context::add_header(int type)
return true;
}
void odf_page_layout_context::set_page_border_padding_bottom(int offset_type, double length_pt)
void odf_page_layout_context::set_page_border_padding_bottom(int offset_type, int type, double length_pt)
{
if (type < 1) return;
style_page_layout_properties * props = get_properties();
if (!props)return;
......@@ -443,8 +448,10 @@ void odf_page_layout_context::set_page_border_padding_bottom(int offset_type, do
}
void odf_page_layout_context::set_page_border_padding_top(int offset_type, double length_pt)
void odf_page_layout_context::set_page_border_padding_top(int offset_type, int type, double length_pt)
{
if (type < 1) return;
style_page_layout_properties * props = get_properties();
if (!props)return;
......@@ -461,8 +468,10 @@ void odf_page_layout_context::set_page_border_padding_top(int offset_type, doubl
}
void odf_page_layout_context::set_page_border_padding_left(int offset_type, double length_pt)
void odf_page_layout_context::set_page_border_padding_left(int offset_type, int type, double length_pt)
{
if (type < 1) return;
style_page_layout_properties * props = get_properties();
if (!props)return;
......@@ -479,8 +488,10 @@ void odf_page_layout_context::set_page_border_padding_left(int offset_type, doub
}
void odf_page_layout_context::set_page_border_padding_right(int offset_type, double length_pt)
void odf_page_layout_context::set_page_border_padding_right(int offset_type, int type, double length_pt)
{
if (type < 1) return;
style_page_layout_properties * props = get_properties();
if (!props)return;
......
......@@ -76,33 +76,34 @@ public:
odf_style_context* get_local_styles_context() //для автоматических стилей самих стилей
{return local_style_context_.get();}
void set_page_margin(_CP_OPT(double) top, _CP_OPT(double) left, _CP_OPT(double) bottom, _CP_OPT(double) right, _CP_OPT(double) header, _CP_OPT(double) footer);
void set_page_margin(_CP_OPT(odf_types::length) top, _CP_OPT(odf_types::length) left, _CP_OPT(odf_types::length) bottom, _CP_OPT(odf_types::length) right);
void set_page_gutter(_CP_OPT(odf_types::length) length_);
void set_page_margin (_CP_OPT(double) top, _CP_OPT(double) left, _CP_OPT(double) bottom, _CP_OPT(double) right, _CP_OPT(double) header, _CP_OPT(double) footer);
void set_page_margin (_CP_OPT(odf_types::length) top, _CP_OPT(odf_types::length) left, _CP_OPT(odf_types::length) bottom, _CP_OPT(odf_types::length) right);
void set_page_gutter (_CP_OPT(odf_types::length) length_);
void set_page_border(std::wstring top, std::wstring left, std::wstring bottom, std::wstring right);
void set_page_border_shadow(bool val);
void set_page_border (std::wstring top, std::wstring left, std::wstring bottom, std::wstring right);
void set_page_border_shadow (bool val);
void set_page_border_padding_bottom(int offset_type, double length_pt);
void set_page_border_padding_top(int offset_type, double length_pt);
void set_page_border_padding_left(int offset_type, double length_pt);
void set_page_border_padding_right(int offset_type, double length_pt);
void set_page_border_padding_bottom (int offset_type, int type, double length_pt);
void set_page_border_padding_top (int offset_type, int type, double length_pt);
void set_page_border_padding_left (int offset_type, int type, double length_pt);
void set_page_border_padding_right (int offset_type, int type, double length_pt);
void set_page_orientation(int type);
void set_page_size(_CP_OPT(odf_types::length) width, _CP_OPT(odf_types::length) height);
void set_page_orientation (int type);
void set_page_size (_CP_OPT(odf_types::length) width, _CP_OPT(odf_types::length) height);
void set_title_page_enable(bool val);
void set_pages_mirrored(bool val);
void set_even_and_left_headers(bool val);
void set_title_page_enable (bool val);
void set_pages_mirrored (bool val);
void set_even_and_left_headers (bool val);
bool add_footer(int type);
void set_footer_size(_CP_OPT(odf_types::length) length_);
bool add_header(int type);
bool add_header(int type);
void set_header_size(_CP_OPT(odf_types::length) length_);
void set_background(_CP_OPT(odf_types::color) & color, int type);
void set_background (_CP_OPT(odf_types::color) & color, int type);
void set_page_number_format(_CP_OPT(int) & type, _CP_OPT(int) & start);
void set_page_number_format (_CP_OPT(int) & type, _CP_OPT(int) & start);
double current_page_width_;
private:
......
......@@ -1053,14 +1053,34 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
if (oox_section_pr->m_oPgBorders->m_oOffsetFrom.IsInit() &&
(oox_section_pr->m_oPgBorders->m_oOffsetFrom->GetValue() == SimpleTypes::pageborderoffsetPage))border_offset = 2;
if (oox_section_pr->m_oPgBorders->m_oBottom.IsInit() && oox_section_pr->m_oPgBorders->m_oBottom->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_bottom(border_offset,oox_section_pr->m_oPgBorders->m_oBottom->m_oSpace->ToPoints());
if (oox_section_pr->m_oPgBorders->m_oTop.IsInit() && oox_section_pr->m_oPgBorders->m_oTop->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_top(border_offset,oox_section_pr->m_oPgBorders->m_oTop->m_oSpace->ToPoints());
if (oox_section_pr->m_oPgBorders->m_oLeft.IsInit() && oox_section_pr->m_oPgBorders->m_oLeft->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_left(border_offset,oox_section_pr->m_oPgBorders->m_oLeft->m_oSpace->ToPoints());
if (oox_section_pr->m_oPgBorders->m_oRight.IsInit() && oox_section_pr->m_oPgBorders->m_oRight->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_right(border_offset,oox_section_pr->m_oPgBorders->m_oRight->m_oSpace->ToPoints());
if (oox_section_pr->m_oPgBorders->m_oBottom.IsInit())
{
int type = (oox_section_pr->m_oPgBorders->m_oBottom->m_oVal.IsInit() ? oox_section_pr->m_oPgBorders->m_oBottom->m_oVal->GetValue() : SimpleTypes::bordervalueSingle);
if (oox_section_pr->m_oPgBorders->m_oBottom->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_bottom(border_offset, type, oox_section_pr->m_oPgBorders->m_oBottom->m_oSpace->ToPoints());
}
if (oox_section_pr->m_oPgBorders->m_oTop.IsInit())
{
int type = (oox_section_pr->m_oPgBorders->m_oBottom->m_oVal.IsInit() ? oox_section_pr->m_oPgBorders->m_oTop->m_oVal->GetValue() : SimpleTypes::bordervalueSingle);
if (oox_section_pr->m_oPgBorders->m_oTop->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_top(border_offset, type, oox_section_pr->m_oPgBorders->m_oTop->m_oSpace->ToPoints());
}
if (oox_section_pr->m_oPgBorders->m_oLeft.IsInit())
{
int type = (oox_section_pr->m_oPgBorders->m_oBottom->m_oVal.IsInit() ? oox_section_pr->m_oPgBorders->m_oLeft->m_oVal->GetValue() : SimpleTypes::bordervalueSingle);
if (oox_section_pr->m_oPgBorders->m_oLeft->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_left(border_offset, type, oox_section_pr->m_oPgBorders->m_oLeft->m_oSpace->ToPoints());
}
if (oox_section_pr->m_oPgBorders->m_oRight.IsInit())
{
int type = (oox_section_pr->m_oPgBorders->m_oBottom->m_oVal.IsInit() ? oox_section_pr->m_oPgBorders->m_oRight->m_oVal->GetValue() : SimpleTypes::bordervalueSingle);
if (oox_section_pr->m_oPgBorders->m_oRight->m_oSpace.IsInit())
odt_context->page_layout_context()->set_page_border_padding_right(border_offset, type, oox_section_pr->m_oPgBorders->m_oRight->m_oSpace->ToPoints());
}
bool shadow = false;
......
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