git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@55334 954022d7-b5bf-4e40-9824-e11837661b57

This commit is contained in:
Elen.Subbotina
2014-04-06 08:41:12 +00:00
committed by Alexander Trofimov
parent 85035b1aa0
commit 15bfb4a61a
20 changed files with 349 additions and 326 deletions

View File

@ -1,5 +1,4 @@
#ifndef _CP_OPTIONAL_H_
#define _CP_OPTIONAL_H_
#pragma once
#include <boost/optional.hpp>
@ -17,5 +16,3 @@ struct optional
#define _CP_OPT(T) optional< T >::Type
}
#endif

View File

@ -31,7 +31,7 @@ void xlsx_cell_format::set_num_format(int numFmt)
namespace {
int odf2buildin_map[] = {0,0,0,10,15,21,0,49};
int odf2buildin_map[] = {0,0,0,0,0,0,0,0};
//{
// {L"", 0},
// {L"float", 0},

View File

@ -27,7 +27,7 @@ xlsx_table_state::xlsx_table_state(xlsx_conversion_context & Context,
void xlsx_table_state::start_column(unsigned int repeated, const std::wstring & defaultCellStyleName)
{
for (unsigned int i = 0; i < repeated; ++i)
for (unsigned int i = 0; i <repeated; ++i)
column_default_cell_style_name_.push_back(defaultCellStyleName);
columns_count_ += repeated;
@ -77,7 +77,13 @@ std::wstring xlsx_table_state::default_row_cell_style() const
std::wstring xlsx_table_state::default_column_cell_style() const
{
return column_default_cell_style_name_.at(current_table_column_);
if (current_table_column_ < column_default_cell_style_name_.size())
return column_default_cell_style_name_.at(current_table_column_);
else
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>!! - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ods???
return L"";
}
}
void xlsx_table_state::end_row()

View File

@ -21,6 +21,7 @@ text_format_properties_content calc_text_properties_content(const std::vector<co
text_format_properties_content calc_text_properties_content(const style_instance * styleInstance)
{
std::vector<const style_text_properties*> textProps;
while (styleInstance)
{
if (const style_content * content = styleInstance->content())
@ -65,7 +66,7 @@ graphic_format_properties calc_graphic_properties_content(const style_instance *
graphicProps.push_back(graphicProp);
styleInstance = styleInstance->parent();
}
}
reverse(graphicProps.begin(), graphicProps.end());
return calc_graphic_properties_content(graphicProps);
}

View File

@ -241,12 +241,12 @@ void number_currency_symbol::add_text(const std::wstring & Text)
void number_currency_symbol::xlsx_convert(oox::xlsx_conversion_context & Context)
{
std::wostream & strm = Context.get_num_format_context().output();
strm << xml::utils::replace_text_to_xml(L"\"");
strm << L"[$";//xml::utils::replace_text_to_xml(L"\"");
BOOST_FOREACH(const std::wstring & t, text_)
{
strm << xml::utils::replace_text_to_xml(t);
}
strm << xml::utils::replace_text_to_xml(L"\"");
strm << L"]";;//xml::utils::replace_text_to_xml(L"\"");
}

View File

@ -582,7 +582,7 @@ void odf_document::Impl::xlsx_convert(oox::xlsx_conversion_context & Context)
catch(std::exception & ex)
{
_CP_LOG(info) << L"\n[error]:\n";
_CP_LOG(info) << utf8_to_utf16(ansi_to_utf8(ex.what())) << std::endl;
_CP_LOG(info) << utf8_to_utf16(ansi_to_utf8(ex.what())) << L"\n";
throw;
}
catch(...)

View File

@ -70,10 +70,16 @@ void styles_container::add_style(const std::wstring & Name,
style_content * Content,
bool IsAutomatic,
bool IsDefault,
const std::wstring & ParentStyleName,
const std::wstring & ParentStyleName_,
const std::wstring & NextStyleName,
const std::wstring & DataStyleName)
{
std::wstring ParentStyleName = ParentStyleName_;
if (Name == ParentStyleName)
{
ParentStyleName = L"";//<2F><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
}
style_instance_ptr newStyle = style_instance_ptr(
new style_instance(this, Name, Type, Content, IsAutomatic, IsDefault, ParentStyleName, NextStyleName, DataStyleName)
);

View File

@ -463,7 +463,8 @@ void office_styles::add_child_element( xml::sax * Reader, const ::std::wstring &
CP_CHECK_NAME(L"number", L"text-style") ||
CP_CHECK_NAME(L"number", L"percentage-style") ||
CP_CHECK_NAME(L"number", L"date-style") ||
CP_CHECK_NAME(L"number", L"boolean-style")
CP_CHECK_NAME(L"number", L"time-style") ||
CP_CHECK_NAME(L"number", L"boolean-style")
)
{
styles_.add_child_element(Reader, Ns, Name, getContext());

View File

@ -150,7 +150,10 @@ void table_table_row::xlsx_convert(oox::xlsx_conversion_context & Context)
{
CP_XML_ATTR(L"customFormat", 1);
CP_XML_ATTR(L"s", Default_Cell_style_in_row_ );
}
}
else
CP_XML_ATTR(L"customFormat", 0);
CP_XML_STREAM();
@ -238,7 +241,7 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
const std::wstring tableStyleName = table_table_attlist_.table_style_name_ ? table_table_attlist_.table_style_name_->style_name() : L"";
const std::wstring tableName = table_table_attlist_.table_name_.get_value_or(L"");
_CP_LOG(info) << L"[info][xlsx] process table \"" << tableName /*L"" */<< L"\"" << std::endl;
_CP_LOG(info) << L"[info][xlsx] process table \"" <</* tableName*/ L"1111" << L"\"" << std::endl;
if (table_table_source_)
{
@ -246,7 +249,7 @@ void table_table::xlsx_convert(oox::xlsx_conversion_context & Context)
if ( table_source)
{
if (table_source->table_linked_source_attlist_.common_xlink_attlist_.href_)return;
}
}
}
//office-dde-sourcetable_linked_source_attlist
@ -541,16 +544,21 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
if (!skip_next_cell)
{
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
odf_read_context & odfContext = Context.root()->odf_context();
style_instance * defaultCellStyle =
odfContext.styleContainer().style_default_by_type(style_family::TableCell);
style_instance * defaultColumnCellStyle =
odfContext.styleContainer().style_by_name(Context.get_table_context().default_column_cell_style(), style_family::TableCell,false);
style_instance * defaultRowCellStyle =
odfContext.styleContainer().style_by_name(Context.get_table_context().default_row_cell_style(), style_family::TableCell,false);
style_instance * cellStyle = odfContext.styleContainer().style_by_name(styleName, style_family::TableCell,false);
odf_read_context & odfContext = Context.root()->odf_context();
style_instance *defaultCellStyle=NULL, *defaultColumnCellStyle = NULL, *defaultRowCellStyle =NULL, *cellStyle = NULL;
try
{
defaultCellStyle = odfContext.styleContainer().style_default_by_type(style_family::TableCell);
defaultColumnCellStyle = odfContext.styleContainer().style_by_name(Context.get_table_context().default_column_cell_style(), style_family::TableCell,false);
defaultRowCellStyle = odfContext.styleContainer().style_by_name(Context.get_table_context().default_row_cell_style(), style_family::TableCell,false);
cellStyle = odfContext.styleContainer().style_by_name(styleName, style_family::TableCell,false);
}
catch(...)
{
_CP_LOG(info) << L"\n[error]: style wrong\n";
}
std::wstring data_style = CalcCellDataStyle(Context,
Context.get_table_context().default_column_cell_style(),
@ -589,8 +597,9 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
XlsxCellType::type t_val = XlsxCellType::s;
std::wstring number_val = L"";
_CP_OPT(bool) bool_val;
_CP_OPT(std::wstring) str_val;
int odf_value_type = office_value_type::Custom;
office_value_type::type odf_value_type = office_value_type::Custom;
if (table_table_cell_attlist_.common_value_and_type_attlist_)
{
@ -650,9 +659,11 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
bool_val = oox::parseBoolVal(attr.office_boolean_value_.get());
}
else if ((odf_value_type == office_value_type::String) ||
(odf_value_type == office_value_type::Custom && attr.office_date_value_))
(odf_value_type == office_value_type::Custom && attr.office_string_value_))
{
t_val = XlsxCellType::s;//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
t_val = XlsxCellType::str;
if (attr.office_string_value_)
str_val = attr.office_string_value_.get();
}
}
@ -704,14 +715,19 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
is_style_visible = true;
xfId_last_set= Context.get_style_manager().xfId(&textFormatProperties, &parFormatProperties, &cellFormatProperties, &cellFormat, num_format,false,is_style_visible);
const int sharedStringId = table_table_cell_content_.xlsx_convert(Context);
const int sharedStringId = table_table_cell_content_.xlsx_convert(Context);
if (t_val == XlsxCellType::str && sharedStringId >=0) t_val = XlsxCellType::s;//<2F> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Context.set_current_cell_style_id(xfId_last_set);
bool is_data_visible = false;
if (sharedStringId >= 0 || !formula.empty() ||
(t_val == XlsxCellType::n && !number_val.empty()) || (t_val == XlsxCellType::b && !!bool_val))is_data_visible = true;
(t_val == XlsxCellType::n && !number_val.empty()) ||
(t_val == XlsxCellType::b && bool_val) ||
(t_val == XlsxCellType::str && str_val))is_data_visible = true;
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .
if ( is_data_visible || (cellStyle && is_style_visible))
@ -743,9 +759,13 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
{
CP_XML_NODE(L"v")
{
CP_XML_CONTENT(sharedStringId);
CP_XML_CONTENT(sharedStringId);
}
}
else if (t_val == XlsxCellType::s || str_val)
{
CP_XML_CONTENT(str_val.get());
}
else if (t_val == XlsxCellType::n && !number_val.empty())
{
CP_XML_NODE(L"v")
@ -753,7 +773,7 @@ void table_table_cell::xlsx_convert(oox::xlsx_conversion_context & Context)
CP_XML_CONTENT(number_val);
}
}
else if (t_val == XlsxCellType::b && !!bool_val)
else if (t_val == XlsxCellType::b && bool_val)
{
CP_XML_NODE(L"v")
{

View File

@ -4,7 +4,7 @@
/* File created by MIDL compiler version 7.00.0555 */
/* at Tue Mar 25 14:13:03 2014
/* at Fri Apr 04 18:34:18 2014
*/
/* Compiler settings for .\ASCOfficeOdfFileW.idl:
Oicf, W1, Zp8, env=Win32 (32b run), target_arch=X86 7.00.0555

View File

@ -272,18 +272,6 @@ void number_currency_symbol::add_text(const std::wstring & Text)
text_.push_back(Text);
}
//void number_currency_symbol::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// strm << xml::utils::replace_text_to_xml(L"\"");
// BOOST_FOREACH(const std::wstring & t, text_)
// {
// strm << xml::utils::replace_text_to_xml(t);
// }
// strm << xml::utils::replace_text_to_xml(L"\"");
//}
// number:currency-style
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_currency_style::ns = L"number";
@ -319,8 +307,6 @@ void number_text_content::serialize(std::wostream & strm)
}
}
void number_text_content::add_text(const std::wstring & Text)
{
office_element_ptr elm = text_text::create(Text) ;
@ -363,6 +349,7 @@ void number_percentage_style::serialize(std::wostream & strm)
namespace
{
//todooo - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> string -> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void format_number_number(
std::wostream & strm,
bool number_grouping_,
@ -396,18 +383,6 @@ void format_number_number(
}
}
//void number_number::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
//
// format_number_number(
// strm,
// number_grouping_.get_value_or(false),
// number_min_integer_digits_.get_value_or(0),
// number_decimal_places_.get_value_or(0)
// );
//}
// number:day
//////////////////////////////////////////////////////////////////////////////////////////////////
@ -426,21 +401,6 @@ void number_day::serialize(std::wostream & strm)
}
}
//void number_day::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// if (number_style_.get_value_or(L"short") == L"long")
// {
// strm << L"DD";
// }
// else
// {
// strm << L"D";
// }
//}
// number:day-of-week
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_day_of_week::ns = L"number";
@ -457,19 +417,6 @@ void number_day_of_week::serialize(std::wostream & strm)
}
}
}
//
//void number_day_of_week::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// if (number_style_.get_value_or(L"short") == L"long")
// {
// strm << L"DDDD";
// }
// else
// {
// strm << L"DDD";
// }
//}
// number:quarter
//////////////////////////////////////////////////////////////////////////////////////////////////
@ -488,22 +435,6 @@ void number_quarter::serialize(std::wostream & strm)
}
}
//void number_quarter::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// if (number_style_.get_value_or(L"short") == L"long")
// {
// // TODO: ??
// strm << L"";
// }
// else
// {
// // TODO: ??
// strm << L"";
// }
//}
// number:month
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_month::ns = L"number";
@ -523,33 +454,6 @@ void number_month::serialize(std::wostream & strm)
}
}
//void number_month::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// if (!number_textual_.get_value_or(false))
// {
// if (number_style_.get_value_or(L"short") == L"long")
// {
// strm << L"MM";
// }
// else
// {
// strm << L"M";
// }
// }
// else
// {
// if (number_style_.get_value_or(L"short") == L"long")
// {
// strm << L"MMMM";
// }
// else
// {
// strm << L"MMM";
// }
// }
//}
// number:year
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_year::ns = L"number";
@ -567,19 +471,6 @@ void number_year::serialize(std::wostream & strm)
}
}
//void number_year::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// if (number_style_.get_value_or(L"short") == L"long")
// {
// strm << L"YYYY";
// }
// else
// {
// strm << L"YY";
// }
//}
// number:date-style
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_date_style::ns = L"number";
@ -608,21 +499,6 @@ void number_hours::serialize(std::wostream & strm)
}
//void number_hours::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// if (number_style_.get_value_or(L"short") == L"long")
// {
// strm << L"HH";
// }
// else
// {
// // TODO
// strm << L"HH";
// }
//}
// number:minutes
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_minutes::ns = L"number";
@ -640,22 +516,6 @@ void number_minutes::serialize(std::wostream & strm)
}
}
//void number_minutes::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// if (number_style_.get_value_or(L"short") == L"long")
// {
// strm << L"MM";
// }
// else
// {
// // TODO
// strm << L"MM";
// }
//}
// number:seconds
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_seconds::ns = L"number";
@ -674,27 +534,6 @@ void number_seconds::serialize(std::wostream & strm)
}
}
//void number_seconds::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// if (number_style_.get_value_or(L"short") == L"long")
// {
// strm << L"SS";
// }
// else
// {
// // TODO
// strm << L"SS";
// }
//
// if (int dec = number_decimal_places_.get_value_or(0))
// {
// strm << L".";
// strm << std::wstring(dec, L'0');
// }
//}
// number:am-pm
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_am_pm::ns = L"number";
@ -708,14 +547,6 @@ void number_am_pm::serialize(std::wostream & strm)
}
}
//void number_am_pm::xlsx_convert(oox::xlsx_conversion_context & Context)
//{
// std::wostream & strm = Context.get_num_format_context().output();
// strm << L"AM/PM";
//}
// number:fraction
//////////////////////////////////////////////////////////////////////////////////////////////////
const wchar_t * number_fraction::ns = L"number";

View File

@ -190,7 +190,7 @@ public:
// common-number-attlist
_CP_OPT(int) number_min_integer_digits_;
_CP_OPT(bool) number_grouping_;
_CP_OPT(Bool) number_grouping_;
office_element_ptr_array number_embedded_text_;
@ -317,7 +317,6 @@ public:
{std::wstringstream str; str <<L"Non add child in "; str << ns; str << L":"; str <<name; _CP_LOG(error) << str.str();}
virtual void serialize(std::wostream & strm);
private:
_CP_OPT(std::wstring) number_style_;
_CP_OPT(std::wstring) number_calendar_;

View File

@ -1,4 +1,5 @@
#include "precompiled_cpodf.h"
#include "logging.h"
#include "odf_number_styles_context.h"
@ -6,6 +7,7 @@
#include "number_style.h"
namespace cpdoccore {
namespace odf {
@ -174,36 +176,78 @@ void odf_number_styles_context::create_number_style(number_format_state & state,
if (state.format_code.size()>0)
{
office_element_ptr elm;
create_element(L"number", L"number", elm, &context_);
styles_elments.push_back(elm);
number_number* number_number_ = dynamic_cast<number_number*>(elm.get());
if (number_number_)
{
std::vector<std::wstring> numbers;
boost::algorithm::split(numbers, state.format_code[0], boost::algorithm::is_any_of(L",."), boost::algorithm::token_compress_on);
number_number_->number_min_integer_digits_= numbers[0].size();
if (numbers.size()>1)
{
number_number_->number_decimal_places_= numbers[1].size();
}
}
root_elm->add_child_element(elm);
create_numbers(state, elm);
root_elm->add_child_element(elm);
}
}
void odf_number_styles_context::create_numbers(number_format_state & state, office_element_ptr & elm)
{
optional< int>::Type min_digit, min_decimal;
create_element(L"number", L"number", elm, &context_);
styles_elments.push_back(elm);
number_number* number_number_ = dynamic_cast<number_number*>(elm.get());
if (number_number_)
{
if (state.format_code[0].length()>0)
{
std::wstring str1,str2;
boost::wregex re1(L"([^0-9.,]+)");
boost::wsmatch result;
boost::wregex re2(L"([^#.,]+)");
str1 = boost::regex_replace(state.format_code[0], re1, L"",boost::match_default | boost::format_all);
str2 = boost::regex_replace(state.format_code[0], re2, L"",boost::match_default | boost::format_all);
if (str1.length()<str2.length())str1=str2;
std::vector<std::wstring> numbers;
boost::algorithm::split(numbers, str1, boost::algorithm::is_any_of(L".,"), boost::algorithm::token_compress_on);
int ind=1;//
for (long i=0;i<numbers.size();i++)
{
if (numbers[i].length()<1)continue;
if (ind==1)min_digit= numbers[i].length();
if (ind==2)min_decimal= numbers[i].length();
ind++;
}
}
else
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
min_digit =1;
}
number_number_->number_min_integer_digits_= min_digit;
number_number_->number_decimal_places_= min_decimal;
number_number_->number_grouping_ = true;
}
}
void odf_number_styles_context::create_percentage_style(number_format_state & state, office_element_ptr & root_elm)
{
create_element(L"number", L"percentage-style", root_elm, &context_);
office_element_ptr elm;
create_numbers(state, elm);
root_elm->add_child_element(elm);
create_element(L"number", L"text", elm, &context_);
number_text* number_text_ = dynamic_cast<number_text*>(elm.get());
if (number_text_)number_text_->add_text(L"%");
root_elm->add_child_element(elm);
styles_elments.push_back(elm);
}
void odf_number_styles_context::create_currency_style(number_format_state & state, office_element_ptr & root_elm)
{
create_element(L"number", L"currency-style", root_elm, &context_);
{
//1 ??? - <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> todooo
office_element_ptr elm;
create_element(L"number", L"currency-symbol", elm, &context_);
styles_elments.push_back(elm);
@ -214,6 +258,9 @@ void odf_number_styles_context::create_currency_style(number_format_state & stat
number_currency_symbol_->add_text(state.currency_str);
}
root_elm->add_child_element(elm);
//2 ???
create_numbers(state, elm);
root_elm->add_child_element(elm);
}
}
@ -226,10 +273,10 @@ void odf_number_styles_context::create_date_style(number_format_state & state, o
std::wstring s = state.format_code[0];
boost::algorithm::to_lower(s);
boost::wregex re(L"(\\w+)");
boost::wregex re(L"([a-zA-Z]+)(\\W+)");//(L"(\\w+)");
std::list<std::wstring> result;
bool b = boost::regex_split(std::back_inserter(result),s, re);
if (b)result.push_back(s);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ..<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> boost.regex_split
int res;
int sz=0;
for (std::list<std::wstring>::iterator i=result.begin(); i!=result.end(); ++i)
@ -243,8 +290,10 @@ void odf_number_styles_context::create_date_style(number_format_state & state, o
number_month* number_month_ = dynamic_cast<number_month*>(elm.get());
if (number_month_ && sz > 2)number_month_->number_textual_ = true;
if (sz == 1 || sz == 3) number_month_->number_style_ = L"short";
if (sz == 2 || sz == 4) number_month_->number_style_ = L"long";
}
if ((res=s.find(L"d")) >=0)
else if ((res=s.find(L"d")) >=0)
{
if (sz < 3)
{
@ -252,16 +301,22 @@ void odf_number_styles_context::create_date_style(number_format_state & state, o
number_day* number_day_ = dynamic_cast<number_day*>(elm.get());
if (number_day_)
{
if (sz == 1)number_day_->number_style_ = L"short";
if (sz == 2)number_day_->number_style_ = L"long";
if (sz == 1) number_day_->number_style_ = L"short";
if (sz == 2) number_day_->number_style_ = L"long";
}
}
else
{
create_element(L"number", L"day-of-week", elm, &context_);
number_day_of_week* number_day_of_week_ = dynamic_cast<number_day_of_week*>(elm.get());
if (number_day_of_week_)
{
if (sz == 3) number_day_of_week_->number_style_ = L"short";
if (sz == 4) number_day_of_week_->number_style_ = L"long";
}
}
}
if ((res=s.find(L"y")) >=0)
else if ((res=s.find(L"y")) >=0)
{
create_element(L"number", L"year", elm, &context_);
number_year* number_year_ = dynamic_cast<number_year*>(elm.get());
@ -271,20 +326,24 @@ void odf_number_styles_context::create_date_style(number_format_state & state, o
else number_year_->number_style_ = L"long";
}
}
else
{ //////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ////////////////////
if(sz>1)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <20><><EFBFBD><EFBFBD><EFBFBD>
boost::algorithm::replace_all(s, L"\\", L"");
}
create_element(L"number", L"text", elm, &context_);
number_text* number_text_ = dynamic_cast<number_text*>(elm.get());
if (number_text_)number_text_->add_text(s);
}
if (elm)
{
root_elm->add_child_element(elm);
styles_elments.push_back(elm);
//////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ////////////////////
create_element(L"number", L"text", elm, &context_);
number_text* number_text_ = dynamic_cast<number_text*>(elm.get());
if (number_text_)number_text_->add_text(L"."); //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
root_elm->add_child_element(elm);
styles_elments.push_back(elm);
}
}
styles_elments.pop_back();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
}
void odf_number_styles_context::create_time_style(number_format_state & state, office_element_ptr & root_elm)
@ -295,9 +354,10 @@ void odf_number_styles_context::create_time_style(number_format_state & state, o
std::wstring s = state.format_code[0];
boost::algorithm::to_lower(s);
boost::wregex re(L"(\\w+)");
boost::wregex re(L"([a-zA-Z]+)(\\W+)");//(L"(\\w+)");
std::list<std::wstring> result;
bool b = boost::regex_split(std::back_inserter(result),s, re);
if (b)result.push_back(s);//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ..<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> boost.regex_split
int res;
int sz=0;
@ -316,7 +376,11 @@ void odf_number_styles_context::create_time_style(number_format_state & state, o
if (sz == 2)number_hours_->number_style_ = L"long";
}
}
if ((res=s.find(L"m")) >=0)
else if ((res=s.find(L"am")) >=0/* || (res=s.find(L"pm")) >=0*/) //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ..
{
create_element(L"number", L"am-pm", elm, &context_);
}
else if ((res=s.find(L"m")) >=0 && (res=s.find(L"am")) <0 && (res=s.find(L"pm")) <0 )
{
create_element(L"number", L"minutes", elm, &context_);
number_minutes* number_minutes_ = dynamic_cast<number_minutes*>(elm.get());
@ -326,7 +390,7 @@ void odf_number_styles_context::create_time_style(number_format_state & state, o
if (sz == 2)number_minutes_->number_style_ = L"long";
}
}
if ((res=s.find(L"s")) >=0)
else if ((res=s.find(L"s")) >=0)
{
create_element(L"number", L"seconds", elm, &context_);
number_seconds* number_seconds_ = dynamic_cast<number_seconds*>(elm.get());
@ -334,26 +398,27 @@ void odf_number_styles_context::create_time_style(number_format_state & state, o
{
if (sz == 1) number_seconds_->number_style_ = L"short";
if (sz == 2) number_seconds_->number_style_ = L"long";
//number_decimal_places_
}
}
if ((res=s.find(L"am")) >=0 || (res=s.find(L"pm")) >=0)
else if((res=s.find(L"pm")) <0)//<2F><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> .. <20> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
{
create_element(L"number", L"am-pm", elm, &context_);
//////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ////////////////////
if(sz>1)
{
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <20><><EFBFBD><EFBFBD><EFBFBD>
boost::algorithm::replace_all(s, L"\\", L"");
}
create_element(L"number", L"text", elm, &context_);
number_text* number_text_ = dynamic_cast<number_text*>(elm.get());
if (number_text_)number_text_->add_text(s);
}
if (elm)
{
root_elm->add_child_element(elm);
styles_elments.push_back(elm);
//////////////////// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ////////////////////
create_element(L"number", L"text", elm, &context_);
number_text* number_text_ = dynamic_cast<number_text*>(elm.get());
if (number_text_)number_text_->add_text(L":"); //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
root_elm->add_child_element(elm);
styles_elments.push_back(elm);
}
}
styles_elments.pop_back();//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>
}
void odf_number_styles_context::create_boolean_style(number_format_state & state, office_element_ptr & root_elm)
@ -398,7 +463,7 @@ void odf_number_styles_context::detect_format(number_format_state & state)
state.ods_type = office_value_type::Time;
return;
}
if ((res=tmp.find(L"y"))>=0 || (res=tmp.find(L"d"))>=0)//m <20><><EFBFBD><EFBFBD>
if ((res=tmp.find(L"y"))>=0 || (res=tmp.find(L"d"))>=0 || (res=tmp.find(L"m"))>=0)//minutes <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
{
state.ods_type = office_value_type::Date;
return;

View File

@ -62,6 +62,8 @@ private:
void create_text_style(number_format_state & state, office_element_ptr & root_elm);
void create_percentage_style(number_format_state & state, office_element_ptr & root_elm);
void create_numbers(number_format_state & state, office_element_ptr & elm);
};
}

