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

всякие диаграммные мелочи

git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57172 954022d7-b5bf-4e40-9824-e11837661b57
parent d5894dfd
......@@ -1279,6 +1279,14 @@
RelativePath=".\OdfFormat\odf_drawing_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_table_context.cpp"
>
</File>
<File
RelativePath=".\OdfFormat\odf_table_context.h"
>
</File>
<File
RelativePath=".\OdfFormat\odf_text_context.cpp"
>
......
......@@ -269,6 +269,14 @@ void odf_chart_context::set_chart_bar_type(int type)
case 5: // st_shapePYRAMIDTOMAX = 5
impl_->current_level_.back().chart_properties_->content().chart_solid_type_ = chart_solid_type(chart_solid_type::pyramid); break;
}
if (type == -1)
{
// .
int sz = impl_->current_level_.size();
if (sz > 1)
impl_->current_level_.back().chart_properties_->content().chart_solid_type_ =
impl_->current_level_[sz-2].chart_properties_->content().chart_solid_type_;
}
}
void odf_chart_context::set_chart_bar_direction(int type)
......@@ -697,6 +705,7 @@ void odf_chart_context::start_grid(int type)
}
start_element(chart_elm, style_elm, style_name);
}
void odf_chart_context::start_title()
{
office_element_ptr chart_elm;
......@@ -819,6 +828,11 @@ void odf_chart_context::start_floor()
floor->common_attlist_.chart_style_name_ = style_name;
}
start_element(elm, style_elm, style_name);
if (style_)
{
impl_->current_level_.back().graphic_properties_ = style_->style_content_.get_style_graphic_properties();
}
}
void odf_chart_context::start_wall()
{
......@@ -1019,11 +1033,15 @@ void odf_chart_context::set_layout_x(double *val,int mode)//edge, factor
chart_title *title = dynamic_cast<chart_title*>(impl_->current_chart_state_.elements_.back().elm.get());
if (title)title->chart_title_attlist_.common_draw_position_attlist_.svg_x_ = x_cm;
}
void odf_chart_context::set_axis_label(int type)
void odf_chart_context::set_display_label(bool Val)
{
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_display_label_ = Val;
}
void odf_chart_context::set_display_label_position(int type)
{
if (!impl_->current_level_.back().chart_properties_)return;
if (type == 1 || type == 2)
impl_->current_level_.back().chart_properties_->content().chart_display_label_ = true;
//impl_->current_level_.back().chart_properties_->content().chart:label-arrangement_ = Val;
}
void odf_chart_context::set_axis_orientation(int type)
{
......@@ -1040,6 +1058,50 @@ void odf_chart_context::set_axis_min(double val)
if (!impl_->current_level_.back().chart_properties_)return;
impl_->current_level_.back().chart_properties_->content().chart_minimum_ = val;
}
void odf_chart_context::set_axis_tick_minor(int type)
{
if (!impl_->current_level_.back().chart_properties_)return;
switch (type)
{
case 0: break;// st_tickmarkCROSS = 0,
case 1: // st_tickmarkIN = 1,
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_inner_ = true;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_outer_ = false; break;
case 2: // st_tickmarkNONE = 2,
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_inner_ = false;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_outer_ = false; break;
case 3: // st_tickmarkOUT = 3
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_inner_ = false;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_minor_outer_ = true; break;
}
}
void odf_chart_context::set_no_fill(bool Val)
{
if (Val == false)return;
if (!impl_->current_level_.back().graphic_properties_)return;
impl_->current_level_.back().graphic_properties_->content().common_draw_fill_attlist_.draw_fill_ = draw_fill(draw_fill::none);
}
void odf_chart_context::set_axis_tick_major(int type)
{
if (!impl_->current_level_.back().chart_properties_)return;
switch (type)
{
case 0: break;// st_tickmarkCROSS = 0,
case 1: // st_tickmarkIN = 1,
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_inner_ = true;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_outer_ = false; break;
case 2: // st_tickmarkNONE = 2,
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_inner_ = false;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_outer_ = false; break;
case 3: // st_tickmarkOUT = 3
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_inner_ = false;
impl_->current_level_.back().chart_properties_->content().chart_tick_marks_major_outer_ = true; break;
}
}
void odf_chart_context::set_axis_logarithmic(bool val)
{
if (!impl_->current_level_.back().chart_properties_)return;
......@@ -1165,6 +1227,7 @@ void odf_chart_context::start_element(office_element_ptr & elm, office_element_p
void odf_chart_context::end_element()
{
//
//if (impl_->current_level_.size()>0)
{
if (impl_->current_level_.back().paragraph_properties_)
{
......@@ -1185,7 +1248,6 @@ void odf_chart_context::end_element()
}
}
}
impl_->current_level_.pop_back();
drawing_context()->end_element();
}
......@@ -1353,7 +1415,18 @@ void odf_chart_context::Impl::create_local_table()
std::wstring table_name = L"local-table";
int max_columns=0;
// ref
for (long i=0; i < cash_.size(); i++)
{
for (long j=i+1; j < cash_.size(); j++)
{
if (cash_[j].ref == cash_[i].ref)
{
cash_.erase(cash_.begin()+j);
}
}
}
for (long i=0; i < cash_.size(); i++)
{
std::vector<std::wstring> refs;
......@@ -1388,9 +1461,12 @@ void odf_chart_context::Impl::create_local_table()
c.row = (row2==row1) ? row1 : row1+j;
c.val = cash_[i].data_str[j];
c.label = cash_[i].label;
cells_cash.push_back(c);
if (c.label) cells_cash_label.push_back(c);
//else cells_cash.push_back(c);
if (c.col > max_columns) max_columns = c.col;
}
......@@ -1415,18 +1491,20 @@ void odf_chart_context::Impl::create_local_table()
table_state->set_table_name(table_name);
/////////////////////////////////////////////////
office_element_ptr col_elm;
create_element(L"table", L"table-column",col_elm, odf_context_);
office_element_ptr cols_header_elm;
create_element(L"table", L"table-header-columns",cols_header_elm, odf_context_);
table_elm->add_child_element(cols_header_elm);
cols_header_elm->add_child_element(col_elm);
office_element_ptr cols_elm;
create_element(L"table", L"table-columns",cols_elm, odf_context_);
table_elm->add_child_element(cols_elm);
office_element_ptr col_elm;
create_element(L"table", L"table-column",col_elm, odf_context_);
for (long i=0; i < max_columns; i++)
for (long i=0; i < max_columns-1; i++)
cols_elm->add_child_element(col_elm);
office_element_ptr row_headers_elm;
......
......@@ -78,17 +78,22 @@ public:
void set_axis_dimension(int type);
void set_axis_orientation(int type);
void set_axis_logarithmic(bool val);
void set_axis_label(int type);
void set_display_label(bool Val);
void set_display_label_position(int type);
void set_axis_position(int type);
void set_axis_label_position(int type);
void set_axis_max(double val);
void set_axis_min(double val);
void set_axis_tick_minor(int type);
void set_axis_tick_major(int type);
void start_title();
void start_grid(int type);
void start_legend();
void start_floor();
void start_wall();
void set_legend_position(int val);
void set_no_fill(bool val);
void start_stock_gain_marker();
void set_stock_gain_marker_width(std::wstring val);
......
......@@ -5,9 +5,6 @@
#include <cpdoccore/CPOptional.h>
//#include "ods_comments_context.h"
//#include "ods_hyperlinks.h"
#include "office_elements.h"
#include "office_elements_create.h"
......
......@@ -208,7 +208,6 @@ void ods_conversion_context::set_comment_rect(double l, double t, double w, doub
{
current_table().set_comment_rect(l,t,w,h);
}
/////////////////////////////
void ods_conversion_context::add_hyperlink(std::wstring & ref, std::wstring & link, std::wstring & display)
{
......
......@@ -36,7 +36,7 @@ double calculate_size_font_symbols(std::wstring str_test, std::wstring font_name
}
}
odt_conversion_context::odt_conversion_context(package::odf_document * outputDocument)
: odf_conversion_context(outputDocument),comment_context_(this), page_layout_context_(this), main_text_context_(NULL)
: odf_conversion_context(outputDocument),comment_context_(this), page_layout_context_(this), main_text_context_(NULL),table_context_(this)
{
current_field_.enabled = false;
current_field_.started = false;
......@@ -458,6 +458,34 @@ void odt_conversion_context::end_drop_cap()
drop_cap_state_.clear();
}
///////////////////////////////////////
void odt_conversion_context::start_table()
{
}
void odt_conversion_context::start_table_columns()
{
}
void odt_conversion_context::add_table_column()
{
}
void odt_conversion_context::end_table_columns()
{
}
void odt_conversion_context::start_table_row()
{
}
void odt_conversion_context::start_table_cell()
{
}
void odt_conversion_context::end_table_cell()
{
}
void odt_conversion_context::end_table_row()
{
}
void odt_conversion_context::end_table()
{
}
}
}
#pragma once
#include "odf_conversion_context.h"
#include "odf_comment_context.h"
#include "odf_table_context.h"
namespace cpdoccore {
namespace odf {
......@@ -73,6 +75,16 @@ public:
void start_comment_content();
void end_comment_content();
void start_table();
void start_table_columns();
void add_table_column();
void end_table_columns();
void start_table_row();
void start_table_cell();
void end_table_cell();
void end_table_row();
void end_table();
private:
office_text* root_text_;
office_element_ptr root_document_;
......@@ -87,6 +99,8 @@ private:
std::vector<office_element_ptr> current_paragraphs_; // for section, if needed
std::vector<odt_section_state> sections_;
odf_table_context table_context_;
struct _field_state
{
bool enabled;
......
......@@ -30,6 +30,7 @@ void chart_format_properties::serialize(std::wostream & _Wostream ,const wchar_t
CP_XML_ATTR_OPT(L"chart:percentage", chart_percentage_ );
CP_XML_ATTR_OPT(L"chart:connect-bars", chart_connect_bars_ );
CP_XML_ATTR_OPT(L"chart:deep", chart_deep_ );
CP_XML_ATTR_OPT(L"chart:tick-marks-major-inner",chart_tick_marks_major_inner_ );
CP_XML_ATTR_OPT(L"chart:tick-marks-major-outer",chart_tick_marks_major_outer_ );
CP_XML_ATTR_OPT(L"chart:tick-marks-minor-inner",chart_tick_marks_minor_inner_ );
CP_XML_ATTR_OPT(L"chart:tick-marks-minor-outer",chart_tick_marks_minor_outer_ );
......
......@@ -38,6 +38,7 @@ public:
_CP_OPT(Bool) chart_connect_bars_;
_CP_OPT(Bool) chart_deep_;
_CP_OPT(Bool) chart_tick_marks_major_outer_;
_CP_OPT(Bool) chart_tick_marks_major_inner_;
_CP_OPT(Bool) chart_tick_marks_minor_inner_;
_CP_OPT(Bool) chart_tick_marks_minor_outer_;
_CP_OPT(Bool) chart_lines_;
......
......@@ -280,7 +280,7 @@ public:
void convert(OOX::Spreadsheet::CT_Legend *ct_legend);
void convert(OOX::Spreadsheet::CT_LegendEntry *ct_legend);
void convert(OOX::Spreadsheet::CT_PlotArea *ct_plotArea);
void convert(OOX::Spreadsheet::CT_Surface *ct_surface, int type);
void convert(OOX::Spreadsheet::CT_Surface *ct_surface, int type, bool chart3D);
void convert(OOX::Spreadsheet::CT_CatAx *ct_catAx);
void convert(OOX::Spreadsheet::CT_SerAx *ct_serAx);
void convert(OOX::Spreadsheet::CT_DateAx *ct_dateAx);
......
......@@ -204,6 +204,11 @@ void DocxConverter::convert(OOX::WritingElement *oox_unknown)
OOX::Logic::CSectionProperty *pSectionPr = static_cast<OOX::Logic::CSectionProperty*>(oox_unknown);
convert(pSectionPr, true);
}break;
case OOX::et_w_tbl:
{
OOX::Logic::CTbl* pTable= static_cast<OOX::Logic::CTbl*>(oox_unknown);
convert(pTable);
}break;
default:
{
OoxConverter::convert(oox_unknown);
......@@ -217,7 +222,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
bool styled = false;
bool bStartNewParagraph = !m_bKeepNextParagraph;
if (oox_paragraph->m_oParagraphProperty)
{
styled = true;
......@@ -234,8 +239,11 @@ 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();
}
m_bKeepNextParagraph = false;
convert(oox_paragraph->m_oParagraphProperty, paragraph_properties);
}
}else m_bKeepNextParagraph = false;
if (bStartNewParagraph) odt_context->start_paragraph(styled);
for ( int nIndex = 0; nIndex < oox_paragraph->m_arrItems.GetSize(); nIndex++ )
......@@ -254,7 +262,7 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
}
if (m_bKeepNextParagraph) odt_context->end_drop_cap();
if (bStartNewParagraph && !m_bKeepNextParagraph) odt_context->end_paragraph();
if (!m_bKeepNextParagraph) odt_context->end_paragraph();
}
void DocxConverter::convert(OOX::Logic::CRun *oox_run)//wordprocessing 22.1.2.87 math 17.3.2.25
{
......@@ -1453,6 +1461,80 @@ void DocxConverter::convert_comment(int oox_comm_id)
}
}
}
void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
{
if (oox_table == NULL) return;
odt_context->start_table();
convert(oox_table->m_oTblGrid.GetPointer());
for (int i =0 ; i < oox_table->m_arrItems.GetSize(); i++)
{
convert(oox_table->m_arrItems[i]);
}
odt_context->end_table();
}
void DocxConverter::convert(OOX::Logic::CTblGrid *oox_table_grid)
{
if (oox_table_grid == NULL) return;
odt_context->start_table_columns();
//nullable<OOX::Logic::CTblGridChange > m_oTblGridChange;
for (int i =0 ; i < oox_table_grid->m_arrGridCol.GetSize(); i++)
{
//m_oW
odt_context->add_table_column(/*10*/);
}
odt_context->end_table_columns();
}
void DocxConverter::convert(OOX::Logic::CTr *oox_table_row)
{
if (oox_table_row == NULL) return;
for (int i =0 ; i < oox_table_row->m_arrItems.GetSize(); i++)
{
odt_context->start_table_row();
convert(oox_table_row->m_arrItems[i]);
odt_context->end_table_row();
}
}
void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
{
if (oox_table_cell == NULL) return;
odt_context->start_table_cell();
for (int i =0 ; i < oox_table_cell->m_arrItems.GetSize(); i++)
{
convert(oox_table_cell->m_arrItems[i]);
}
odt_context->end_table_cell();
}
void DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr)
{
if (oox_table_cell_pr == NULL) return;
//nullable<ComplexTypes::Word::CTrackChange > m_oCellDel;
//nullable<ComplexTypes::Word::CTrackChange > m_oCellIns;
//nullable<ComplexTypes::Word::CCellMergeTrackChange > m_oCellMerge;
//nullable<ComplexTypes::Word::CCnf > m_oCnfStyle;
//nullable<ComplexTypes::Word::CDecimalNumber > m_oGridSpan;
//nullable<OOX::Logic::CHeaders > m_oHeaders;
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oHideMark;
//nullable<ComplexTypes::Word::CHMerge > m_oHMerge;
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oNoWrap;
//nullable<ComplexTypes::Word::CShading > m_oShd;
//nullable<OOX::Logic::CTcBorders > m_oTcBorders;
//nullable<ComplexTypes::Word::COnOff2<SimpleTypes::onoffTrue> > m_oTcFitText;
//nullable<OOX::Logic::CTcMar > m_oTcMar;
//nullable<OOX::Logic::CTcPrChange > m_oTcPrChange;
//nullable<ComplexTypes::Word::CTblWidth > m_oTcW;
//nullable<ComplexTypes::Word::CTextDirection > m_oTextDirection;
//nullable<ComplexTypes::Word::CVerticalJc > m_oVAlign;
//nullable<ComplexTypes::Word::CVMerge > m_oVMerge;
}
}
......@@ -34,6 +34,13 @@ namespace OOX
class CCommentRangeStart;
class CCommentRangeEnd;
class CCommentReference;
class CTbl;
class CTblGrid;
class CTr;
class CTc;
class CTableCellProperties;
class CTblGridCol;
}
}
......@@ -129,7 +136,11 @@ namespace Oox2Odf
void convert(OOX::Logic::CCommentRangeEnd *oox_comm_end);
void convert(OOX::Logic::CCommentReference *oox_comm_ref);
void convert(OOX::Logic::CTbl *oox_table);
void convert(OOX::Logic::CTblGrid *oox_table_grid);
void convert(OOX::Logic::CTr *oox_table_row);
void convert(OOX::Logic::CTc *oox_table_cell);
void convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr);
//--------------------------------------------------------------------------------
bool m_bKeepNextParagraph;
};
......
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