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

(1.2.0.88): ASCOfficeOdfFileW


git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@57260 954022d7-b5bf-4e40-9824-e11837661b57
parent 0e4df2c5
...@@ -33,6 +33,7 @@ namespace odf ...@@ -33,6 +33,7 @@ namespace odf
current_row = 0; current_row = 0;
current_column = 0; current_column = 0;
count_header_row = 0; count_header_row = 0;
styled = false;
} }
std::vector<odf_element_state> rows; std::vector<odf_element_state> rows;
std::vector<odf_column_state> columns; std::vector<odf_column_state> columns;
...@@ -45,7 +46,7 @@ namespace odf ...@@ -45,7 +46,7 @@ namespace odf
__int32 count_header_row; __int32 count_header_row;
std::wstring base_style_name; bool styled;
}; };
...@@ -66,7 +67,6 @@ public: ...@@ -66,7 +67,6 @@ public:
odf_style_context * styles_context() {return odf_context_->styles_context();} odf_style_context * styles_context() {return odf_context_->styles_context();}
//std::wstring default_cell_style_name_ ; // :(
odf_conversion_context *odf_context_; odf_conversion_context *odf_context_;
private: private:
...@@ -85,15 +85,17 @@ odf_table_context::~odf_table_context() ...@@ -85,15 +85,17 @@ odf_table_context::~odf_table_context()
{ {
} }
void odf_table_context::set_table_base_style(std::wstring base_style_name) void odf_table_context::set_table_styled(bool val)
{ {
impl_->current_table().base_style_name = base_style_name; impl_->current_table().styled = val;
} }
bool odf_table_context::is_styled() bool odf_table_context::is_styled()
{ {
return impl_->current_table().base_style_name.length() >0 ? true : false; if (impl_->empty()) return false;
return impl_->current_table().styled;
} }
void odf_table_context::start_table(office_element_ptr &elm, bool styled) void odf_table_context::start_table(office_element_ptr &elm, bool styled)
{ {
table_table * table = dynamic_cast<table_table *>(elm.get()); table_table * table = dynamic_cast<table_table *>(elm.get());
......
...@@ -23,9 +23,9 @@ public: ...@@ -23,9 +23,9 @@ public:
void set_styles_context(odf_style_context* styles_context); void set_styles_context(odf_style_context* styles_context);
void set_table_base_style(std::wstring base_style_name); void set_table_styled(bool val);
bool is_styled();
bool is_styled() ;
int current_column (); int current_column ();
int current_row (); int current_row ();
int count_column (); int count_column ();
......
...@@ -21,9 +21,12 @@ class style_paragraph_properties; ...@@ -21,9 +21,12 @@ class style_paragraph_properties;
struct _style_properties struct _style_properties
{ {
_style_properties(){is = false;}
office_element_ptr text_props; office_element_ptr text_props;
office_element_ptr paragraph_props; office_element_ptr paragraph_props;
office_element_ptr table_cell_props; office_element_ptr table_cell_props;
bool is;
}; };
struct table_format_state struct table_format_state
{ {
...@@ -49,7 +52,7 @@ struct table_format_state ...@@ -49,7 +52,7 @@ struct table_format_state
class odf_table_styles_context class odf_table_styles_context
{ {
public: public:
odf_table_styles_context(){current = NULL; context_ = NULL; current_table_style_ = -1;} odf_table_styles_context(){current = NULL; context_ = NULL; }
void set_odf_context(odf_conversion_context * Context) void set_odf_context(odf_conversion_context * Context)
{ {
...@@ -84,12 +87,14 @@ public: ...@@ -84,12 +87,14 @@ public:
//----------------------------------------------- //-----------------------------------------------
// output // output
//----------------------------------------------- //-----------------------------------------------
bool set_current_style(std::wstring name); bool start_table(std::wstring style_name);
void set_current_dimension(int col, int row); void set_current_dimension(int col, int row);
void set_flags(int val);
void get_table_cell_properties (int col, int row, style_table_cell_properties *props); void get_table_cell_properties (int col, int row, style_table_cell_properties *props);
void get_text_properties (int col, int row, style_text_properties *props); void get_text_properties (int col, int row, style_text_properties *props);
void get_paragraph_properties (int col, int row, style_paragraph_properties *props); void get_paragraph_properties (int col, int row, style_paragraph_properties *props);
void end_table();
private: private:
...@@ -99,9 +104,21 @@ private: ...@@ -99,9 +104,21 @@ private:
odf_conversion_context *context_; odf_conversion_context *context_;
int current_table_style_; struct _use_style
int current_table_col_count_; {
int current_table_row_count_; int table_style_;
int table_col_count_;
int table_row_count_;
bool cols;
bool rows;
bool first_row;
bool last_row;
bool first_col;
bool last_col;
};
std::vector<_use_style> current_used_;
////////////////// //////////////////
......
...@@ -254,10 +254,10 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph) ...@@ -254,10 +254,10 @@ void DocxConverter::convert(OOX::Logic::CParagraph *oox_paragraph)
odt_context->styles_context()->create_style(L"",odf::style_family::Paragraph, true, false, -1); 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(); paragraph_properties = odt_context->styles_context()->last_state().get_paragraph_properties();
} }
m_bKeepNextParagraph = false;
convert(oox_paragraph->m_oParagraphProperty, paragraph_properties); convert(oox_paragraph->m_oParagraphProperty, paragraph_properties);
}else m_bKeepNextParagraph = false; }else m_bKeepNextParagraph = false; // m_bKeepNextParagraph !!! todooo
// - - !!!
if (bStartNewParagraph) odt_context->start_paragraph(styled); if (bStartNewParagraph) odt_context->start_paragraph(styled);
...@@ -392,11 +392,11 @@ void DocxConverter::convert(OOX::Logic::CInstrText *oox_instr) ...@@ -392,11 +392,11 @@ void DocxConverter::convert(OOX::Logic::CInstrText *oox_instr)
} }
void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf::style_paragraph_properties * paragraph_properties) void DocxConverter::convert(OOX::Logic::CParagraphProperty *oox_paragraph_pr, cpdoccore::odf::style_paragraph_properties * paragraph_properties)
{ {
m_bKeepNextParagraph = false;
if (!oox_paragraph_pr) return; if (!oox_paragraph_pr) return;
if (!paragraph_properties) return; if (!paragraph_properties) return;
m_bKeepNextParagraph = false;
if (oox_paragraph_pr->m_oPStyle.IsInit() && oox_paragraph_pr->m_oPStyle->m_sVal.IsInit()) if (oox_paragraph_pr->m_oPStyle.IsInit() && oox_paragraph_pr->m_oPStyle->m_sVal.IsInit())
{ {
std::wstring style_name = string2std_string(*oox_paragraph_pr->m_oPStyle->m_sVal); std::wstring style_name = string2std_string(*oox_paragraph_pr->m_oPStyle->m_sVal);
...@@ -1292,7 +1292,7 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color, ...@@ -1292,7 +1292,7 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
ucA = color->Get_A(); ucA = color->Get_A();
result = true; result = true;
} }
if(theme_color) if(theme_color && result == false)
{ {
OOX::CTheme * docx_theme= docx_document->GetTheme(); OOX::CTheme * docx_theme= docx_document->GetTheme();
int theme_ind = theme_color->GetValue(); int theme_ind = theme_color->GetValue();
...@@ -1323,10 +1323,7 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color, ...@@ -1323,10 +1323,7 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
case SimpleTypes::themecolorHyperlink: case SimpleTypes::themecolorHyperlink:
result = docx_theme->m_oThemeElements.m_oClrScheme.m_oHlink.tryGetRgb(ucR, ucG, ucB, ucA); break; result = docx_theme->m_oThemeElements.m_oClrScheme.m_oHlink.tryGetRgb(ucR, ucG, ucB, ucA); break;
} }
} if (result == true && theme_tint)
if (result == true)
{
if (theme_tint)
{ {
OOX::Drawing::CHslColor col; OOX::Drawing::CHslColor col;
col.SetRGBA(ucR, ucG, ucB); col.SetRGBA(ucR, ucG, ucB);
...@@ -1336,6 +1333,9 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color, ...@@ -1336,6 +1333,9 @@ void DocxConverter::convert(SimpleTypes::CHexColor<> *color,
col.SetHSL(dH, dS,dL); col.SetHSL(dH, dS,dL);
col.GetRGBA(ucR, ucG, ucB,ucA); col.GetRGBA(ucR, ucG, ucB,ucA);
} }
}
if (result == true)
{
SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB); SimpleTypes::CHexColor<> *oRgbColor = new SimpleTypes::CHexColor<>(ucR,ucG,ucB);
if (oRgbColor) if (oRgbColor)
{ {
...@@ -1434,11 +1434,23 @@ void DocxConverter::convert_table_style(OOX::CStyle *oox_style) ...@@ -1434,11 +1434,23 @@ void DocxConverter::convert_table_style(OOX::CStyle *oox_style)
convert(oox_style->m_oTblPr->m_oTblBorders.GetPointer(), table_cell_properties); convert(oox_style->m_oTblPr->m_oTblBorders.GetPointer(), table_cell_properties);
} }
} }
if (oox_style->m_oRunPr.IsInit())
{
odf::style_text_properties * text_properties = odt_context->styles_context()->table_styles().get_text_properties();
convert(oox_style->m_oRunPr.GetPointer(), text_properties);
}
if (oox_style->m_oParPr.IsInit())
{
odf::style_paragraph_properties * paragraph_properties = odt_context->styles_context()->table_styles().get_paragraph_properties();
convert(oox_style->m_oParPr.GetPointer(), paragraph_properties);
}
if (oox_style->m_oTcPr.IsInit()) if (oox_style->m_oTcPr.IsInit())
{ {
odf::style_table_cell_properties * table_cell_properties = odt_context->styles_context()->table_styles().get_table_cell_properties(); odf::style_table_cell_properties * table_cell_properties = odt_context->styles_context()->table_styles().get_table_cell_properties();
convert(oox_style->m_oTcPr.GetPointer(), table_cell_properties); convert(oox_style->m_oTcPr.GetPointer(), table_cell_properties);
} //if (oox_style->m_oTrPr.IsInit()) }
//if (oox_style->m_oTrPr.IsInit())
//{ //{
// odf::style_table_row_properties * table_row_properties = odt_context->styles_context()->table_styles().get_table_row_properties(); // odf::style_table_row_properties * table_row_properties = odt_context->styles_context()->table_styles().get_table_row_properties();
// convert(oox_style->m_oTrPr.GetPointer(), table_row_properties); // convert(oox_style->m_oTrPr.GetPointer(), table_row_properties);
...@@ -1600,19 +1612,31 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table) ...@@ -1600,19 +1612,31 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
{ {
if (oox_table == NULL) return; if (oox_table == NULL) return;
if (m_bKeepNextParagraph)
{
odt_context->end_paragraph();
m_bKeepNextParagraph = false;
}
convert(oox_table->m_oTableProperties); convert(oox_table->m_oTableProperties);
odt_context->start_table(true); odt_context->start_table(true);
//
if (oox_table->m_oTableProperties && (oox_table->m_oTableProperties->m_oTblStyle.IsInit() && oox_table->m_oTableProperties->m_oTblStyle->m_sVal.IsInit())) if (oox_table->m_oTableProperties && (oox_table->m_oTableProperties->m_oTblStyle.IsInit() && oox_table->m_oTableProperties->m_oTblStyle->m_sVal.IsInit()))
{ {
std::wstring base_style_name = string2std_string(*oox_table->m_oTableProperties->m_oTblStyle->m_sVal); std::wstring base_style_name = string2std_string(*oox_table->m_oTableProperties->m_oTblStyle->m_sVal);
bool res = odt_context->styles_context()->table_styles().set_current_style(base_style_name); bool res = odt_context->styles_context()->table_styles().start_table(base_style_name);
if (res) odt_context->table_context()->set_table_base_style(base_style_name ); if (res)
{
odt_context->table_context()->set_table_styled(res);
if (oox_table->m_oTableProperties->m_oTblLook.IsInit() && oox_table->m_oTableProperties->m_oTblLook->m_oVal.IsInit())
odt_context->styles_context()->table_styles().set_flags(oox_table->m_oTableProperties->m_oTblLook->m_oVal->GetValue());
}
} }
int count_rows = oox_table->m_arrItems.GetSize(); int count_rows = oox_table->m_nCountRow;
int count_columns = 0; int count_columns = 0;
if (oox_table->m_oTblGrid.IsInit())count_columns = oox_table->m_oTblGrid->m_arrGridCol.GetSize(); if (oox_table->m_oTblGrid.IsInit())count_columns = oox_table->m_oTblGrid->m_arrGridCol.GetSize();
...@@ -1636,6 +1660,9 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table) ...@@ -1636,6 +1660,9 @@ void DocxConverter::convert(OOX::Logic::CTbl *oox_table)
} }
odt_context->end_table(); odt_context->end_table();
if (odt_context->table_context()->is_styled())
odt_context->styles_context()->table_styles().end_table();
} }
void DocxConverter::convert(OOX::Logic::CTblGrid *oox_table_grid) void DocxConverter::convert(OOX::Logic::CTblGrid *oox_table_grid)
{ {
...@@ -1706,7 +1733,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell) ...@@ -1706,7 +1733,7 @@ void DocxConverter::convert(OOX::Logic::CTc *oox_table_cell)
} }
} }
odt_context->start_table_cell( oox_table_cell->m_nNumCol,covered, convert(oox_table_cell->m_oTableCellProperties)); odt_context->start_table_cell( oox_table_cell->m_nNumCol,covered, convert(oox_table_cell->m_oTableCellProperties, oox_table_cell->m_nNumCol+1));
if (oox_table_cell->m_oTableCellProperties) if (oox_table_cell->m_oTableCellProperties)
{ {
...@@ -1872,9 +1899,13 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, ...@@ -1872,9 +1899,13 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr,
//nullable<ComplexTypes::Word::CVerticalJc > m_oVAlign; //nullable<ComplexTypes::Word::CVerticalJc > m_oVAlign;
return true; return true;
} }
bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr) bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, int col)
{ {
bool is_base_styled = odt_context->table_context()->is_styled(); bool is_base_styled = odt_context->table_context()->is_styled();
if (col < 0) col=odt_context->table_context()->current_column()+1;
int row=odt_context->table_context()->current_row();
odf::style_table_cell_properties * parent_cell_properties = NULL; odf::style_table_cell_properties * parent_cell_properties = NULL;
odf::odf_style_state * state = odt_context->styles_context()->last_state(odf::style_family::Table); // odf::odf_style_state * state = odt_context->styles_context()->last_state(odf::style_family::Table); //
...@@ -1893,7 +1924,7 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr) ...@@ -1893,7 +1924,7 @@ bool DocxConverter::convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr)
odf::style_text_properties * text_properties = odt_context->styles_context()->last_state().get_text_properties(); odf::style_text_properties * text_properties = odt_context->styles_context()->last_state().get_text_properties();
odf::style_paragraph_properties * paragraph_properties = odt_context->styles_context()->last_state().get_paragraph_properties(); odf::style_paragraph_properties * paragraph_properties = odt_context->styles_context()->last_state().get_paragraph_properties();
int col=odt_context->table_context()->current_column()+1; if (col < 0) col=odt_context->table_context()->current_column()+1;
int row=odt_context->table_context()->current_row(); int row=odt_context->table_context()->current_row();
odt_context->styles_context()->table_styles().get_table_cell_properties (col, row, cell_properties); odt_context->styles_context()->table_styles().get_table_cell_properties (col, row, cell_properties);
......
...@@ -149,7 +149,7 @@ namespace Oox2Odf ...@@ -149,7 +149,7 @@ namespace Oox2Odf
void convert(OOX::Logic::CTr *oox_table_row); void convert(OOX::Logic::CTr *oox_table_row);
void convert(OOX::Logic::CTc *oox_table_cell); void convert(OOX::Logic::CTc *oox_table_cell);
bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr); bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, int col = -1);
bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, odf::style_table_cell_properties *table_cell_properties/*,odf::style_table_cell_properties * table_cell_properties = NULL*/); bool convert(OOX::Logic::CTableCellProperties *oox_table_cell_pr, odf::style_table_cell_properties *table_cell_properties/*,odf::style_table_cell_properties * table_cell_properties = NULL*/);
bool convert(OOX::Logic::CTableProperty *oox_table_pr); bool convert(OOX::Logic::CTableProperty *oox_table_pr);
bool convert(OOX::Logic::CTableProperty *oox_table_pr, odf::style_table_properties *table_properties); bool convert(OOX::Logic::CTableProperty *oox_table_pr, odf::style_table_properties *table_properties);
......
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
//1 //1
//2 //2
//0 //0
//88 //89
#define INTVER 1,2,0,88 #define INTVER 1,2,0,89
#define STRVER "1,2,0,88\0" #define STRVER "1,2,0,89\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