fdo#78384: Fix for corruption if file contains symbols.

* In case of symbol, symbol character get imported first and then font of symbols.
* So we are storing symbol character and when we parse symbol font then create UNO object for text.

Change-Id: If5b79521c6a59aec02b165e8120dafdd472cdaeb
Reviewed-on: https://gerrit.libreoffice.org/9281
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Tested-by: Miklos Vajna <vmiklos@collabora.co.uk>
This commit is contained in:
Rohit Deshmukh 2014-05-08 16:33:44 +05:30 committed by Miklos Vajna
parent decfecc3d2
commit f51640c5f4
5 changed files with 32 additions and 1 deletions

Binary file not shown.

View File

@ -3321,6 +3321,13 @@ DECLARE_OOXMLEXPORT_TEST(testFDO78284, "fdo78284.docx")
"image/png");
}
DECLARE_OOXMLEXPORT_TEST(testFDO78384,"fdo78384.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r[1]/w:rPr/w:rFonts","ascii","Wingdings");
}
#endif
CPPUNIT_PLUGIN_IMPLEMENT();

View File

@ -239,7 +239,7 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
}
else //it's a _real_ symbol
{
utext( reinterpret_cast < const sal_uInt8 * >( &nIntValue ), 1 );
m_pImpl->SetSymbolData(nIntValue);
}
break;
case NS_ooxml::LN_CT_Sym_font:
@ -253,7 +253,16 @@ void DomainMapper::lcl_attribute(Id nName, Value & val)
}
else //a real symbol
if (m_pImpl->GetTopContext())
{
m_pImpl->GetTopContext()->Insert(PROP_CHAR_FONT_NAME, uno::makeAny( sStringValue ));
/*
* In case of symbol, symbol character get imported first and then font of symbols.
* So we are storing symbol character and when we parse symbol font then create UNO object for text.
*/
sal_Int32 symboldata = m_pImpl->GetSymbolData();
utext( reinterpret_cast < const sal_uInt8 * >( &(symboldata) ), 1 );
}
break;
case NS_ooxml::LN_CT_Underline_val:
handleUnderlineType(nIntValue, m_pImpl->GetTopContext());

View File

@ -164,6 +164,7 @@ DomainMapper_Impl::DomainMapper_Impl(
m_bTOCPageRef(false),
m_bStartGenericField(false),
m_bTextInserted(false),
m_nSymboldata(-1),
m_pLastSectionContext( ),
m_pLastCharacterContext(),
m_nCurrentTabStopIndex( 0 ),
@ -375,6 +376,16 @@ void DomainMapper_Impl::RemoveLastParagraph( )
}
}
void DomainMapper_Impl::SetSymbolData( bool nSymbolData )
{
m_nSymboldata = nSymbolData;
}
sal_Int32 DomainMapper_Impl::GetSymbolData()
{
return m_nSymboldata;
}
void DomainMapper_Impl::SetIsLastParagraphInSection( bool bIsLast )
{
m_bIsLastParaInSection = bIsLast;

View File

@ -331,6 +331,7 @@ private:
BookmarkMap_t m_aBookmarkMap;
_PageMar m_aPageMargins;
sal_Int32 m_nSymboldata;
// TableManagers are stacked: one for each stream to avoid any confusion
@ -466,6 +467,9 @@ public:
bool GetIsTextFrameInserted();
void SetParaSectpr(bool bParaSectpr);
bool GetParaSectpr();
void SetSymbolData( bool nSymbolData );
sal_Int32 GetSymbolData();
/// Setter method for m_bSdt.
void SetSdt(bool bSdt);
/// Getter method for m_bSdt.