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

......

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57644 954022d7-b5bf-4e40-9824-e11837661b57
parent b12fc503
......@@ -204,7 +204,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; &quot;../../Redist&quot;"
CommandLine="regsvr32 /s /c &quot;$(TargetPath)&quot;&#x0D;&#x0A;copy &quot;$(TargetPath)&quot; &quot;../Redist&quot;"
/>
</Configuration>
</Configurations>
......
......@@ -174,7 +174,8 @@ std::wstring odf_conversion_context::get_next_name_object()
void odf_conversion_context::process_styles(_object & object, bool isRoot)
{
create_element(L"office", L"styles", object.styles, this,true);//îáùèå ñòèëè
object.style_context->process_office(object.styles.back());
object.style_context->process_office_styles(object.styles.back());
page_layout_context()->process_office_styles(object.styles.back());
if (isRoot)
{
......@@ -191,7 +192,7 @@ void odf_conversion_context::process_styles(_object & object, bool isRoot)
}
create_element(L"office", L"automatic-styles", object.content_styles, this,true);
object.style_context->process_automatic(object.content_styles.back());
object.style_context->process_automatic_styles(object.content_styles.back());
}
......
......@@ -533,13 +533,20 @@ void odf_drawing_context::start_shape(int type)
}
else if (type == 2000)
{
impl_->create_draw_base(10);//text-box
start_text_box();
}
else if (type == 3000)
{
start_image(L"");
}
}
void odf_drawing_context::end_shape()
{
if (impl_->current_drawing_state_.elements_.size() < 1)
return;
if (impl_->current_drawing_state_.oox_shape_preset == 2000) return end_text_box();
if (impl_->current_drawing_state_.oox_shape_preset == 3000) return end_image();
//,
draw_path* path = dynamic_cast<draw_path*>(impl_->current_drawing_state_.elements_[0].elm.get());
......@@ -595,7 +602,7 @@ void odf_drawing_context::end_shape()
{
sub_type = Shape_Types_Mapping[impl_->current_drawing_state_.oox_shape_preset].first;
}
else
else //if (impl_->current_drawing_state_.oox_shape_preset != 2000)// 3000 -
{
sub_type = L"polyline";
}
......@@ -928,9 +935,9 @@ void odf_drawing_context::set_vertical_rel(int from)
switch(from)
{
case 0: type = vertical_rel::Baseline; break;// relfromvBottomMargin ???
case 1: type = vertical_rel::Baseline; break;// relfromvInsideMargin ???
case 1: type = vertical_rel::PageContent; break;// relfromvInsideMargin ???
case 2: type = vertical_rel::Line; break;// relfromvLine
case 3: type = vertical_rel::Baseline; break;// relfromvMargin ???
case 3: type = vertical_rel::PageContent; break;// relfromvMargin
case 4: type = vertical_rel::Baseline; break;// relfromvOutsideMargin ???
case 5: type = vertical_rel::Page;
impl_->anchor_settings_.anchor_type_ = anchor_type(anchor_type::Page);
......@@ -942,7 +949,9 @@ void odf_drawing_context::set_vertical_rel(int from)
}
impl_->anchor_settings_.style_vertical_rel_ = vertical_rel(type);
impl_->anchor_settings_.style_vertical_pos_ = vertical_pos(vertical_pos::FromTop);//default
if (!impl_->anchor_settings_.style_vertical_pos_)//default
impl_->anchor_settings_.style_vertical_pos_ = vertical_pos(vertical_pos::FromTop);
}
void odf_drawing_context::set_vertical_pos(int align)
......@@ -978,9 +987,10 @@ void odf_drawing_context::set_horizontal_rel(int from)
case 6: type = horizontal_rel::Page; break; // relfromhPage = 6, ???
case 7: type = horizontal_rel::PageEndMargin; break; // relfromhRightMargin = 7
}
impl_->anchor_settings_.style_horizontal_rel_ = horizontal_rel(type);
impl_->anchor_settings_.style_horizontal_pos_ = horizontal_pos(horizontal_pos::FromLeft);//default
if (!impl_->anchor_settings_.style_horizontal_pos_) //default
impl_->anchor_settings_.style_horizontal_pos_ = horizontal_pos(horizontal_pos::FromLeft);
}
void odf_drawing_context::set_horizontal_pos(int align)
{
......@@ -1362,8 +1372,10 @@ 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 path)
{
impl_->current_drawing_state_.oox_shape_preset = 3000;
start_frame();
// Frame - :(
......@@ -1379,11 +1391,12 @@ void odf_drawing_context::start_image(std::wstring & path)
draw_image* image = dynamic_cast<draw_image*>(image_elm.get());
if (image == NULL)return;
image->common_xlink_attlist_.href_= path;
image->common_xlink_attlist_.type_= xlink_type::Simple;
image->common_xlink_attlist_.show_ = xlink_show::Embed;
image->common_xlink_attlist_.actuate_= xlink_actuate::OnLoad;
if (path.length() >0) image->common_xlink_attlist_.href_= path; //may be later set
start_element(image_elm);
set_image_style_repeat(1);//default
......@@ -1408,6 +1421,8 @@ void odf_drawing_context::start_object(std::wstring name)
void odf_drawing_context::start_text_box()
{
impl_->current_drawing_state_.oox_shape_preset = 2000;
start_frame();
// Frame - :(
......@@ -1941,6 +1956,8 @@ void odf_drawing_context::end_hatch_style()
void odf_drawing_context::start_bitmap_style()
{
if (impl_->current_drawing_state_.oox_shape_preset == 3000) return;
odf::office_element_ptr fill_image_element;
odf::create_element(L"draw",L"fill-image", fill_image_element, impl_->odf_context_);
......@@ -1949,8 +1966,11 @@ void odf_drawing_context::start_bitmap_style()
draw_fill_image * fill_image = dynamic_cast<draw_fill_image *>(fill_image_element.get());
if (!fill_image) return;
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_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->xlink_attlist_.type_ = xlink_type::Simple;
fill_image->xlink_attlist_.show_ = xlink_show::Embed;
fill_image->xlink_attlist_.actuate_ = xlink_actuate::OnLoad;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_image_name_ = fill_image->draw_name_;
impl_->current_graphic_properties->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::bitmap);
......@@ -2012,19 +2032,30 @@ void odf_drawing_context::set_image_client_rect(double l_pt, double t_pt, double
impl_->current_graphic_properties->content().fo_clip_ = str_stream.str();
}
void odf_drawing_context::set_bitmap_link(std::wstring link)
void odf_drawing_context::set_bitmap_link(std::wstring file_path)
{
std::wstring odf_ref_name ;
impl_->odf_context_->mediaitems()->add_or_find(link,_mediaitems::typeImage,odf_ref_name);
std::wstring odf_ref_name ;
impl_->odf_context_->mediaitems()->add_or_find(file_path,_mediaitems::typeImage,odf_ref_name);
draw_fill_image * fill_image = dynamic_cast<draw_fill_image *>(impl_->styles_context_->last_state()->get_office_element().get());
if (!fill_image) return;
fill_image->xlink_attlist_.href_= odf_ref_name;
//fill_image->xlink_attlist_.type_= xlink_type::Simple;
fill_image->xlink_attlist_.show_ = xlink_show::Embed;
fill_image->xlink_attlist_.actuate_= xlink_actuate::OnLoad;
if (impl_->current_drawing_state_.oox_shape_preset == 3000)
{
if (impl_->current_level_.size() < 1) return;
draw_image* image = dynamic_cast<draw_image*>(impl_->current_level_.back().get());
if (image == NULL)return;
image->common_xlink_attlist_.href_= odf_ref_name;
//backgroud image
//set_anchor(anchor_type::Char);
//set_overlap(true);
}
else
{
draw_fill_image * fill_image = dynamic_cast<draw_fill_image *>(impl_->styles_context_->last_state()->get_office_element().get());
if (!fill_image) return;
fill_image->xlink_attlist_.href_= odf_ref_name;
}
}
void odf_drawing_context::set_bitmap_tile_scale_x(double scale_x)
{
......
......@@ -70,7 +70,7 @@ public:
void start_shape(int type);
void end_shape();
void start_image(std::wstring & path);
void start_image(std::wstring file_path);
void end_image();
void start_text_box();
......
......@@ -80,7 +80,11 @@ void odf_page_layout_context::process_master_styles(office_element_ptr root )
void odf_page_layout_context::process_automatic_for_styles(office_element_ptr root )
{
local_style_context_->process_automatic(root);
local_style_context_->process_automatic_styles(root);
}
void odf_page_layout_context::process_office_styles(office_element_ptr root )
{
local_style_context_->process_office_styles(root);
}
void odf_page_layout_context::set_current_master_page_base()
......@@ -180,7 +184,10 @@ void odf_page_layout_context::set_footer_size(_CP_OPT(length) length_)//
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_bottom_ = length_;
if (bottom_)
footer_props->style_header_footer_properties_attlist_.svg_height_ = bottom_.get() - length_.get();//fo_min_height_
{
double length_cm = bottom_->get_value_unit(length::cm) - length_->get_value_unit(length::cm);
footer_props->style_header_footer_properties_attlist_.svg_height_ = length(abs(length_cm),length::cm);//fo_min_height_
}
}
void odf_page_layout_context::set_header_size(_CP_OPT(length) length_)
{
......@@ -200,7 +207,10 @@ void odf_page_layout_context::set_header_size(_CP_OPT(length) length_)
props->style_page_layout_properties_attlist_.common_vertical_margin_attlist_.fo_margin_top_ = length_;
if (top_)
header_props->style_header_footer_properties_attlist_.svg_height_ = top_.get()- length_.get();//fo_min_height_
{
double length_cm = top_->get_value_unit(length::cm) - length_->get_value_unit(length::cm);
header_props->style_header_footer_properties_attlist_.svg_height_ = length(abs(length_cm),length::cm);//fo_min_height_
}
}
void odf_page_layout_context::set_background(_CP_OPT(color) & color, int type)
......
......@@ -36,6 +36,7 @@ public:
void process_master_styles (office_element_ptr root );
void process_automatic_for_styles (office_element_ptr root );
void process_office_styles (office_element_ptr root );//, , ...
odf_layout_state & last_layout();
odf_master_state & last_master();
......
......@@ -108,7 +108,7 @@ void odf_style_context::process_automatic_for_styles(office_element_ptr root )
root->add_child_element(style_state_list_[i]->odf_style_);
}
}
void odf_style_context::process_automatic(office_element_ptr root )
void odf_style_context::process_automatic_styles(office_element_ptr root )
{//
for (long i =0; i < style_state_list_.size(); i++)
{
......@@ -119,7 +119,7 @@ void odf_style_context::process_automatic(office_element_ptr root )
}
}
void odf_style_context::process_office(office_element_ptr root )
void odf_style_context::process_office_styles(office_element_ptr root )
{
number_styles_context_.process_styles(root );
......
......@@ -34,9 +34,9 @@ public:
office_element_ptr & add_or_find(std::wstring name, style_family::type family, bool automatic = false, bool root = false, int id = -1);
void process_automatic_for_styles(office_element_ptr root );
void process_automatic(office_element_ptr root );
void process_office(office_element_ptr root );
void process_automatic_for_styles (office_element_ptr root );
void process_automatic_styles (office_element_ptr root );
void process_office_styles (office_element_ptr root );
void reset_defaults();
void add_default(odf_style_state_ptr & state) {current_default_styles_.push_back(state);}
......
......@@ -97,6 +97,47 @@ void OoxConverter::convert(SimpleTypes::Vml::CCssStyle *vml_style)
case SimpleTypes::Vml::cssptMarginTop:
odf_context()->drawing_context()->set_margin_top(vml_style->m_arrProperties[i].get_Value().oValue.dValue);
break;
////////////////////////////////////////////////////////////////
case SimpleTypes::Vml::cssptMsoPositionHorizontal:
switch(vml_style->m_arrProperties[i].get_Value().eMsoPosHor)
{
case SimpleTypes::Vml::cssmsoposhorAbsolute: odf_context()->drawing_context()->set_horizontal_pos(2); break;
case SimpleTypes::Vml::cssmsoposhorLeft: odf_context()->drawing_context()->set_horizontal_pos(2); break;
case SimpleTypes::Vml::cssmsoposhorCenter: odf_context()->drawing_context()->set_horizontal_pos(0); break;
case SimpleTypes::Vml::cssmsoposhorRight: odf_context()->drawing_context()->set_horizontal_pos(4); break;
case SimpleTypes::Vml::cssmsoposhorInside: odf_context()->drawing_context()->set_horizontal_pos(1); break;
case SimpleTypes::Vml::cssmsoposhorOutside : odf_context()->drawing_context()->set_horizontal_pos(3); break;
}
break;
case SimpleTypes::Vml::cssptMsoPositionHorizontalRelative:
switch(vml_style->m_arrProperties[i].get_Value().eMsoPosHorRel)
{
case SimpleTypes::Vml::cssmsoposhorrelMargin: odf_context()->drawing_context()->set_horizontal_rel(2); break;
case SimpleTypes::Vml::cssmsoposhorrelPage: odf_context()->drawing_context()->set_horizontal_rel(6); break;
case SimpleTypes::Vml::cssmsoposhorrelText: odf_context()->drawing_context()->set_horizontal_rel(1); break;
case SimpleTypes::Vml::cssmsoposhorrelChar: odf_context()->drawing_context()->set_horizontal_rel(0); break;
}
break;
case SimpleTypes::Vml::cssptMsoPositionVertical:
switch(vml_style->m_arrProperties[i].get_Value().eMsoPosVer)
{
case SimpleTypes::Vml::cssmsoposverAbsolute: odf_context()->drawing_context()->set_vertical_pos(2); break;
case SimpleTypes::Vml::cssmsoposverTop: odf_context()->drawing_context()->set_vertical_pos(4); break;
case SimpleTypes::Vml::cssmsoposverCenter: odf_context()->drawing_context()->set_vertical_pos(1); break;
case SimpleTypes::Vml::cssmsoposverBottom: odf_context()->drawing_context()->set_vertical_pos(0); break;
case SimpleTypes::Vml::cssmsoposverInside: odf_context()->drawing_context()->set_vertical_pos(2); break;//??
case SimpleTypes::Vml::cssmsoposverOutside: odf_context()->drawing_context()->set_vertical_pos(3); break;//??
}
break;
case SimpleTypes::Vml::cssptMsoPositionVerticalRelative:
switch(vml_style->m_arrProperties[i].get_Value().eMsoPosVerRel)
{
case SimpleTypes::Vml::cssmsoposverrelMargin: odf_context()->drawing_context()->set_vertical_rel(3); break;
case SimpleTypes::Vml::cssmsoposverrelPage: odf_context()->drawing_context()->set_vertical_rel(5); break;
case SimpleTypes::Vml::cssmsoposverrelText: odf_context()->drawing_context()->set_vertical_rel(6); break;
case SimpleTypes::Vml::cssmsoposverrelLine: odf_context()->drawing_context()->set_vertical_rel(2); break;
}
break;
}
}
odf_context()->drawing_context()->set_drawings_rect(x, y, width_pt, height_pt);
......@@ -105,6 +146,11 @@ void OoxConverter::convert(OOX::Vml::CShape *vml_shape)
{
if (vml_shape == NULL) return;
if (vml_shape->m_oAllowInCell.GetValue())
{
}
odf_context()->drawing_context()->set_overlap(vml_shape->m_oAllowOverlap.GetValue());
for (long i=0 ; i < vml_shape->m_arrItems.GetSize();i++)
{
convert(vml_shape->m_arrItems[i]);
......@@ -127,6 +173,7 @@ void OoxConverter::convert(OOX::Vml::CImageData *vml_image_data)
pathImage = find_link_by_id(sID,1);
}
// - drawing_context
if (pathImage.GetLength() < 1)return;
_gdi_graphics_::GetResolution(pathImage, Width, Height);
......@@ -136,6 +183,10 @@ void OoxConverter::convert(OOX::Vml::CImageData *vml_image_data)
odf_context()->drawing_context()->set_bitmap_link(string2std_string(pathImage));
odf_context()->drawing_context()->set_image_style_repeat(1);//stretch
double gain = vml_image_data->m_oGain.GetValue();
if (gain > 1)
odf_context()->drawing_context()->set_opacity(gain/1000.);
odf_context()->drawing_context()->end_bitmap_style();
odf_context()->drawing_context()->end_area_properies();
}
......
......@@ -643,7 +643,7 @@ void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cp
void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool root)
{
if (oox_section_pr == NULL) return;
bool continuous = false;
if (oox_section_pr->m_oType.IsInit() && oox_section_pr->m_oType->m_oVal.IsInit())
......@@ -1369,10 +1369,8 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
if (oox_pic == NULL) return;
odt_context->start_drawings();
odt_context->drawing_context()->set_anchor(odf::anchor_type::AsChar); //???
//odt_context->drawing_context()->set_overlap(true);
//odt_context->drawing_context()->set_wrap_style(odf::style_wrap::Dynamic);
int type = 1; // shape .. default
if (oox_pic->m_oShapeGroup.IsInit())
{
OoxConverter::convert(oox_pic->m_oShapeGroup.GetPointer());
......@@ -1440,6 +1438,7 @@ void DocxConverter::convert(OOX::Logic::CPicture* oox_pic)
else if (oox_pic->m_oShapeType.IsInit())
{
OOX::Vml::SptType sptType = static_cast<OOX::Vml::SptType>(oox_pic->m_oShapeType->m_oSpt.GetValue());
odf_context()->drawing_context()->start_shape(OOX::Spt2ShapeType(sptType));
OoxConverter::convert(oox_pic->m_oShape.GetPointer());
......
......@@ -2,6 +2,6 @@
//1
//2
//0
//116
#define INTVER 1,2,0,116
#define STRVER "1,2,0,116\0"
//117
#define INTVER 1,2,0,117
#define STRVER "1,2,0,117\0"
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