Compare commits

...

2 Commits

Author SHA1 Message Date
4b68d3294c . 2019-07-02 16:12:51 +03:00
24b44f6b03 [x2t] Fix writing m:oMath inside w:hyperlink 2019-07-02 14:02:16 +03:00
4 changed files with 41 additions and 41 deletions

View File

@ -4236,15 +4236,15 @@ int Binary_DocumentTableReader::ReadParagraphContent(BYTE type, long length, voi
}
else if ( c_oSerParType::OMathPara == type )
{
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<m:oMathPara>")));
GetRunStringWriter().WriteString(std::wstring(_T("<m:oMathPara>")));
READ1_DEF(length, res, this->ReadMathOMathPara, poResult);
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</m:oMathPara>")));
GetRunStringWriter().WriteString(std::wstring(_T("</m:oMathPara>")));
}
else if ( c_oSerParType::OMath == type )
{
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("<m:oMath>")));
GetRunStringWriter().WriteString(std::wstring(_T("<m:oMath>")));
READ1_DEF(length, res, this->ReadMathArg, poResult);
m_oDocumentWriter.m_oContent.WriteString(std::wstring(_T("</m:oMath>")));
GetRunStringWriter().WriteString(std::wstring(_T("</m:oMath>")));
}
else if ( c_oSerParType::MRun == type )
{

View File

@ -1060,49 +1060,46 @@ void ods_table_state::add_or_find_cell_shared_formula(std::wstring & formula, st
if (col2 - col1 > 0)moving_type = 1;
}
ods_shared_formula_state state = {(unsigned int)ind, odf_formula,ref, current_table_column_,current_table_row_, moving_type};
shared_formulas_.push_back(state);
shared_formulas_.insert(std::make_pair((unsigned int)ind, state));
cell->attlist_.table_formula_ = odf_formula;
cells_.back().empty = false;
}
else
{
for ( size_t i = 0; i < shared_formulas_.size(); i++)
std::map<unsigned int, ods_shared_formula_state>::iterator pFind = shared_formulas_.find(ind);
if (pFind != shared_formulas_.end())
{
if (shared_formulas_[i].index == ind)
{
odf_formula = shared_formulas_[i].formula;
odf_formula = pFind->second.formula;
//поменять по ref формулу !!!
if (shared_formulas_[i].moving_type == 1)
{
tmp_column_ = shared_formulas_[i].base_column;
tmp_row_ = shared_formulas_[i].base_row;
const std::wstring res = boost::regex_replace(
odf_formula,
boost::wregex(L"([a-zA-Z]{1,3}[0-9]{1,3})|(?='.*?')|(?=\".*?\")"),
&ods_table_state::replace_cell_column,
boost::match_default | boost::format_all);
odf_formula = res;
}
else if (shared_formulas_[i].moving_type == 2)
{
tmp_column_ = shared_formulas_[i].base_column;
tmp_row_ = shared_formulas_[i].base_row;
const std::wstring res = boost::regex_replace(
odf_formula,
boost::wregex(L"([a-zA-Z]{1,3}[0-9]{1,3})|(?='.*?')|(?=\".*?\")"),
&ods_table_state::replace_cell_row,
boost::match_default | boost::format_all);
odf_formula = res;
}
cell->attlist_.table_formula_ = odf_formula;
cells_.back().empty = false;
//поменять по ref формулу !!!
if (pFind->second.moving_type == 1)
{
tmp_column_ = pFind->second.base_column;
tmp_row_ = pFind->second.base_row;
break;
const std::wstring res = boost::regex_replace(
odf_formula,
boost::wregex(L"([a-zA-Z]{1,3}[0-9]{1,3})|(?='.*?')|(?=\".*?\")"),
&ods_table_state::replace_cell_column,
boost::match_default | boost::format_all);
odf_formula = res;
}
else if (pFind->second.moving_type == 2)
{
tmp_column_ = pFind->second.base_column;
tmp_row_ = pFind->second.base_row;
const std::wstring res = boost::regex_replace(
odf_formula,
boost::wregex(L"([a-zA-Z]{1,3}[0-9]{1,3})|(?='.*?')|(?=\".*?\")"),
&ods_table_state::replace_cell_row,
boost::match_default | boost::format_all);
odf_formula = res;
}
cell->attlist_.table_formula_ = odf_formula;
cells_.back().empty = false;
}
}
}

View File

@ -454,7 +454,7 @@ private:
long cells_size_;
std::vector<ods_hyperlink_state> hyperlinks_;
std::vector<ods_shared_formula_state> shared_formulas_;
std::map<unsigned int, ods_shared_formula_state> shared_formulas_;
std::vector<table_part_state> table_parts_;

View File

@ -136,8 +136,8 @@ bool OOXShapeReader::ParseVmlStyle(RtfShapePtr pShape, SimpleTypes::Vml::CCssPro
{
case SimpleTypes::Vml::cssmsoposhorrelMargin: pShape->m_eXAnchor = RtfShape::ax_margin; break;
case SimpleTypes::Vml::cssmsoposhorrelPage: pShape->m_eXAnchor = RtfShape::ax_page; break;
case SimpleTypes::Vml::cssmsoposhorrelText:
case SimpleTypes::Vml::cssmsoposhorrelChar: break;//inline
case SimpleTypes::Vml::cssmsoposhorrelText: break; //???
case SimpleTypes::Vml::cssmsoposhorrelChar: pShape->m_eAnchorTypeShape = RtfShape::st_inline; break;//inline
}
}break;
case SimpleTypes::Vml::cssptMsoPositionVertical:
@ -194,7 +194,10 @@ bool OOXShapeReader::ParseVmlStyle(RtfShapePtr pShape, SimpleTypes::Vml::CCssPro
break;
case SimpleTypes::Vml::cssptZIndex :
{
pShape->m_eAnchorTypeShape = RtfShape::st_anchor;
if (pShape->m_eAnchorTypeShape == RtfShape::st_none)
{
pShape->m_eAnchorTypeShape = RtfShape::st_anchor;
}
int nValue = prop->get_Value().oZIndex.nOrder;
pShape->m_nZOrder = nValue;