From f51640c5f40d5132b396a9fb6589420383df1610 Mon Sep 17 00:00:00 2001 From: Rohit Deshmukh Date: Thu, 8 May 2014 16:33:44 +0530 Subject: [PATCH] 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 Tested-by: Miklos Vajna --- sw/qa/extras/ooxmlexport/data/fdo78384.docx | Bin 0 -> 13134 bytes sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 7 +++++++ writerfilter/source/dmapper/DomainMapper.cxx | 11 ++++++++++- .../source/dmapper/DomainMapper_Impl.cxx | 11 +++++++++++ .../source/dmapper/DomainMapper_Impl.hxx | 4 ++++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 sw/qa/extras/ooxmlexport/data/fdo78384.docx diff --git a/sw/qa/extras/ooxmlexport/data/fdo78384.docx b/sw/qa/extras/ooxmlexport/data/fdo78384.docx new file mode 100644 index 0000000000000000000000000000000000000000..ee102648f16b7324cc06068ceb464fc064f38b63 GIT binary patch literal 13134 zcmeHuWprCvueKXzW@e_Q;k039W@ctilZKg@nG=W8FgMKDK*LEP%na8ZxHHpt*0;X@ z_dQ)=G==UJPL5wk6{XrZsaz zw<)4HK_eoTh($Jt!(#nok-aWQ0P+fsw0bfK_aW|4u*RNGJS;8=+BKqi+Wb3m!^p3} zeb)}w94uu4=-UdGwOgC7oL(~vv+2$3WPB11XK1U@uj){u%A!xk@RzvjGuhDD1_}!$ zXS&xaAl1MGo~ecI@7DHyJWek-qYJbkd+&jk!E!r$A7!pK$$k|_kZQTr=vhs{c9ooQ zp$0}~T0K_8JtLG(_#%jeaDaAtLTj~#ezc)NGw6wwz~|;pgtt@iqv+#O<&j$;3Qdu+ zOxJUOqx$z2)ngHjzK5}H#lvv-fL%5`lQTUY?#S;ml5!#=lL_}m@Nb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1s#@JEXh>d|%FBt5#B&qTh;r3e4z!Q0GE@}(w0)(ns%*p|;3q=xc zLKOwuUcRULlmqdp8X7rase7q0>=X94#sq;w>nmMJ`#@V-?=*tp?TrGBk1%d~e&+-9 zJYvtLG+nfbDil2xZ(WFVUZ`wiJ_!a466$wa2|{BGaFZURZfo4+X#jC7c?&2G8uENE z3~DY8sUf05lJ8*j{7E^OJ{BAFtw5fu0wvyXepY(hYr2Y7nQ4J|!`fmKHB#gcpSoXy z-X}c9S^ObvjbT6zFJV473o>i!HqzA`8v5&S=u{ZuGbWL)?a6k1ho?un&iJFI;s*zk zIfuzP{oMh7P6&LWZ{bH-C^t4AKc7iFe|A~Q@><8<=6hFcu4QYdX8l|O$+PDn{Ov~h z>3^FGufP~V&6j__Vc^d{{?GHj+&-Wn{ZD{@&Mp7R`19Nb@~*#4G5^Z=&tcBLGp>V1 zm;PU)oxdXeI`#{igu`)-(DQ=bsx#f1v;X&?ErBe{3WD%KmGm z{}(_q*+0bixyt^^{A=>@7c)QIAI$$qMSkV~=c@h}HvmAz_&3@ASmPC>Awgya03d)K NupmoiX8HN( &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()); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 410b064f525b..bb81d095bb53 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -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; diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 2694a5108b39..0c1178ad6966 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -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.