[Libreoffice-commits] core.git: sw/qa writerfilter/source

Rohit Deshmukh rohit.deshmukh at synerzip.com
Wed May 14 00:47:50 PDT 2014


 sw/qa/extras/ooxmlexport/data/fdo78384.docx       |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx          |    7 +++++++
 writerfilter/source/dmapper/DomainMapper.cxx      |   11 ++++++++++-
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   11 +++++++++++
 writerfilter/source/dmapper/DomainMapper_Impl.hxx |    4 ++++
 5 files changed, 32 insertions(+), 1 deletion(-)

New commits:
commit f51640c5f40d5132b396a9fb6589420383df1610
Author: Rohit Deshmukh <rohit.deshmukh at synerzip.com>
Date:   Thu May 8 16:33:44 2014 +0530

    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 at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/sw/qa/extras/ooxmlexport/data/fdo78384.docx b/sw/qa/extras/ooxmlexport/data/fdo78384.docx
new file mode 100644
index 0000000..ee10264
Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/fdo78384.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 4919d01..87097d9 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -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();
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index dd92026..3dfb392 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -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());
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 410b064..bb81d09 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 2694a51..0c1178a 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.


More information about the Libreoffice-commits mailing list