mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-04-07 13:55:33 +08:00
(1.2.0.4): ASCOfficeOdfFileW
border, style borders git-svn-id: svn://fileserver/activex/AVS/Sources/TeamlabOffice/trunk/ServerComponents@55376 954022d7-b5bf-4e40-9824-e11837661b57
This commit is contained in:
committed by
Alexander Trofimov
parent
64190e0ee0
commit
274f2b5937
@ -12,6 +12,190 @@ namespace cpdoccore {
|
||||
namespace odf {
|
||||
|
||||
|
||||
struct def_language_code
|
||||
{
|
||||
std::wstring country;
|
||||
std::wstring country_code;
|
||||
std::wstring language_code;
|
||||
unsigned int id;
|
||||
};
|
||||
|
||||
static const def_language_code LanguageCodeTable[] =
|
||||
{
|
||||
{L"Euro", L"EU", L"en", 0x0002},
|
||||
{L"Afrikaans", L"", L"", 0x0436},
|
||||
{L"Albanian", L"", L"", 0x041C},
|
||||
{L"Arabic", L"", L"", 0x0401},
|
||||
{L"Arabic Algeria", L"", L"", 0x01401},
|
||||
{L"Arabic Bahrain", L"", L"", 0x03C01},
|
||||
{L"Arabic Egypt", L"", L"", 0x0C01},
|
||||
{L"Arabic Iraq", L"", L"", 0x0801},
|
||||
{L"Arabic Jordan", L"", L"", 0x02C01},
|
||||
{L"Arabic Kuwait", L"", L"", 0x03401},
|
||||
{L"Arabic Lebanon", L"", L"", 0x03001},
|
||||
{L"Arabic Libya", L"", L"", 0x01001},
|
||||
{L"Arabic Morocco", L"", L"", 0x01801},
|
||||
{L"Arabic Oman", L"", L"", 0x02001},
|
||||
{L"Arabic Qatar", L"", L"", 0x04001},
|
||||
{L"Arabic Saudi Arabia",L"", L"", 0x0401},
|
||||
{L"Arabic Syria", L"", L"", 0x02801},
|
||||
{L"Arabic Tunisia", L"", L"", 0x01C01},
|
||||
{L"Arabic U.A.E", L"", L"", 0x03801},
|
||||
{L"Arabic Yemen", L"", L"", 0x02401},
|
||||
{L"Armenian", L"", L"", 0x042B},
|
||||
{L"Assamese", L"", L"", 0x044D},
|
||||
{L"Azeri Cyrillic", L"", L"", 0x082C},
|
||||
{L"Azeri Latin", L"", L"", 0x042C},
|
||||
{L"Basque", L"", L"", 0x042D},
|
||||
{L"Belgian Dutch", L"", L"", 0x0813},
|
||||
{L"Belgian French", L"", L"", 0x080C},
|
||||
{L"Bengali", L"", L"", 0x0445},
|
||||
{L"Portuguese (Brazil)",L"", L"", 0x0416},
|
||||
{L"Bulgarian", L"", L"", 0x0402},
|
||||
{L"Burmese", L"", L"", 0x0455},
|
||||
{L"Byelorussian", L"", L"", 0x0423},
|
||||
{L"Catalan", L"", L"", 0x0403},
|
||||
{L"Chinese Hong Kong SAR",L"", L"", 0x0C04},
|
||||
{L"Chinese Macau SAR", L"", L"", 0x01404},
|
||||
{L"Chinese Simplified", L"CN", L"cn", 0x0804},
|
||||
{L"Chinese Singapore", L"", L"", 0x01004},
|
||||
{L"Chinese Traditional",L"CN", L"cn", 0x0404},
|
||||
{L"Croatian", L"", L"", 0x041A},
|
||||
{L"Czech", L"", L"", 0x0405},
|
||||
{L"Danish", L"", L"", 0x0406},
|
||||
{L"Dutch", L"", L"", 0x0413},
|
||||
{L"English Australia", L"", L"en", 0x0C09},
|
||||
{L"English Belize", L"", L"en", 0x02809},
|
||||
{L"English Canadian", L"", L"en", 0x01009},
|
||||
{L"English Caribbean", L"", L"en", 0x02409},
|
||||
{L"English Ireland", L"", L"en", 0x01809},
|
||||
{L"English Jamaica", L"", L"en", 0x02009},
|
||||
{L"English New Zealand",L"", L"en", 0x01409},
|
||||
{L"English Philippines",L"", L"en", 0x03409},
|
||||
{L"English South Africa",L"", L"en", 0x01C09},
|
||||
{L"English Trinidad", L"", L"en", 0x02C09},
|
||||
{L"English U.K.", L"GB",L"en", 0x0809},
|
||||
{L"English U.S.", L"US",L"en", 0x0409},
|
||||
{L"English Zimbabwe", L"", L"en", 0x03009},
|
||||
{L"Estonian", L"EE", L"et",0x0425},
|
||||
{L"Faeroese", L"", L"", 0x0438},
|
||||
{L"Farsi", L"", L"", 0x0429},
|
||||
{L"Finnish", L"", L"", 0x040B},
|
||||
{L"French", L"FR", L"fr", 0x040C},
|
||||
{L"French Cameroon", L"", L"fr", 0x02C0C},
|
||||
{L"French Canadian", L"", L"fr", 0x0C0C},
|
||||
{L"French Cote d'Ivoire",L"", L"fr", 0x0300C},
|
||||
{L"French Luxembourg", L"", L"fr", 0x0140C},
|
||||
{L"French Mali", L"", L"fr", 0x0340C},
|
||||
{L"French Monaco", L"", L"fr", 0x0180C},
|
||||
{L"French Reunion", L"", L"fr", 0x0200C},
|
||||
{L"French Senegal", L"", L"fr", 0x0280C},
|
||||
{L"French West Indies", L"", L"fr", 0x01C0C},
|
||||
{L"French Congo (DRC)", L"", L"fr", 0x0240C},
|
||||
{L"Frisian Netherlands",L"", L"", 0x0462},
|
||||
{L"Gaelic Ireland", L"", L"", 0x083C},
|
||||
{L"Gaelic Scotland", L"", L"", 0x043C},
|
||||
{L"Galician", L"", L"", 0x0456},
|
||||
{L"Georgian", L"", L"", 0x0437},
|
||||
{L"German", L"DE", L"de", 0x0407},
|
||||
{L"German Austria", L"", L"de", 0x0C07},
|
||||
{L"German Liechtenstein",L"", L"de", 0x01407},
|
||||
{L"German Luxembourg", L"", L"de", 0x01007},
|
||||
{L"Greek", L"", L"", 0x0408},
|
||||
{L"Gujarati", L"", L"", 0x0447},
|
||||
{L"Hebrew", L"", L"", 0x040D},
|
||||
{L"Hindi", L"", L"", 0x0439},
|
||||
{L"Hungarian", L"", L"", 0x040E},
|
||||
{L"Icelandic", L"", L"", 0x040F},
|
||||
{L"Indonesian", L"", L"", 0x0421},
|
||||
{L"Italian", L"IT", L"it", 0x0410},
|
||||
{L"Japanese", L"JP",L"jp", 0x0411},
|
||||
{L"Kannada", L"", L"", 0x044B},
|
||||
{L"Kashmiri", L"", L"", 0x0460},
|
||||
{L"Kazakh", L"", L"", 0x043F},
|
||||
{L"Khmer", L"", L"", 0x0453},
|
||||
{L"Kirghiz", L"", L"", 0x0440},
|
||||
{L"Konkani", L"", L"", 0x0457},
|
||||
{L"Korean", L"", L"", 0x0412},
|
||||
{L"Lao", L"", L"", 0x0454},
|
||||
{L"Latvian", L"LT", L"lt", 0x0426},
|
||||
{L"Lithuanian", L"", L"", 0x0427},
|
||||
{L"FYRO Macedonian", L"", L"", 0x042F},
|
||||
{L"Malayalam", L"", L"", 0x044C},
|
||||
{L"Malay Brunei Darussalam", L"", L"", 0x083E},
|
||||
{L"Malaysian", L"", L"", 0x043E},
|
||||
{L"Maltese", L"", L"", 0x043A},
|
||||
{L"Manipuri", L"", L"", 0x0458},
|
||||
{L"Marathi", L"", L"", 0x044E},
|
||||
{L"Mongolian", L"", L"", 0x0450},
|
||||
{L"Nepali", L"", L"", 0x0461},
|
||||
{L"Norwegian Bokmol", L"", L"", 0x0414},
|
||||
{L"Norwegian Nynorsk", L"", L"", 0x0814},
|
||||
{L"Oriya", L"", L"", 0x0448},
|
||||
{L"Polish", L"", L"", 0x0415},
|
||||
{L"Portuguese", L"", L"", 0x0816},
|
||||
{L"Punjabi", L"", L"", 0x0446},
|
||||
{L"Rhaeto-Romanic", L"", L"", 0x0417},
|
||||
{L"Romanian", L"", L"", 0x0418},
|
||||
{L"Romanian Moldova", L"", L"", 0x0818},
|
||||
{L"Russian", L"RU",L"ru", 0x0419},
|
||||
{L"Russian Moldova", L"", L"", 0x0819},
|
||||
{L"Sami Lappish", L"", L"", 0x043B},
|
||||
{L"Sanskrit", L"", L"", 0x044F},
|
||||
{L"Serbian Cyrillic", L"", L"", 0x0C1A},
|
||||
{L"Serbian Latin", L"", L"", 0x081A},
|
||||
{L"Sesotho", L"", L"", 0x0430},
|
||||
{L"Sindhi", L"", L"", 0x0459},
|
||||
{L"Slovak", L"", L"", 0x041B},
|
||||
{L"Slovenian", L"", L"", 0x0424},
|
||||
{L"Sorbian", L"", L"", 0x042E},
|
||||
{L"Spanish (Traditional)", L"ES", L"es", 0x040A},
|
||||
{L"Spanish Argentina", L"", L"", 0x02C0A},
|
||||
{L"Spanish Bolivia", L"", L"", 0x0400A},
|
||||
{L"Spanish Chile", L"", L"", 0x0340A},
|
||||
{L"Spanish Colombia", L"", L"", 0x0240A},
|
||||
{L"Spanish Costa Rica", L"", L"", 0x0140A},
|
||||
{L"Spanish Dominican Republic", L"", L"", 0x01C0A},
|
||||
{L"Spanish Ecuador", L"", L"", 0x0300A},
|
||||
{L"Spanish El Salvador",L"", L"", 0x0440A},
|
||||
{L"Spanish Guatemala", L"", L"", 0x0100A},
|
||||
{L"Spanish Honduras", L"", L"", 0x0480A},
|
||||
{L"Spanish Nicaragua", L"", L"", 0x04C0A},
|
||||
{L"Spanish Panama", L"", L"", 0x0180A},
|
||||
{L"Spanish Paraguay", L"", L"", 0x3C0A},
|
||||
{L"Spanish Peru", L"", L"", 0x0280A},
|
||||
{L"Spanish Puerto Rico",L"", L"", 0x0500A},
|
||||
{L"Spanish Spain (Modern Sort)", L"", L"", 0x0C0A},
|
||||
{L"Spanish Uruguay", L"", L"", 0x0380A},
|
||||
{L"Spanish Venezuela", L"", L"", 0x0200A},
|
||||
{L"Sutu", L"", L"", 0x0430},
|
||||
{L"Swahili", L"", L"", 0x0441},
|
||||
{L"Swedish", L"", L"", 0x041D},
|
||||
{L"Swedish Finland", L"", L"", 0x081D},
|
||||
{L"Swiss French", L"", L"", 0x0100C},
|
||||
{L"Swiss German", L"", L"", 0x0807},
|
||||
{L"Swiss Italian", L"", L"", 0x0810},
|
||||
{L"Tajik", L"", L"", 0x0428},
|
||||
{L"Tamil", L"", L"", 0x0449},
|
||||
{L"Tatar", L"", L"", 0x0444},
|
||||
{L"Telugu", L"", L"", 0x044A},
|
||||
{L"Thai", L"", L"", 0x041E},
|
||||
{L"Tibetan", L"", L"", 0x0451},
|
||||
{L"Tsonga", L"", L"", 0x0431},
|
||||
{L"Tswana", L"", L"", 0x0432},
|
||||
{L"Turkish", L"", L"", 0x041F},
|
||||
{L"Turkmen", L"", L"", 0x0442},
|
||||
{L"Ukrainian", L"UA", L"uk", 0x0422},
|
||||
{L"Urdu", L"", L"", 0x0420},
|
||||
{L"Uzbek Cyrillic", L"", L"", 0x0843},
|
||||
{L"Uzbek Latin", L"", L"", 0x0443},
|
||||
{L"Venda", L"", L"", 0x0433},
|
||||
{L"Vietnamese", L"", L"", 0x042A},
|
||||
{L"Welsh", L"", L"", 0x0452},
|
||||
{L"Xhosa", L"", L"", 0x0434},
|
||||
{L"Zulu", L"", L"", 0x0435}
|
||||
};
|
||||
|
||||
odf_number_styles_context::odf_number_styles_context(odf_conversion_context & Context): context_(Context)
|
||||
{
|
||||
}
|
||||
@ -25,6 +209,8 @@ void odf_number_styles_context::create(int oox_num_fmt, std::wstring formatCode)
|
||||
state.oox_num_fmt = oox_num_fmt;
|
||||
state.style_name = std::wstring(L"NF1000") + boost::lexical_cast<std::wstring>( number_format_array_.size()+1);
|
||||
state.ods_type = office_value_type::Custom;
|
||||
state.language_code=0;
|
||||
|
||||
//////////////////////////////
|
||||
|
||||
boost::algorithm::split(state.format_code, formatCode, boost::algorithm::is_any_of(L";"), boost::algorithm::token_compress_on);
|
||||
@ -48,6 +234,7 @@ void odf_number_styles_context::create_default(int oox_num_fmt, std::wstring for
|
||||
state.oox_num_fmt = oox_num_fmt;
|
||||
state.ods_type = office_value_type::Custom;
|
||||
state.style_name = std::wstring(L"NF1000") + boost::lexical_cast<std::wstring>( number_format_array_.size()+1);
|
||||
state.language_code=0;
|
||||
|
||||
switch (oox_num_fmt)
|
||||
{
|
||||
@ -247,20 +434,61 @@ void odf_number_styles_context::create_currency_style(number_format_state & stat
|
||||
{
|
||||
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);
|
||||
int res1= state.format_code[0].rfind(L"]");
|
||||
int res2= state.format_code[0].rfind(L"#");
|
||||
int res3= state.format_code[0].rfind(L"0");
|
||||
|
||||
number_currency_symbol* number_currency_symbol_ = dynamic_cast<number_currency_symbol*>(elm.get());
|
||||
office_element_ptr elm_symbol;
|
||||
create_element(L"number", L"currency-symbol", elm_symbol, &context_);
|
||||
styles_elments.push_back(elm_symbol);
|
||||
|
||||
number_currency_symbol* number_currency_symbol_ = dynamic_cast<number_currency_symbol*>(elm_symbol.get());
|
||||
if (number_currency_symbol_)
|
||||
{
|
||||
std::wstring number_country,number_language;
|
||||
|
||||
for (long i=0; state.language_code >0 && i < sizeof(LanguageCodeTable)/sizeof(def_language_code); i++)
|
||||
{
|
||||
if (LanguageCodeTable[i].id == state.language_code)
|
||||
{
|
||||
number_country = LanguageCodeTable[i].country_code;
|
||||
number_language = LanguageCodeTable[i].language_code;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (number_country.length()>0)
|
||||
{
|
||||
number_currency_symbol_->number_country_ = number_country;
|
||||
}
|
||||
if (number_language.length()>0)
|
||||
{
|
||||
number_currency_symbol_->number_language_ = number_language;
|
||||
}
|
||||
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);
|
||||
///////////////////
|
||||
office_element_ptr elm_number;
|
||||
create_numbers(state, elm_number);
|
||||
//////////////////////////////////////////
|
||||
office_element_ptr elm_text;
|
||||
create_element(L"number", L"text", elm_text, &context_);
|
||||
number_text* number_text_ = dynamic_cast<number_text*>(elm_text.get());
|
||||
if (number_text_)number_text_->add_text(L" ");
|
||||
styles_elments.push_back(elm_text);
|
||||
////////////////////////////////////////////
|
||||
if (res1 > res2 || res1 > res3)
|
||||
{
|
||||
root_elm->add_child_element(elm_number);
|
||||
root_elm->add_child_element(elm_text);
|
||||
root_elm->add_child_element(elm_symbol);
|
||||
}
|
||||
else
|
||||
{
|
||||
root_elm->add_child_element(elm_symbol);
|
||||
root_elm->add_child_element(elm_text);
|
||||
root_elm->add_child_element(elm_number);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -276,7 +504,7 @@ void odf_number_styles_context::create_date_style(number_format_state & state, o
|
||||
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
|
||||
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)
|
||||
@ -440,12 +668,19 @@ void odf_number_styles_context::detect_format(number_format_state & state)
|
||||
boost::wregex re(L"(?:\\[)(?:\\$)(\\S+)?\-(\\S+)(?:\\])");
|
||||
boost::wsmatch result;
|
||||
bool b = boost::regex_search(state.format_code[0], result, re);
|
||||
|
||||
if (b && result.size()==3)
|
||||
{
|
||||
state.currency_str=result[1];
|
||||
state.language_code=result[2];
|
||||
int code = -1;
|
||||
try
|
||||
{
|
||||
std::wstringstream ss;
|
||||
ss << std::hex << result[2];
|
||||
ss >> state.language_code;
|
||||
}catch(...){}
|
||||
|
||||
state.format_code[0] = boost::regex_replace( state.format_code[0],re,L"");
|
||||
//state.format_code[0] = boost::regex_replace( state.format_code[0],re,L"");
|
||||
}
|
||||
if (state.currency_str.length()>0)
|
||||
{
|
||||
@ -458,14 +693,17 @@ void odf_number_styles_context::detect_format(number_format_state & state)
|
||||
{
|
||||
int res=0;
|
||||
if ((res=tmp.find(L"at"))>=0 || (res=tmp.find(L"pm"))>=0 ||
|
||||
(res=tmp.find(L"h"))>=0 || (res=tmp.find(L"s"))>=0 || state.language_code == L"F400")
|
||||
(res=tmp.find(L"h"))>=0 || (res=tmp.find(L"s"))>=0 || state.language_code == 0xF400)
|
||||
{
|
||||
state.ods_type = office_value_type::Time;
|
||||
if (b)state.format_code[0] = boost::regex_replace( state.format_code[0],re,L"");
|
||||
return;
|
||||
}
|
||||
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;
|
||||
|
||||
if (b)state.format_code[0] = boost::regex_replace( state.format_code[0],re,L"");
|
||||
return;
|
||||
}
|
||||
if ((res=tmp.find(L"%"))>=0)
|
||||
@ -484,6 +722,7 @@ void odf_number_styles_context::detect_format(number_format_state & state)
|
||||
else if (state.format_code.size() == 3)//>0, <0, ==0
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@ struct number_format_state
|
||||
|
||||
std::wstring style_name;
|
||||
|
||||
std::wstring language_code;
|
||||
unsigned int language_code;
|
||||
std::wstring currency_str;
|
||||
};
|
||||
|
||||
|
||||
@ -459,6 +459,16 @@ void ods_table_state::set_cell_text(odf_text_context* text_context)
|
||||
cells_.back().elm->add_child_element(text_context->text_elements_list_[i].elm);
|
||||
}
|
||||
}
|
||||
style* style_ = dynamic_cast<style*>(cells_.back().style_elm.get());
|
||||
if (!style_)return;
|
||||
|
||||
odf::style_table_cell_properties * table_cell_properties = style_->style_content_.get_style_table_cell_properties();
|
||||
|
||||
if (table_cell_properties)
|
||||
{
|
||||
table_cell_properties->style_table_cell_properties_attlist_.fo_wrap_option_ = odf::wrap_option(odf::wrap_option::Wrap);
|
||||
table_cell_properties->style_table_cell_properties_attlist_.style_text_align_source_ = odf::text_align_source(odf::text_align_source::Fix);
|
||||
}
|
||||
}
|
||||
void ods_table_state::set_cell_value(std::wstring & value)
|
||||
{
|
||||
|
||||
@ -651,8 +651,121 @@ void XlsxConverter::convert(OOX::Spreadsheet::CBorder *border, odf::style_table_
|
||||
{
|
||||
if (!border)return;
|
||||
|
||||
if (border->m_oBottom.IsInit())
|
||||
{
|
||||
std::wstring odf_border;
|
||||
convert(border->m_oBottom.GetPointer(), odf_border);
|
||||
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_bottom_ = odf_border;
|
||||
}
|
||||
if (border->m_oTop.IsInit())
|
||||
{
|
||||
std::wstring odf_border;
|
||||
convert(border->m_oTop.GetPointer(), odf_border);
|
||||
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_top_ = odf_border;
|
||||
}
|
||||
if (border->m_oStart.IsInit())
|
||||
{
|
||||
std::wstring odf_border;
|
||||
convert(border->m_oStart.GetPointer(), odf_border);
|
||||
if (odf_border.length()>0)
|
||||
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_left_ = odf_border;
|
||||
}
|
||||
if (border->m_oEnd.IsInit())
|
||||
{
|
||||
std::wstring odf_border;
|
||||
convert(border->m_oEnd.GetPointer(), odf_border);
|
||||
if (odf_border.length()>0)
|
||||
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ = odf_border;
|
||||
}
|
||||
if (border->m_oEnd.IsInit())
|
||||
{
|
||||
std::wstring odf_border;
|
||||
convert(border->m_oEnd.GetPointer(), odf_border);
|
||||
if (odf_border.length()>0)
|
||||
cell_properties->style_table_cell_properties_attlist_.common_border_attlist_.fo_border_right_ = odf_border;
|
||||
}
|
||||
if (border->m_oDiagonal.IsInit())
|
||||
{
|
||||
std::wstring odf_border;
|
||||
convert(border->m_oDiagonal.GetPointer(), odf_border);
|
||||
if (border->m_oDiagonalDown.IsInit() && odf_border.length()>0) //and true???
|
||||
cell_properties->style_table_cell_properties_attlist_.style_diagonal_tl_br_= odf_border;
|
||||
if (border->m_oDiagonalUp.IsInit() && odf_border.length()>0) //and true???
|
||||
cell_properties->style_table_cell_properties_attlist_.style_diagonal_bl_tr_= odf_border;
|
||||
}
|
||||
//nullable<CBorderProp> m_oHorizontal;
|
||||
//nullable<CBorderProp> m_oVertical;
|
||||
//nullable<SimpleTypes::COnOff<>> m_oOutline;
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CBorderProp *borderProp, std::wstring & odf_border_prop)
|
||||
{
|
||||
if (!borderProp)return;
|
||||
|
||||
std::wstring border_style;
|
||||
std::wstring border_color;
|
||||
|
||||
if (borderProp->m_oStyle.IsInit())
|
||||
{
|
||||
switch(borderProp->m_oStyle->GetValue())
|
||||
{
|
||||
case SimpleTypes::Spreadsheet::borderstyleDashDot:
|
||||
border_style = L"1pt dot-dashed";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleDashDotDot:
|
||||
border_style = L"1pt dot-dashed";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleDashed:
|
||||
border_style = L"1pt dashed";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleDotted:
|
||||
border_style = L"1pt dotted";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleDouble:
|
||||
border_style = L"1pt double";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleHair:
|
||||
border_style = L"1pt solid";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleMedium:
|
||||
border_style = L"2.49pt solid";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleMediumDashDot:
|
||||
border_style = L"2.49pt dot-dashed";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleMediumDashDotDot:
|
||||
border_style = L"2.49pt dot-dashed";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleMediumDashed:
|
||||
border_style = L"2.49pt dashed";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleNone:
|
||||
border_style = L"none";
|
||||
return;
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleSlantDashDot:
|
||||
border_style = L"1pt solid";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleThick:
|
||||
border_style = L"1pt solid";
|
||||
break;
|
||||
case SimpleTypes::Spreadsheet::borderstyleThin:
|
||||
border_style = L"1pt solid";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else return;
|
||||
|
||||
if (borderProp->m_oColor.IsInit())
|
||||
{
|
||||
_CP_OPT(odf::color) odf_color;
|
||||
convert(borderProp->m_oColor.GetPointer(), odf_color);
|
||||
if (odf_color)
|
||||
border_color = L" #" + odf_color->get_hex_value();
|
||||
}
|
||||
if (border_color.length()<1)border_color = L" #000000";
|
||||
|
||||
odf_border_prop = border_style + border_color;
|
||||
}
|
||||
void XlsxConverter::convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf::color) & odf_color)//<2F><><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> odf type???
|
||||
{
|
||||
if (!color)return;
|
||||
@ -800,12 +913,6 @@ void XlsxConverter::convert(OOX::Spreadsheet::CXfs * xfc_style, int oox_id, bool
|
||||
convert(xlsx_styles->m_oBorders->m_arrItems[border_id], table_cell_properties);
|
||||
}
|
||||
|
||||
|
||||
if (table_cell_properties)
|
||||
{//default
|
||||
//table_cell_properties->style_table_cell_properties_attlist_.fo_wrap_option_ = odf::wrap_option(odf::wrap_option::Wrap);
|
||||
//table_cell_properties->style_table_cell_properties_attlist_.style_text_align_source_ = odf::text_align_source(odf::text_align_source::Fix);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
if (id_parent >=0)
|
||||
|
||||
@ -87,6 +87,7 @@ namespace Oox2Odf
|
||||
|
||||
void convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf::color) & odf_color);
|
||||
void convert(OOX::Spreadsheet::CColor *color, _CP_OPT(odf::background_color) & odf_bckgrd_color);
|
||||
void convert(OOX::Spreadsheet::CBorderProp *borderProp, std::wstring & odf_border_prop);
|
||||
|
||||
void convert(double oox_font_size, _CP_OPT(odf::font_size) & odf_font_size);
|
||||
void convert(double oox_size, _CP_OPT(odf::length) & odf_size);
|
||||
|
||||
@ -2,6 +2,6 @@
|
||||
//1
|
||||
//2
|
||||
//0
|
||||
//3
|
||||
#define INTVER 1,2,0,3
|
||||
#define STRVER "1,2,0,3\0"
|
||||
//4
|
||||
#define INTVER 1,2,0,4
|
||||
#define STRVER "1,2,0,4\0"
|
||||
|
||||
Reference in New Issue
Block a user