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

расширение вложенности объектов друг в друга ( до бесконечности )

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57115 954022d7-b5bf-4e40-9824-e11837661b57
parent b2d9d7e2
......@@ -547,6 +547,16 @@ void odf_chart_context::add_axis_group_series(unsigned int id)
}
void odf_chart_context::end_group_series()
{
if (impl_->axis_.size() < 1 && impl_->categories_.size() > 0)
{// MS Office !!! - MS
start_axis();
set_axis_dimension(1);
end_element();
start_axis();
set_axis_dimension(2);
end_element();
}
std::wstring axis_name;
bool presentZ = false;
......@@ -739,13 +749,6 @@ void odf_chart_context::start_plot_area()
}
void odf_chart_context::end_plot_area()
{
if (impl_->axis_.size() < 1 && impl_->categories_.size() > 0)
{
start_axis();
set_axis_dimension(1);
//set_axis_type();
end_element();
}
chart_plot_area *plot_area = dynamic_cast<chart_plot_area*>(impl_->current_level_.back().elm.get());
if (plot_area)
{
......@@ -999,6 +1002,7 @@ void odf_chart_context::set_legend_position(int val)
case 3: legend->chart_legend_attlist_.chart_legend_position_ = L"end"; break;//st_legendposR
case 4: legend->chart_legend_attlist_.chart_legend_position_ = L"top"; break;//st_legendposT
}
legend->chart_legend_attlist_.chart_legend_align_ = L"center";
}
void odf_chart_context::set_layout_x(double *val,int mode)//edge, factor
{
......@@ -1057,12 +1061,12 @@ void odf_chart_context::set_axis_dimension(int type)
if (type == 3) val = L"z";
axis->chart_axis_attlist_.chart_dimension_ = val;
axis->chart_axis_attlist_.chart_name_ = std::wstring(L"axis-") + boost::lexical_cast<std::wstring>(impl_->axis_.size()+1);
//axis->chart_axis_attlist_.chart_name_ = std::wstring(L"axis-") + boost::lexical_cast<std::wstring>(impl_->axis_.size()+1);
if (impl_->axis_.size()>0)
{
impl_->axis_.back().dimension = type;
impl_->axis_.back().name = *axis->chart_axis_attlist_.chart_name_;
//impl_->axis_.back().name = *axis->chart_axis_attlist_.chart_name_;
}
}
void odf_chart_context::set_axis_position(int type)
......@@ -1206,11 +1210,11 @@ void odf_chart_context::end_chart()
}
else
{
//if (i==0)
//{
// chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_[i].elm.get());
// axis->chart_axis_attlist_.chart_dimension_ = L"x";
//}
if (i==0)
{
chart_axis *axis = dynamic_cast<chart_axis*>(impl_->axis_[i].elm.get());
axis->chart_axis_attlist_.chart_dimension_ = L"x";
}
}
}
///////////////
......
......@@ -348,7 +348,7 @@ void odf_drawing_context::end_drawing()
draw->common_draw_attlists_.shape_with_text_and_styles_.common_draw_shape_with_styles_attlist_.common_draw_z_index_attlist_.draw_z_index_ = impl_->current_drawing_state_.z_order_;
std::wstring strTransform;
if (impl_->current_drawing_state_.in_group)
if (impl_->current_drawing_state_.in_group && impl_->group_list_.size()>0)
{
double rotate = impl_->group_list_.back().rotate;
if (impl_->current_drawing_state_.rotateAngle )
......@@ -523,6 +523,8 @@ void odf_drawing_context::start_shape(int type)
}
void odf_drawing_context::end_shape()
{
if (impl_->current_drawing_state_.elements_.size() < 1)
return;
//,
draw_path* path = dynamic_cast<draw_path*>(impl_->current_drawing_state_.elements_[0].elm.get());
......@@ -914,6 +916,8 @@ void odf_drawing_context::set_wrap_style(style_wrap::type type)
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void odf_drawing_context::set_position(double x_pt, double y_pt)
{
if (impl_->group_list_.size() < 1)return;
if (!impl_->current_drawing_state_.svg_x_)
{
if (impl_->current_drawing_state_.in_group)
......
......@@ -98,9 +98,14 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
if (styled)
{
style_name = styles_context_->last_state().get_name();
style_elm = styles_context_->last_state().get_office_element();
odf_style_state *style_state = styles_context_->last_state(style_family::Paragraph);
if (style_state)
{
style_name = style_state->get_name();
style_elm = style_state->get_office_element();
}
text_p* p = dynamic_cast<text_p*>(elm.get());
if (p)p->paragraph_.paragraph_attrs_.text_style_name_ = style_ref(style_name);
......@@ -135,7 +140,7 @@ void odf_text_context::start_paragraph(office_element_ptr & elm, bool styled)
void odf_text_context::end_paragraph()
{
if (single_paragraph_ == false)
if (single_paragraph_ == false && current_level_.size() > 0)
{
current_level_.pop_back();
}
......@@ -175,9 +180,14 @@ void odf_text_context::start_span(bool styled)
if (styled)
{
style_name = styles_context_->last_state().get_name();
style_elm = styles_context_->last_state().get_office_element();
style * style_ = dynamic_cast<style*>(style_elm.get());
odf_style_state *style_state = styles_context_->last_state(style_family::Text);
if (style_state)
{
style_name = style_state->get_name();
style_elm = style_state->get_office_element();
}
style *style_ = dynamic_cast<style*>(style_elm.get());
text_span* span = dynamic_cast<text_span*>(span_elm.get());
if (span) span->text_style_name_ = style_ref(style_name);
......@@ -202,7 +212,8 @@ void odf_text_context::end_span()
{
if (styles_context_ == NULL || single_paragraph_)return;
current_level_.pop_back();
if (current_level_.size() > 0)
current_level_.pop_back();
}
void odf_text_context::add_textline_break()
{
......
......@@ -18,8 +18,7 @@ namespace cpdoccore {
namespace odf {
odt_conversion_context::odt_conversion_context(package::odf_document * outputDocument)
: odf_conversion_context(outputDocument), current_text_context_(NULL), page_layout_context_(this),
main_text_context_(NULL),drawing_context_(this),comment_context_(this)
: odf_conversion_context(outputDocument),comment_context_(this), page_layout_context_(this), main_text_context_(NULL)
{
current_field_.enabled = false;
current_field_.started = false;
......@@ -42,9 +41,7 @@ void odt_conversion_context::start_document()
//current_level_.push_back(get_current_object_element());
drawing_context_.set_styles_context(styles_context());
//////////////////íàñòðîéêè äåôîëòîâûå
/////////////////íàñòðîéêè äåôîëòîâûå
root_text_->office_text_attlist_.text_use_soft_page_breaks_ = true;
}
......@@ -70,7 +67,12 @@ void odt_conversion_context::end_document()
odf_drawing_context* odt_conversion_context::drawing_context()
{
return &drawing_context_;
if (drawing_context_.size() > 0)
{
return drawing_context_.back().get();
}
else
return NULL;
}
odf_comment_context* odt_conversion_context::comment_context()
{
......@@ -79,9 +81,9 @@ odf_comment_context* odt_conversion_context::comment_context()
odf_text_context* odt_conversion_context::text_context()
{
if (current_text_context_)
if (text_context_.size() > 0)
{
return current_text_context_;
return text_context_.back().get();
}
else
{
......@@ -90,14 +92,17 @@ odf_text_context* odt_conversion_context::text_context()
}
void odt_conversion_context::start_text_context()
{
current_text_context_ = new odf_text_context(this);
odf_text_context_ptr new_text_context_ = boost::shared_ptr<odf_text_context>(new odf_text_context(this));
if (!new_text_context_)return;
text_context_.push_back(new_text_context_);
}
void odt_conversion_context::end_text_context()
{
if (current_text_context_)
delete current_text_context_;
current_text_context_ = NULL;
if (text_context_.size() > 0)
{
text_context_.pop_back();
}
}
void odt_conversion_context::add_text_content(std::wstring & text)
{
......@@ -105,9 +110,17 @@ void odt_conversion_context::add_text_content(std::wstring & text)
}
void odt_conversion_context::start_drawings()
{
odf_drawing_context_ptr new_drawing_context_ = boost::shared_ptr<odf_drawing_context>(new odf_drawing_context(this));
if (!new_drawing_context_)return;
new_drawing_context_->set_styles_context(styles_context());
drawing_context_.push_back(new_drawing_context_);
}
void odt_conversion_context::end_drawings()
{
if (drawing_context_.size() < 1) return;
office_element_ptr & elm = drawing_context()->get_root_element();
if (elm )
{
......@@ -118,12 +131,14 @@ void odt_conversion_context::end_drawings()
}
//current_level_.back()->add_child_element(elm);
drawing_context()->clear();
drawing_context_.pop_back();
}
void odt_conversion_context::start_paragraph(bool styled)
{
text_context()->start_paragraph(styled);
if (current_text_context_ == NULL && !comment_context_.is_started())
if (text_context_.size() < 1 && !comment_context_.is_started())
{
office_element_ptr & paragr_elm = text_context()->current_level_.back();
//current_level_.back()->add_child_element(paragr_elm);
......@@ -280,13 +295,13 @@ void odt_conversion_context::end_paragraph()
}
void odt_conversion_context::start_run()
{
if (is_hyperlink_ && current_text_context_) return;
if (is_hyperlink_ && text_context_.size() > 0) return;
text_context()->start_span();
}
void odt_conversion_context::end_run()
{
if (is_hyperlink_ && current_text_context_) return;
if (is_hyperlink_ && text_context_.size() > 0) return;
text_context()->end_span();
......
......@@ -7,8 +7,12 @@ namespace cpdoccore {
namespace odf {
class office_text;
class odf_text_context;
typedef shared_ptr<odf_text_context>::Type odf_text_context_ptr;
typedef shared_ptr<odf_drawing_context>::Type odf_drawing_context_ptr;
struct odt_section_state
{
office_element_ptr elm;
......@@ -68,17 +72,12 @@ private:
office_text* root_text_;
office_element_ptr root_document_;
odf_page_layout_context page_layout_context_;
odf_drawing_context drawing_context_;
odf_page_layout_context page_layout_context_;
odf_comment_context comment_context_;
odf_text_context* current_text_context_;//for embedded
odf_text_context* main_text_context_;
//std::vector<office_element_ptr> current_level_;// ("0- - )
std::vector<odf_drawing_context_ptr> drawing_context_;
std::vector<odf_text_context_ptr> text_context_;//for embedded
std::vector<office_element_ptr> current_paragraphs_; // for section, if needed
std::vector<odt_section_state> sections_;
......
......@@ -16,6 +16,7 @@ namespace cpdoccore {
namespace odf {
class odf_text_context;
class paragraph_attrs
{
public:
......
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