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

(1.2.0.151): ASCOfficeOdfFileW

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@58118 954022d7-b5bf-4e40-9824-e11837661b57
parent 1242a35c
......@@ -631,17 +631,20 @@ void odf_drawing_context::end_shape()
draw_line* line = dynamic_cast<draw_line*>(impl_->current_level_.back().get());
if (line)
{
line->draw_line_attlist_.svg_x1_ = impl_->current_drawing_state_.svg_x_;
line->draw_line_attlist_.svg_y1_ = impl_->current_drawing_state_.svg_y_;
if (!line->draw_line_attlist_.svg_x1_) line->draw_line_attlist_.svg_x1_ = impl_->current_drawing_state_.svg_x_;
if (!line->draw_line_attlist_.svg_y1_) line->draw_line_attlist_.svg_y1_ = impl_->current_drawing_state_.svg_y_;
if (impl_->current_drawing_state_.svg_x_ && impl_->current_drawing_state_.svg_width_)
line->draw_line_attlist_.svg_x2_ = impl_->current_drawing_state_.svg_x_.get() + impl_->current_drawing_state_.svg_width_.get();
if (line->draw_line_attlist_.svg_x1_ && impl_->current_drawing_state_.svg_width_ && !line->draw_line_attlist_.svg_x2_)
line->draw_line_attlist_.svg_x2_ = line->draw_line_attlist_.svg_x1_.get() + impl_->current_drawing_state_.svg_width_.get();
if (impl_->current_drawing_state_.svg_y_ && impl_->current_drawing_state_.svg_height_)
line->draw_line_attlist_.svg_y2_ = impl_->current_drawing_state_.svg_y_.get() + impl_->current_drawing_state_.svg_height_.get();
if (line->draw_line_attlist_.svg_y1_ && impl_->current_drawing_state_.svg_height_ && !line->draw_line_attlist_.svg_y2_)
line->draw_line_attlist_.svg_y2_ = line->draw_line_attlist_.svg_y1_.get() + impl_->current_drawing_state_.svg_height_.get();
impl_->current_drawing_state_.svg_height_ = boost::none;
impl_->current_drawing_state_.svg_width_ = boost::none;
impl_->current_drawing_state_.svg_x_ = boost::none;
impl_->current_drawing_state_.svg_y_ = boost::none;
if (impl_->current_drawing_state_.flipV)
{
......@@ -878,16 +881,17 @@ void odf_drawing_context::set_shadow(int type, std::wstring hexColor, _CP_OPT(do
{
if (!impl_->current_graphic_properties)return;
impl_->current_graphic_properties->content().draw_shadow_offset_x_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
if (dist_pt_y > 0)
impl_->current_graphic_properties->content().draw_shadow_offset_y_ = length(length(dist_pt_y,length::pt).get_value_unit(length::cm),length::cm);
else
impl_->current_graphic_properties->content().draw_shadow_offset_y_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
impl_->current_graphic_properties->content().draw_shadow_ = shadow_type1(shadow_type1::Visible);
if (opacity) impl_->current_graphic_properties->content().draw_shadow_opacity_ = *opacity;
impl_->current_graphic_properties->content().draw_shadow_color_ = hexColor;
impl_->current_graphic_properties->content().draw_shadow_offset_y_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
if (dist_pt_y > 0)
impl_->current_graphic_properties->content().draw_shadow_offset_x_ = length(length(dist_pt_y,length::pt).get_value_unit(length::cm),length::cm);
else
impl_->current_graphic_properties->content().draw_shadow_offset_x_ = length(length(dist_pt,length::pt).get_value_unit(length::cm),length::cm);
}
void odf_drawing_context::set_no_fill()
......@@ -1325,10 +1329,44 @@ void odf_drawing_context::set_group_rotate(int iVal)
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt)
void odf_drawing_context::set_position_line(_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt, _CP_OPT(double) & x2_pt, _CP_OPT(double) & y2_pt)
{
//if (impl_->group_list_.size() < 1)return;
draw_line* line = dynamic_cast<draw_line*>(impl_->current_level_.back().get());
if (line == NULL) return;
if (impl_->current_drawing_state_.in_group && impl_->current_group_)
{
if (x_pt) x_pt = *x_pt * impl_->current_group_->scale_cx + impl_->current_group_->shift_x ;
// + (impl_->current_group_->flipH ? (impl_->current_group_->cx - 2 * x_pt): 0);
}
if (x_pt && !line->draw_line_attlist_.svg_x1_) line->draw_line_attlist_.svg_x1_ = length(length(*x_pt,length::pt).get_value_unit(length::cm),length::cm);
if (impl_->current_drawing_state_.in_group && impl_->current_group_)
{
if (y_pt) y_pt = *y_pt * impl_->current_group_->scale_cy + impl_->current_group_->shift_y;
//+ (impl_->current_group_->flipV ? (impl_->current_group_->cy - 2 * y_pt): 0);
}
if (y_pt && !line->draw_line_attlist_.svg_y1_) line->draw_line_attlist_.svg_y1_ = length(length(*y_pt,length::pt).get_value_unit(length::cm),length::cm);
///////////////////////////////////////
if (impl_->current_drawing_state_.in_group && impl_->current_group_)
{
if (x2_pt) x_pt = *x2_pt * impl_->current_group_->scale_cx + impl_->current_group_->shift_x ;
// + (impl_->current_group_->flipH ? (impl_->current_group_->cx - 2 * x_pt): 0);
}
if (x2_pt && !line->draw_line_attlist_.svg_x2_) line->draw_line_attlist_.svg_x2_ = length(length(*x2_pt,length::pt).get_value_unit(length::cm),length::cm);
if (impl_->current_drawing_state_.in_group && impl_->current_group_)
{
if (y2_pt) y_pt = *y2_pt * impl_->current_group_->scale_cy + impl_->current_group_->shift_y;
//+ (impl_->current_group_->flipV ? (impl_->current_group_->cy - 2 * y_pt): 0);
}
if (y2_pt && !line->draw_line_attlist_.svg_y2_) line->draw_line_attlist_.svg_y2_ = length(length(*y2_pt,length::pt).get_value_unit(length::cm),length::cm);
}
void odf_drawing_context::set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt)
{
double x = x_pt ? *x_pt : 0;
double y = y_pt ? *y_pt : 0;
......@@ -1740,7 +1778,8 @@ void odf_drawing_context::end_text_box()
end_element();
if (impl_->current_graphic_properties->content().svg_stroke_width_)
if (impl_->current_graphic_properties->content().svg_stroke_width_ ||
(impl_->current_graphic_properties->content().draw_stroke_ && impl_->current_graphic_properties->content().draw_stroke_->get_type() != line_style::None))
{
std::wstringstream ss;
ss << impl_->current_graphic_properties->content().svg_stroke_width_->get_length();
......@@ -1755,7 +1794,30 @@ void odf_drawing_context::end_text_box()
impl_->current_graphic_properties->content().common_border_attlist_.fo_border_ = ss.str();
}
if (impl_->current_graphic_properties->content().draw_shadow_)
{
std::wstringstream shadow_style;
if (impl_->current_graphic_properties->content().draw_shadow_color_)
shadow_style << *impl_->current_graphic_properties->content().draw_shadow_color_;
else shadow_style << L"#000000";
shadow_style << L" ";
shadow_style << *impl_->current_graphic_properties->content().draw_shadow_offset_x_;
shadow_style << L" ";
shadow_style << *impl_->current_graphic_properties->content().draw_shadow_offset_y_;
impl_->current_graphic_properties->content().common_shadow_attlist_.style_shadow_ = shadow_style.str();
impl_->current_graphic_properties->content().draw_shadow_offset_x_ = boost::none;
impl_->current_graphic_properties->content().draw_shadow_offset_y_ = boost::none;
impl_->current_graphic_properties->content().draw_shadow_color_ = boost::none;
impl_->current_graphic_properties->content().draw_shadow_ = boost::none;
if (!impl_->current_graphic_properties->content().common_border_attlist_.fo_border_)
impl_->current_graphic_properties->content().common_border_attlist_.fo_border_ = std::wstring(L"#000000 solid 0.06pt");
}
end_frame();
}
void odf_drawing_context::end_object()
......
......@@ -107,7 +107,9 @@ public:
///////////////////////////////////////////////////////////////////////////////////////
void set_size( _CP_OPT(double) & width_pt, _CP_OPT(double) & height_pt);
void set_position(_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt);
void set_position_line(_CP_OPT(double) & x_pt, _CP_OPT(double) & y_pt, _CP_OPT(double) & x1_pt, _CP_OPT(double) & y1_pt);
void get_size( double & width_pt, double & height_pt);
......
......@@ -42,7 +42,11 @@ public:
void set_bullet_image_size(double size);
void set_bullet_image (std::wstring ref);
void set_bullet_char (std::wstring val);
void set_numeric_format (std::wstring val);
void set_start_number (int val);
void set_text_style_name(std::wstring val);
void end_style_level();
......
......@@ -85,6 +85,9 @@ void odf_style_context::add_style(office_element_ptr elm, bool automatic, bool r
style_state_list_.back()->set_automatic(automatic);
style_state_list_.back()->set_root(root);
style_family_counts_[(int)family]++;
}
void odf_style_context::create_default_style(style_family::type family)
......@@ -251,6 +254,24 @@ bool odf_style_context::find_odf_default_style_state(style_family::type family,
return false;
}
bool odf_style_context::find_odf_style_state(std::wstring style_name, style_family::type family, odf_style_state_ptr & state)
{
for (int i=0;i<style_state_list_.size(); i++)
{
if (style_state_list_[i]->odf_style_)
{
if (style_state_list_[i]->get_family_type() == family && style_state_list_[i]->get_name() == style_name)
{
state = style_state_list_[i];
return true;
}
}
}
return false;
}
bool odf_style_context::find_odf_style(std::wstring style_name, style_family::type family, style *& style_)
{
for (int i=0;i<style_state_list_.size(); i++)
......
......@@ -51,6 +51,7 @@ public:
bool find_odf_default_style_state(style_family::type family, odf_style_state_ptr & state);
bool find_odf_style(std::wstring style_name, style_family::type family, style *& style_);
bool find_odf_style_state(std::wstring style_name, style_family::type family, odf_style_state_ptr & state); // odf
odf_style_state_ptr last_state(style_family::type family = style_family::None);
......
......@@ -33,6 +33,10 @@ namespace odf {
{
default_style_->style_family_ = style_family(style_family_);
}
list_style_exist = false;
list_style_level = -1;
list_style_id = -1;
}
office_element_ptr & odf_style_state::get_office_element()
......@@ -125,7 +129,33 @@ void odf_style_state::set_conditional(bool val)
{
conditional_ = val;
}
//------------------------------------------------------------------------------------
bool odf_style_state::get_list_style_exist()
{
return list_style_exist;
}
int odf_style_state::get_list_style_level()
{
return list_style_level;
}
int odf_style_state::get_list_style_id()
{
return list_style_id;
}
void odf_style_state::set_list_style_exist(bool val)
{
list_style_exist = val;
}
void odf_style_state::set_list_style_level(int val)
{
list_style_level = val;
}
void odf_style_state::set_list_style_id(int val)
{
list_style_id = val;
}
//------------------------------------------------------------------------------------
void odf_style_state::apply_from(style* other_style)
{
if (other_style == NULL)return;
......
......@@ -71,7 +71,15 @@ public:
style_table_column_properties * get_table_column_properties() ;
style_chart_properties * get_chart_properties() ;
//style_drawing_page_properties* get_drawing_page_properties();
bool get_list_style_exist();
int get_list_style_level();
int get_list_style_id();
void set_list_style_exist(bool val);
void set_list_style_level(int val);
void set_list_style_id(int val);
private:
std::wstring odf_style_name_;
std::wstring oox_style_name_;
......@@ -92,6 +100,10 @@ private:
office_element_ptr odf_style_;
friend class odf_style_context;
bool list_style_exist;
int list_style_level;
int list_style_id;
};
......
......@@ -79,6 +79,7 @@ void graphic_format_properties::serialize(std::wostream & _Wostream ,const wchar
common_text_anchor_attlist_.serialize(CP_GET_XML_NODE());
common_border_attlist_.serialize(CP_GET_XML_NODE());
common_border_line_width_attlist_.serialize(CP_GET_XML_NODE());
common_shadow_attlist_.serialize(CP_GET_XML_NODE());
common_padding_attlist_.serialize(CP_GET_XML_NODE());
common_background_color_attlist_.serialize(CP_GET_XML_NODE());
}
......
......@@ -88,6 +88,8 @@ public:
common_border_attlist common_border_attlist_;
common_border_line_width_attlist common_border_line_width_attlist_;
common_shadow_attlist common_shadow_attlist_;
common_padding_attlist common_padding_attlist_;
common_background_color_attlist common_background_color_attlist_;
......
......@@ -177,6 +177,9 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style, bool group)
odf_context()->drawing_context()->set_size (width_pt, height_pt);
odf_context()->drawing_context()->set_position (x, y);
if (x && y)
odf_context()->drawing_context()->set_anchor(2);
}
//if (width_pt && height_pt)
......@@ -231,6 +234,19 @@ void OoxConverter::convert(OOX::Vml::CImageData *vml_image_data)
if (gain > 1)
odf_context()->drawing_context()->set_opacity(gain/1000.);
if (vml_image_data->m_oCropLeft.IsInit() || vml_image_data->m_oCropRight.IsInit()
|| vml_image_data->m_oCropTop.IsInit() || vml_image_data->m_oCropBottom.IsInit())
{
double l_pt = 0,t_pt =0 ,r_pt = 0, b_pt = 0;
if (vml_image_data->m_oCropLeft.IsInit()) l_pt = vml_image_data->m_oCropLeft->GetValue() * Width;
if (vml_image_data->m_oCropTop.IsInit()) t_pt = vml_image_data->m_oCropTop->GetValue() * Height;
if (vml_image_data->m_oCropRight.IsInit()) r_pt = vml_image_data->m_oCropRight->GetValue() * Width;
if (vml_image_data->m_oCropBottom.IsInit()) b_pt = vml_image_data->m_oCropBottom->GetValue()* Height;
odf_context()->drawing_context()->set_image_client_rect(l_pt ,t_pt ,r_pt, b_pt);
}
odf_context()->drawing_context()->end_bitmap_style();
odf_context()->drawing_context()->end_area_properties();
}
......@@ -270,6 +286,25 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
odf_context()->drawing_context()->set_opacity(100 - vml_fill->m_oOpacity2->GetValue() * 100);
}
if (vml_fill->m_rId.IsInit())
{
//bitmap fill
odf_context()->drawing_context()->start_bitmap_style();
{
double Width=0, Height = 0;
CString sID = vml_fill->m_rId->GetValue();
CString pathImage = find_link_by_id(sID,1);
if (pathImage.GetLength() > 0)
{
odf_context()->drawing_context()->set_bitmap_link(string2std_string(pathImage));
_gdi_graphics_::GetResolution(pathImage, Width, Height);
}
odf_context()->drawing_context()->set_image_style_repeat(1);
}
odf_context()->drawing_context()->end_bitmap_style();
}
odf_context()->drawing_context()->end_area_properties();
}
void OoxConverter::convert(OOX::Vml::CLine *vml_line)
......@@ -282,11 +317,10 @@ void OoxConverter::convert(OOX::Vml::CLine *vml_line)
_CP_OPT(double) x = vml_line->m_oFrom.GetX();
_CP_OPT(double) y = vml_line->m_oFrom.GetY();
_CP_OPT(double) width = (vml_line->m_oTo.GetX() - vml_line->m_oFrom.GetX());
_CP_OPT(double) height = (vml_line->m_oTo.GetY() - vml_line->m_oFrom.GetY());
_CP_OPT(double) x1 = vml_line->m_oTo.GetX();
_CP_OPT(double) y1 = vml_line->m_oTo.GetY();
odf_context()->drawing_context()->set_position(x, y);
odf_context()->drawing_context()->set_size(width, height);
odf_context()->drawing_context()->set_position_line(x, y, x1, y1);
odf_context()->drawing_context()->set_anchor(2);
......@@ -560,11 +594,13 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
{
if (vml_common->m_oStroked.IsInit() && vml_common->m_oStroked->GetValue() == SimpleTypes::booleanFalse)
odf_context()->drawing_context()->set_no_fill();
else if (vml_common->m_oStrokeWeight.IsInit() || (vml_common->m_oStroked.IsInit() && vml_common->m_oStroked->GetValue()))
else
{
if (vml_common->m_oStrokeWeight.IsInit())
odf_context()->drawing_context()->set_line_width(vml_common->m_oStrokeWeight->ToPoints());
if (vml_common->m_oStrokeWeight.IsInit() || (vml_common->m_oStroked.IsInit() && vml_common->m_oStroked->GetValue()))
{
if (vml_common->m_oStrokeWeight.IsInit())
odf_context()->drawing_context()->set_line_width(vml_common->m_oStrokeWeight->ToPoints());
}
if (vml_common->m_oStrokeColor.IsInit())
{
unsigned char ucA=0, ucR=0, ucG=0, ucB=0;
......
......@@ -176,6 +176,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Vml::CStroke *vml = static_cast<OOX::Vml::CStroke*>(oox_unknown);
convert(vml);
}break;
case OOX::et_v_shadow:
{
OOX::Vml::CShadow *vml = static_cast<OOX::Vml::CShadow*>(oox_unknown);
convert(vml);
}break;
case OOX::et_v_image:
{
OOX::Vml::CImage *vml = static_cast<OOX::Vml::CImage*>(oox_unknown);
......
......@@ -142,12 +142,12 @@ void DocxConverter::convertDocument()
odt_context->start_document();
convert_styles();
convert_lists_styles();
convert_styles();
if (UpdateProgress(300000))return;
convert_settings();
convert_settings();
convert_document();
......@@ -330,18 +330,41 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
if (oox_paragraph == NULL) return;
bool bStyled = false;
bool bListItemNeed = false;
bool bStartNewParagraph = !odt_context->text_context()->get_KeepNextParagraph();
bool list_present = false;
std::wstring list_style_name;
if(oox_paragraph->m_oParagraphProperty && oox_paragraph->m_oParagraphProperty->m_oNumPr.IsInit()
&& odt_context->text_context()->get_list_item_state() == false )
int list_level = -1;
int list_style_id = -1;
if(oox_paragraph->m_oParagraphProperty && odt_context->text_context()->get_list_item_state() == false)
{
bListItemNeed = true;
if (oox_paragraph->m_oParagraphProperty->m_oPStyle.IsInit() && oox_paragraph->m_oParagraphProperty->m_oPStyle->m_sVal.IsInit())
{
std::wstring style_name = string2std_string(*oox_paragraph->m_oParagraphProperty->m_oPStyle->m_sVal);
odf::odf_style_state_ptr style_state;
if (odt_context->styles_context()->find_odf_style_state(style_name,odf::style_family::Paragraph, style_state) && style_state)
{
list_present = style_state->get_list_style_exist();
list_level = style_state->get_list_style_level();
list_style_id = style_state->get_list_style_id();
}
}
if (oox_paragraph->m_oParagraphProperty->m_oNumPr.IsInit())
{
list_present = true;
if (oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl.IsInit() && oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal.IsInit())
list_level = oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal->GetValue();
if (oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID.IsInit() && oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal.IsInit())
list_style_id = oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal->GetValue();
}
}
if (oox_paragraph->m_oParagraphProperty || odt_context->is_empty_section())
if (oox_paragraph->m_oParagraphProperty || odt_context->is_empty_section())
{
bStyled = true;
odf::style_paragraph_properties *paragraph_properties = NULL;
......@@ -357,13 +380,10 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
odt_context->styles_context()->create_style(L"",odf::style_family::Paragraph, true, false, -1);
paragraph_properties = odt_context->styles_context()->last_state()->get_paragraph_properties();
if(bListItemNeed)
if(list_present && list_style_id >= 0)
{
if (oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID.IsInit() && oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal.IsInit())
{
list_style_name = odt_context->styles_context()->lists_styles().get_style_name(oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oNumID->m_oVal->GetValue());
odt_context->styles_context()->last_state()->set_list_style_name(list_style_name);
}
list_style_name = odt_context->styles_context()->lists_styles().get_style_name(list_style_id);
odt_context->styles_context()->last_state()->set_list_style_name(list_style_name);
}
}
convert(oox_paragraph->m_oParagraphProperty, paragraph_properties);
......@@ -375,16 +395,12 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
// - - !!!
}
if(bListItemNeed)
if(list_present)
{
int level = 0;
if (oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl.IsInit() && oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal.IsInit())
level = oox_paragraph->m_oParagraphProperty->m_oNumPr->m_oIlvl->m_oVal->GetValue();
odt_context->start_list_item(level, list_style_name);
odt_context->start_list_item(list_level, list_style_name);
}
if ((bListItemNeed = 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);
......@@ -406,12 +422,10 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
if (!odt_context->text_context()->get_KeepNextParagraph()) odt_context->end_paragraph();
if(bListItemNeed && !odt_context->text_context()->get_KeepNextParagraph())
if(list_present && !odt_context->text_context()->get_KeepNextParagraph())
{
odt_context->end_list_item();
}
else
bListItemNeed = bListItemNeed;
}
void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87 math 17.3.2.25
{
......@@ -605,7 +619,7 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
{
outline_level = *parent_paragraph_properties.content().outline_level_;
}
// ???
// ??? :( - +
}
if (oox_paragraph_pr->m_oSpacing.IsInit())
......@@ -857,7 +871,7 @@ void DocxConverter::apply_from(OOX::Logic::CSectionProperty *props, OOX::Logic::
props->m_arrHeaderReference[i] = NULL;
}
props->m_arrHeaderReference.clear();
props->m_arrHeaderReference = other->m_arrHeaderReference;
for (unsigned int i =0 ; i < other->m_arrHeaderReference.size() ; i++)
{
ComplexTypes::Word::CHdrFtrRef* ref = new ComplexTypes::Word::CHdrFtrRef();
......@@ -2762,9 +2776,12 @@ void DocxConverter::convert(OOX::Numbering::CLvl* oox_num_lvl)
if (oox_num_lvl->m_oSuffix.IsInit())
{
}
if (oox_num_lvl->m_oLvlText.IsInit() && oox_num_lvl->m_oLvlText->m_sVal.IsInit() && type_list == 2 )
if (oox_num_lvl->m_oLvlText.IsInit() && oox_num_lvl->m_oLvlText->m_sVal.IsInit())
{
odt_context->styles_context()->lists_styles().set_bullet_char(string2std_string(oox_num_lvl->m_oLvlText->m_sVal.get()));
if (type_list == 2)
odt_context->styles_context()->lists_styles().set_bullet_char(string2std_string(oox_num_lvl->m_oLvlText->m_sVal.get()));
else if (type_list == 1)
odt_context->styles_context()->lists_styles().set_numeric_format(string2std_string(oox_num_lvl->m_oLvlText->m_sVal.get()));
}
if (oox_num_lvl->m_oLvlPicBulletId.IsInit() && oox_num_lvl->m_oLvlPicBulletId->m_oVal.IsInit())
{
......@@ -2962,6 +2979,24 @@ void DocxConverter::convert(OOX::CStyle *oox_style)
}
convert(oox_style->m_oParPr.GetPointer(), paragraph_properties);
if (oox_style->m_oParPr->m_oNumPr.IsInit())
{
int level = (oox_style->m_oParPr->m_oNumPr->m_oIlvl.IsInit() && oox_style->m_oParPr->m_oNumPr->m_oIlvl->m_oVal.IsInit()) ?
oox_style->m_oParPr->m_oNumPr->m_oIlvl->m_oVal->GetValue() : -1;
int id = (oox_style->m_oParPr->m_oNumPr->m_oNumID.IsInit() && oox_style->m_oParPr->m_oNumPr->m_oNumID->m_oVal.IsInit()) ?
oox_style->m_oParPr->m_oNumPr->m_oNumID->m_oVal->GetValue() : -1;
if (level<0 && id >=0) level =0;
if (level >=0 && id >=0)
{
odt_context->styles_context()->last_state()->set_list_style_level(level);
odt_context->styles_context()->last_state()->set_list_style_id(id);
odt_context->styles_context()->last_state()->set_list_style_exist(true);
std::wstring list_style_name = odt_context->styles_context()->lists_styles().get_style_name(id);
odt_context->styles_context()->last_state()->set_list_style_name(list_style_name); }
}
}
if (oox_style->m_oBasedOn.IsInit() && oox_style->m_oBasedOn->m_sVal.IsInit())
odt_context->styles_context()->last_state()->set_parent_style_name(string2std_string(*oox_style->m_oBasedOn->m_sVal));
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//150
#define INTVER 1,2,0,150
#define STRVER "1,2,0,150\0"
//151
#define INTVER 1,2,0,151
#define STRVER "1,2,0,151\0"
......@@ -2565,7 +2565,13 @@ namespace SimpleTypes
m_sValue = sValue.Mid( 0, 6 );
Parse();
}
else this->m_eValue = eDefValue;
else if ( 3 == sValue.GetLength() )// a la #339 (Compo 3AP.docx)
{
this->m_eValue = hexcolorRGB;
m_sValue = sValue;
Parse3();
}
else this->m_eValue = eDefValue;
}
return this->m_eValue;
......@@ -2640,7 +2646,15 @@ namespace SimpleTypes
m_unG = HexToInt( (int)m_sValue[3] ) + (unsigned char)(HexToInt( (int)m_sValue[2] ) << 4);
m_unB = HexToInt( (int)m_sValue[5] ) + (unsigned char)(HexToInt( (int)m_sValue[4] ) << 4);
}
void Parse3()
{
if ( m_sValue.GetLength() < 3 )
return;
m_unR = HexToInt( (int)m_sValue[0] ) + (unsigned char)(HexToInt( (int)m_sValue[0]) << 4);
m_unG = HexToInt( (int)m_sValue[1] ) + (unsigned char)(HexToInt( (int)m_sValue[1]) << 4);
m_unB = HexToInt( (int)m_sValue[2] ) + (unsigned char)(HexToInt( (int)m_sValue[2]) << 4);
}
int HexToInt(int nHex)
{
if ( nHex >= '0' && nHex <= '9' ) return (nHex - '0');
......
......@@ -1169,17 +1169,10 @@ namespace OOX
if ( _T("") != m_sSrc )
sResult += _T("src=\"") + m_sSrc + _T("\" ");
if ( 0 != m_oCropLeft.GetValue() )
sResult += _T("cropleft=\"") + m_oCropLeft.ToString() + _T("\" ");
if ( 0 != m_oCropTop.GetValue() )
sResult += _T("croptop=\"") + m_oCropTop.ToString() + _T("\" ");
if ( 0 != m_oCropRight.GetValue() )
sResult += _T("cropright=\"") + m_oCropRight.ToString() + _T("\" ");
if ( 0 != m_oCropBottom.GetValue() )
sResult += _T("cropbottom=\"") + m_oCropBottom.ToString() + _T("\" ");
ComplexTypes_WriteAttribute( _T("cropleft=\""), m_oCropLeft);
ComplexTypes_WriteAttribute( _T("croptop=\""), m_oCropTop);
ComplexTypes_WriteAttribute( _T("cropright=\""), m_oCropRight);
ComplexTypes_WriteAttribute( _T("cropbottom=\""), m_oCropBottom);
if ( 1 != m_oGain.GetValue() )
sResult += _T("gain=\"") + m_oGain.ToString() + _T("\" ");
......@@ -1226,10 +1219,6 @@ namespace OOX
{
//
m_oBlackLevel.SetValue( 0.0 );
m_oCropLeft.SetValue( 0.0 );
m_oCropRight.SetValue( 0.0 );
m_oCropBottom.SetValue( 0.0 );
m_oCropTop.SetValue( 0.0 );
m_oGain.SetValue( 1.0 );
m_oGamma.SetValue( 1.0 );
......@@ -1331,10 +1320,10 @@ namespace OOX
SimpleTypes::CTrueFalse<SimpleTypes::booleanFalse> m_oBiLevel;
SimpleTypes::CDouble m_oBlackLevel;
nullable<SimpleTypes::CColorType<>> m_oChromaKey;
SimpleTypes::Vml::CVml_1_65536 m_oCropLeft;
SimpleTypes::Vml::CVml_1_65536 m_oCropTop;
SimpleTypes::Vml::CVml_1_65536 m_oCropRight;
SimpleTypes::Vml::CVml_1_65536 m_oCropBottom;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropLeft;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropTop;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropRight;
nullable<SimpleTypes::Vml::CVml_1_65536> m_oCropBottom;
nullable<SimpleTypes::CTrueFalse<>> m_oDetectMouseClick;
nullable<SimpleTypes::CColorType<>> m_oEmbossColor;
SimpleTypes::CDouble m_oGain;
......
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