Commit 7eee0755 authored by ElenaSubbotina's avatar ElenaSubbotina

RtfFormatReader - generate replacement text hyperlink if absent

parent c329f29e
...@@ -1381,10 +1381,20 @@ private: ...@@ -1381,10 +1381,20 @@ private:
std::vector<std::wstring> arResult; std::vector<std::wstring> arResult;
boost::algorithm::split(arResult, sField, boost::algorithm::is_any_of(L" \""), boost::algorithm::token_compress_on); boost::algorithm::split(arResult, sField, boost::algorithm::is_any_of(L" \""), boost::algorithm::token_compress_on);
if (arResult.size()< 1) while (!arResult.empty())
{
if (arResult[0].empty())
arResult.erase( arResult.begin(), arResult.begin() + 1 );
else
break;
}
if (arResult.empty())
return; return;
if (L"SYMBOL" != arResult[0])
if (L"SYMBOL" != arResult[0] && L"HYPERLINK" != arResult[0])
return; return;
nStartTokenize = arResult[0].length(); nStartTokenize = arResult[0].length();
for (size_t i = 1 ; i < arResult.size(); i++) for (size_t i = 1 ; i < arResult.size(); i++)
...@@ -1429,9 +1439,11 @@ private: ...@@ -1429,9 +1439,11 @@ private:
nStartTokenize += (int)sResTokenize.length(); nStartTokenize += (int)sResTokenize.length();
} }
if( L"" == sCharCode || L"" == sCharFont )
return;
std::wstring sResult;
if ( L"SYMBOL" == arResult[0])
{
if ( L"" == sCharCode || L"" == sCharFont ) return;
int nCharCode = Strings::ToInteger( sCharCode ); int nCharCode = Strings::ToInteger( sCharCode );
std::string sCharA; sCharA += char(nCharCode ); std::string sCharA; sCharA += char(nCharCode );
...@@ -1450,20 +1462,31 @@ private: ...@@ -1450,20 +1462,31 @@ private:
int nSkipChar = 0; int nSkipChar = 0;
RtfAbstractReader reader; RtfAbstractReader reader;
sResult = reader.ExecuteTextInternal( oDocument, oReader, sCharA, false, 0, nSkipChar );
}
else if ( L"HYPERLINK" == arResult[0])
{
sResult = sCharCode;
}
std::wstring sResultSymbol = reader.ExecuteTextInternal( oDocument, oReader, sCharA, false, 0, nSkipChar ); if (sResult.empty()) return;
//свойства копировать ? ващето есть дубль - проверить
m_oField.m_pResult = RtfFieldInstPtr ( new RtfFieldInst() ); RtfFieldInstPtr newResult = RtfFieldInstPtr ( new RtfFieldInst() );
m_oField.m_pResult->SetDefault(); newResult->SetDefault();
RtfParagraphPtr pNewPar ( new RtfParagraph() ); RtfParagraphPtr pNewPar ( new RtfParagraph() );
RtfCharPtr pNewChar( new RtfChar() ); RtfCharPtr pNewChar( new RtfChar() );
pNewChar->setText( sResultSymbol ); pNewChar->setText( sResult);
pNewChar->m_oProperty = oReader.m_oState->m_oCharProp; pNewChar->m_oProperty = m_oField.m_pResult->m_oCharProperty;
pNewPar->AddItem( pNewChar ); pNewPar->AddItem( pNewChar );
m_oField.m_pResult->m_pTextItems->AddItem( pNewPar ); newResult->m_pTextItems->AddItem( pNewPar );
newResult->m_oCharProperty = m_oField.m_pResult->m_oCharProperty;
m_oField.m_pResult = newResult;
if ( L"SYMBOL" == arResult[0])
m_oField.m_bTextOnly = true; m_oField.m_bTextOnly = true;
} }
}; };
......
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