[Libreoffice-commits] core.git: Branch 'distro/suse/suse-3.6' - 2 commits - writerfilter/CppunitTest_writerfilter_rtftok.mk writerfilter/source

Miklos Vajna vmiklos at suse.cz
Wed Jun 26 09:28:29 PDT 2013


 writerfilter/CppunitTest_writerfilter_rtftok.mk |    1 +
 writerfilter/source/rtftok/rtfdocumentimpl.cxx  |   21 +++++++++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

New commits:
commit 6c478d47d7433f09e105bf2cbdcb30e5651416fd
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Jun 26 15:47:54 2013 +0200

    bnc#823675 RTF import: fix import of numbering bullet associated font
    
    There were multiple problems here:
    
    - \f had a special handler for the listlevel destination, \af had not
    - in case of multiple \f or \af, the first one is used for the bullet
      font
    - in case only \af is used for the bullet font, its value should be used
      for \f as well
    
    (cherry picked from commit 55162d7422a3b175c7fe9c175e0dec91b1932b6a)
    
    Conflicts:
    	sw/qa/extras/rtfimport/rtfimport.cxx
    
    Change-Id: I6631504c1aa9f2e0792a3469a5fdce5b7bd49518

diff --git a/writerfilter/CppunitTest_writerfilter_rtftok.mk b/writerfilter/CppunitTest_writerfilter_rtftok.mk
index 9b660d3..107e95d 100644
--- a/writerfilter/CppunitTest_writerfilter_rtftok.mk
+++ b/writerfilter/CppunitTest_writerfilter_rtftok.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_CppunitTest_use_ure,writerfilter_rtftok))
 
 $(eval $(call gb_CppunitTest_use_components,writerfilter_rtftok,\
 	configmgr/source/configmgr \
+	i18npool/util/i18npool \
 	svtools/util/svt \
 	ucb/source/core/ucb1 \
 	ucb/source/ucp/file/ucpfile1 \
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 95d7a62..86b3cf4 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2340,7 +2340,6 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     // Trivial character sprms.
     switch (nKeyword)
     {
-        case RTF_AF: nSprm = (m_aStates.top().bIsCjk ? NS_sprm::LN_CRgFtc1 : NS_sprm::LN_CRgFtc2); break;
         case RTF_FS: nSprm = NS_sprm::LN_CHps; break;
         case RTF_AFS: nSprm = NS_sprm::LN_CHpsBi; break;
         case RTF_ANIMTEXT: nSprm = NS_sprm::LN_CSfxText; break;
@@ -2428,6 +2427,11 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
     switch (nKeyword)
     {
         case RTF_F:
+        case RTF_AF:
+            if (nKeyword == RTF_F)
+                nSprm = NS_sprm::LN_CRgFtc0;
+            else
+                nSprm = (m_aStates.top().bIsCjk ? NS_sprm::LN_CRgFtc1 : NS_sprm::LN_CRgFtc2);
             if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE || m_aStates.top().nDestinationState == DESTINATION_FONTENTRY)
             {
                 m_aFontIndexes.push_back(nParam);
@@ -2436,16 +2440,21 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
             else if (m_aStates.top().nDestinationState == DESTINATION_LISTLEVEL)
             {
                 RTFSprms aFontSprms;
-                aFontSprms.set(NS_sprm::LN_CRgFtc0, RTFValue::Pointer_t(new RTFValue(getFontIndex(nParam))));
+                aFontSprms.set(nSprm, RTFValue::Pointer_t(new RTFValue(getFontIndex(nParam))));
+                // In the context of listlevels, \af seems to imply \f.
+                if (nKeyword == RTF_AF)
+                    aFontSprms.set(NS_sprm::LN_CRgFtc0, RTFValue::Pointer_t(new RTFValue(getFontIndex(nParam))));
                 RTFSprms aRunPropsSprms;
                 aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aFontSprms)));
-                m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_rPr, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aRunPropsSprms)));
+                // If there are multiple \f or \af tokens, only handle the first one.
+                if (!m_aStates.top().aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr))
+                    m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_rPr, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aRunPropsSprms)));
             }
             else
             {
                 int nFontIndex = getFontIndex(nParam);
                 RTFValue::Pointer_t pValue(new RTFValue(nFontIndex));
-                m_aStates.top().aCharacterSprms.set(NS_sprm::LN_CRgFtc0, pValue);
+                m_aStates.top().aCharacterSprms.set(nSprm, pValue);
                 m_aStates.top().nCurrentEncoding = getEncoding(nFontIndex);
             }
             break;
commit a08492814896380afc0bf10981f46c4888da8beb
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Fri Mar 1 17:38:03 2013 +0100

    bnc#823675 fdo#59638 handle RTF_F inside RTF_LISTLEVEL
    
    Word typically uses the Symbol font to describe bullet characters
    instead of using a sane Unicode value, the previous can only be handled
    if we parse the custom font set for the list.
    
    (cherry picked from commit 58c30a3545a5725d704eabd79071db02f1f2cb23)
    
    Conflicts:
    	sw/qa/extras/rtfimport/rtfimport.cxx
    
    Change-Id: I1491f07c40953949e381a035c1596c207cdc4c35

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 67a26e3..95d7a62 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2433,6 +2433,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
                 m_aFontIndexes.push_back(nParam);
                 m_nCurrentFontIndex = getFontIndex(nParam);
             }
+            else if (m_aStates.top().nDestinationState == DESTINATION_LISTLEVEL)
+            {
+                RTFSprms aFontSprms;
+                aFontSprms.set(NS_sprm::LN_CRgFtc0, RTFValue::Pointer_t(new RTFValue(getFontIndex(nParam))));
+                RTFSprms aRunPropsSprms;
+                aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aFontSprms)));
+                m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_rPr, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aRunPropsSprms)));
+            }
             else
             {
                 int nFontIndex = getFontIndex(nParam);


More information about the Libreoffice-commits mailing list