View File

@ -61,6 +61,8 @@ void odf_style_state::set_parent_style_name(std::wstring & name)
style* style_ = dynamic_cast<style*>(odf_style_.get());
if (!style_)return;
if (name == style_->style_name_)
return;
style_->style_parent_style_name_ = name;
}
void odf_style_state::set_data_style_name(std::wstring & name)

View File

@ -13,7 +13,68 @@
namespace cpdoccore {
namespace odf {
namespace utils
{
size_t getColAddressInv(const std::wstring & a_)
{
std::wstring a = a_;
::boost::algorithm::to_upper(a);
static const size_t r = (L'Z' - L'A' + 1);
size_t mul = 1;
bool f = true;
size_t res = 0;
BOOST_REVERSE_FOREACH(const wchar_t c, a)
{
size_t v = c - L'A';
if (f)
f = false;
else
v += 1;
res += v * mul;
mul *= r;
}
return res;
}
size_t getRowAdderssInv(const std::wstring & a_)
{
int sz = a_.length();
if (a_.length()>0)
{
return boost::lexical_cast<size_t>(a_)-1;
}
else
return 0;
}
void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring & row)
{
std::wstring a = a_;
std::reverse(a.begin(), a.end());
::boost::algorithm::replace_all(a, L"$", L"");
//::boost::algorithm::replace_all(a, L"'", L"");
::boost::algorithm::to_upper(a);
BOOST_FOREACH(wchar_t c, a)
{
if (c >= L'0' && c <= L'9')
row +=c;
else
col += c;
}
std::reverse(col.begin(), col.end());
std::reverse(row.begin(), row.end());
}
void parsing_ref (const std::wstring & ref, int & col,int & row)
{
std::wstring strCol, strRow;
splitCellAddress(ref,strCol,strRow);
col = getColAddressInv(strCol)+1;
row = getRowAdderssInv(strRow)+1;
}
}
ods_conversion_context::ods_conversion_context(package::odf_document * outputDocument)
: odf_conversion_context(outputDocument), table_context_(*this), current_text_context_(NULL)
{
@ -36,6 +97,23 @@ void ods_conversion_context::start_sheet(std::wstring & name)
}
void ods_conversion_context::set_sheet_dimension(std::wstring & ref)
{
std::vector<std::wstring> ref_cells;
boost::algorithm::split(ref_cells,ref, boost::algorithm::is_any_of(L":"), boost::algorithm::token_compress_on);
int max_col = 0, max_row = 0;
for (long i=0; i<ref_cells.size(); i++)
{
int col = -1, row = -1;
utils::parsing_ref (ref_cells[i], col, row);
if (col > max_col) max_col = col;
if (col > max_row) max_row = row;
}
current_table().set_table_dimension(max_col,max_row);
}
void ods_conversion_context::end_sheet()
{
table_context_.end_table();
@ -98,72 +176,13 @@ void ods_conversion_context::start_row(int _start_row, int repeated, int level,
void ods_conversion_context::end_row()
{
//add default last cells
int repeated = 1024;
int repeated = 1024;// max dimension columns???
office_element_ptr default_cell_elm;
create_element(L"table", L"table-cell",default_cell_elm,this);
current_table().add_default_cell(default_cell_elm, repeated);
}
size_t getColAddressInv(const std::wstring & a_)
{
std::wstring a = a_;
::boost::algorithm::to_upper(a);
static const size_t r = (L'Z' - L'A' + 1);
size_t mul = 1;
bool f = true;
size_t res = 0;
BOOST_REVERSE_FOREACH(const wchar_t c, a)
{
size_t v = c - L'A';
if (f)
f = false;
else
v += 1;
res += v * mul;
mul *= r;
}
return res;
}
size_t getRowAdderssInv(const std::wstring & a_)
{
int sz = a_.length();
if (a_.length()>0)
{
return boost::lexical_cast<size_t>(a_)-1;
}
else
return 0;
}
void splitCellAddress(const std::wstring & a_, std::wstring & col, std::wstring & row)
{
std::wstring a = a_;
std::reverse(a.begin(), a.end());
::boost::algorithm::replace_all(a, L"$", L"");
//::boost::algorithm::replace_all(a, L"'", L"");
::boost::algorithm::to_upper(a);
BOOST_FOREACH(wchar_t c, a)
{
if (c >= L'0' && c <= L'9')
row +=c;
else
col += c;
}
std::reverse(col.begin(), col.end());
std::reverse(row.begin(), row.end());
}
void parsing_ref (const std::wstring & ref, int & col,int & row)
{
std::wstring strCol, strRow;
splitCellAddress(ref,strCol,strRow);
col = getColAddressInv(strCol)+1;
row = getRowAdderssInv(strRow)+1;
}
void ods_conversion_context::add_hyperlink(std::wstring & ref, std::wstring & link, std::wstring & display)
@ -177,8 +196,8 @@ void ods_conversion_context::add_hyperlink(std::wstring & ref, std::wstring & li
int start_col = -1, start_row = -1;
int end_col = -1, end_row = -1;
parsing_ref (ref_cells[0], start_col, start_row);
parsing_ref (ref_cells[1], end_col, end_row);
utils::parsing_ref (ref_cells[0], start_col, start_row);
utils::parsing_ref (ref_cells[1], end_col, end_row);
for (long col = start_col; col <= end_col; col++)
{
@ -192,7 +211,7 @@ void ods_conversion_context::add_hyperlink(std::wstring & ref, std::wstring & li
else
{
int col = -1, row = -1;
parsing_ref (ref_cells[0], col, row);
utils::parsing_ref (ref_cells[0], col, row);
current_table().add_hyperlink(ref,col,row,link);
}
}
@ -207,8 +226,8 @@ void ods_conversion_context::add_merge_cells(std::wstring & ref)
int start_col = -1, start_row = -1;
int end_col = -1, end_row = -1;
parsing_ref (ref_cells[0], start_col, start_row);
parsing_ref (ref_cells[1], end_col, end_row);
utils::parsing_ref (ref_cells[0], start_col, start_row);
utils::parsing_ref (ref_cells[1], end_col, end_row);
current_table().set_merge_cells(start_col,start_row, end_col, end_row);
@ -217,7 +236,7 @@ void ods_conversion_context::add_merge_cells(std::wstring & ref)
void ods_conversion_context::start_cell(std::wstring & ref, int xfd_style)
{
int col=0, row=0;
parsing_ref ( ref, col,row);
utils::parsing_ref ( ref, col,row);
if (col > current_table().current_column()+1)
{
@ -267,8 +286,11 @@ void ods_conversion_context::end_columns()
{
//add default last column - <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (1024 - <20><> <20><><EFBFBD><EFBFBD><EFBFBD>)
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> - <20><><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>???
if (current_table().current_column() < 1 )
add_column(current_table().current_column()+1,1024,0,true);
//if (current_table().current_column() < 1 )
// add_column(current_table().current_column()+1,1024,0,true);
//else
int repeat = current_table().dimension_columns - current_table().current_column();
add_column(current_table().current_column()+1,repeat,0,true);
}
void ods_conversion_context::start_rows()
{
@ -276,7 +298,9 @@ void ods_conversion_context::start_rows()
void ods_conversion_context::end_rows()
{
//add default last row
start_row(current_table().current_row()+1,1024,0,true);
int repeat = current_table().dimension_row - current_table().current_row();
start_row(current_table().current_row()+1,repeat,0,true);
end_row();
}

View File

@ -17,6 +17,7 @@ public:
virtual void start_document();
void start_sheet(std::wstring & name);
void set_sheet_dimension(std::wstring & ref);
void end_sheet();
void start_columns();

View File

@ -17,6 +17,56 @@
namespace cpdoccore {
namespace odf {
//////////////////////////////////////////// <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> .. <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD> <20><> <20> utils ???
namespace utils
{
std::wstring convert_date(std::wstring & oox_date)
{
int iDate = boost::lexical_cast<int>(oox_date);
boost::gregorian::date date_ = boost::gregorian::date(1900, 1, 1) + boost::gregorian::date_duration(iDate-2);
//to for example, "1899-12-31T05:37:46.66569
std::wstring date_str = boost::lexical_cast<std::wstring>(date_.year())
+ L"-" +
(date_.month() < 10 ? L"0": L"") + boost::lexical_cast<std::wstring>(date_.month())
+ L"-" +
(date_.day() < 10 ? L"0": L"") + boost::lexical_cast<std::wstring>(date_.day());
return date_str;
}
std::wstring convert_time(std::wstring & oox_time)
{
//PT12H15M42S
int hours=0, minutes=0;
double sec=0;
double dTime = boost::lexical_cast<double>(oox_time);
boost::posix_time::time_duration day(24, 0, 0);
double millisec = day.total_milliseconds() * dTime;
sec = millisec /1000.;
hours = sec/60./60.;
minutes = (sec - (hours * 60 * 60))/60.;
sec = sec - (hours *60 + minutes) * 60.;
int sec1 = sec;
std::wstring time_str = std::wstring(L"PT") +
(hours < 10 ? L"0" : L"") + boost::lexical_cast<std::wstring>(hours)
+ std::wstring(L"H") +
(minutes < 10 ? L"0" : L"") + boost::lexical_cast<std::wstring>(minutes)
+ std::wstring(L"M") +
(sec1 < 10 ? L"0" : L"") + boost::lexical_cast<std::wstring>(sec1)
+ std::wstring(L"S");
return time_str;
}
};
///////////////////////////////////////////////////////////////
ods_table_state::ods_table_state(ods_conversion_context & Context, office_element_ptr & elm): context_(Context)
{
@ -29,6 +79,11 @@ ods_table_state::ods_table_state(ods_conversion_context & Context, office_elemen
current_level_.push_back(office_table_);
//default dimension
dimension_columns = 1024;
dimension_row = 1024;
}
void ods_table_state::set_table_name(std::wstring name)
@ -140,8 +195,12 @@ void ods_table_state::set_column_optimal_width(bool val)
}
void ods_table_state::set_table_dimension(std::wstring ref)
void ods_table_state::set_table_dimension(int col, int row)
{
if (col<1 || row <1 )return;
dimension_columns = col +1;
dimension_row = row+1;
}
void ods_table_state::add_row(office_element_ptr & elm, int repeated,office_element_ptr & style_elm)
@ -426,12 +485,14 @@ void ods_table_state::set_cell_value(std::wstring & value)
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_boolean_value_ = value;
break;
case office_value_type::Date:
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_date_value_ = value;
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_date_value_ = utils::convert_date(value);
break;
case office_value_type::Time:
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_time_value_ = value;
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_time_value_ = utils::convert_time(value);
break;
case office_value_type::Currency:
case office_value_type::Percentage:
case office_value_type::Float:
default:
cell->table_table_cell_attlist_.common_value_and_type_attlist_->office_value_ = value;
}

View File

@ -59,7 +59,7 @@ public:
void set_table_style(office_element_ptr & _style);
void set_table_hidden(bool Val);
void set_table_tab_color(_CP_OPT(color) & _color);
void set_table_dimension(std::wstring ref);
void set_table_dimension(int col, int row);
void add_column(office_element_ptr & elm, int repeated ,office_element_ptr & style);
void set_column_width(int width);
@ -102,6 +102,8 @@ public:
int current_column() const;
int current_row() const;
int dimension_columns;
int dimension_row;
//
// xlsx_table_metrics & get_table_metrics() { return xlsx_table_metrics_; }
// xlsx_drawing_context & get_drawing_context() { return xlsx_drawing_context_; }
@ -111,6 +113,7 @@ public:
// double table_column_last_width() const { return table_column_last_width_; };
private:
ods_conversion_context & context_;
office_element_ptr office_table_;

View File

@ -95,6 +95,10 @@ void XlsxConverter::convert_sheets()
}
void XlsxConverter::convert(OOX::Spreadsheet::CWorksheet *oox_sheet)
{
if (oox_sheet->m_oDimension.IsInit())
{
ods_context->set_sheet_dimension(string2std_string(oox_sheet->m_oDimension->m_oRef.get()));
}
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
if (oox_sheet->m_oSheetFormatPr.IsInit())
convert(oox_sheet->m_oSheetFormatPr.GetPointer());
@ -807,7 +811,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool
if (id_parent >=0)
{
odf::odf_style_state *parent_style_state=NULL;
ods_context->styles_context().find_odf_style_state(id_parent, odf::style_family::TableCell,parent_style_state );
ods_context->styles_context().find_odf_style_state(id_parent, odf::style_family::TableCell,parent_style_state, true );
if (parent_style_state)
{