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

Miklos Vajna vmiklos at collabora.co.uk
Mon Mar 3 11:33:32 PST 2014


 writerfilter/source/dmapper/DomainMapper.cxx   |   26 -------
 writerfilter/source/doctok/resources.xmi       |   92 -------------------------
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   28 +++++--
 3 files changed, 21 insertions(+), 125 deletions(-)

New commits:
commit a6158500abb906b62bb36b5c17802ecbb3ec8119
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Mon Mar 3 20:29:13 2014 +0100

    writerfilter: convert sprm:C{Lid,LidBi,RgLid0,RgLid1}
    
    Change-Id: I07e73a792230e6dc344c7120e3ad3c5f92a40769

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 8023f3d..39ce894 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -1463,8 +1463,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
             handleUnderlineType(nIntValue, rContext);
         }
         break;
-    case NS_sprm::LN_CLid:
-        break;  // sprmCLid
     case NS_sprm::LN_CIco:
         {
             sal_Int32 nColor = 0;
@@ -1604,30 +1602,6 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
             }
             break;
         }
-    case NS_sprm::LN_CLidBi:     // sprmCLidBi     language complex
-    case NS_sprm::LN_CRgLid0:    // sprmCRgLid0    language Western
-    case NS_sprm::LN_CRgLid1:    // sprmCRgLid1    language Asian
-        {
-            lang::Locale aLocale( LanguageTag( (LanguageType)nIntValue).getLocale());
-
-            PropertyIds aPropId;
-            switch (nSprmId)
-            {
-                case NS_sprm::LN_CRgLid0:
-                    aPropId = PROP_CHAR_LOCALE;
-                    break;
-                case NS_sprm::LN_CRgLid1:
-                    aPropId = PROP_CHAR_LOCALE_ASIAN;
-                    break;
-                default:
-                    aPropId = PROP_CHAR_LOCALE_COMPLEX;
-                    break;
-            }
-
-            rContext->Insert(aPropId, uno::makeAny( aLocale ) );
-        }
-        break;
-
     case NS_ooxml::LN_EG_SectPrContents_type:
         /* break type
           0 - No break
diff --git a/writerfilter/source/doctok/resources.xmi b/writerfilter/source/doctok/resources.xmi
index f4561e7..4d0b7dd 100644
--- a/writerfilter/source/doctok/resources.xmi
+++ b/writerfilter/source/doctok/resources.xmi
@@ -131,37 +131,6 @@
           </UML:ModelElement.taggedValue>
         </UML:Class>
         <!--SPRM sprmCKul-->
-        <!--SPRM sprmCLid-->
-        <UML:Class xmi.id="sprmCLid" name="sprmCLid">
-          <UML:ModelElement.stereotype>
-            <UML:Stereotype xmi.idref="ww8sprm"/>
-          </UML:ModelElement.stereotype>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>0x4A41</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmcode"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>rtf:sprmCLid</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmid"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>character</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="kind"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-        </UML:Class>
-        <!--SPRM sprmCLid-->
         <!--SPRM sprmCIco-->
         <UML:Class xmi.id="sprmCIco" name="sprmCIco">
           <UML:ModelElement.stereotype>
@@ -286,37 +255,6 @@
           </UML:ModelElement.taggedValue>
         </UML:Class>
         <!--SPRM sprmCRgFtc2-->
-        <!--SPRM sprmCLidBi-->
-        <UML:Class xmi.id="sprmCLidBi" name="sprmCLidBi">
-          <UML:ModelElement.stereotype>
-            <UML:Stereotype xmi.idref="ww8sprm"/>
-          </UML:ModelElement.stereotype>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>0x485F</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmcode"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>rtf:sprmCLidBi</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmid"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>character</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="kind"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-        </UML:Class>
-        <!--SPRM sprmCLidBi-->
         <!--SPRM sprmSTextFlow-->
         <UML:Class xmi.id="sprmSTextFlow" name="sprmSTextFlow">
           <UML:ModelElement.stereotype>
@@ -394,36 +332,6 @@
           </UML:ModelElement.taggedValue>
         </UML:Class>
         <!--SPRM sprmPDxaLeft1-->
-        <!--SPRM sprmCRgLid0-->
-        <UML:Class xmi.id="sprmCRgLid0" name="sprmCRgLid0">
-          <UML:ModelElement.stereotype>
-            <UML:Stereotype xmi.idref="ww8sprm"/>
-          </UML:ModelElement.stereotype>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>0x4873</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmcode"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-        </UML:Class>
-        <!--SPRM sprmCRgLid0-->
-        <!--SPRM sprmCRgLid1-->
-        <UML:Class xmi.id="sprmCRgLid1" name="sprmCRgLid1">
-          <UML:ModelElement.stereotype>
-            <UML:Stereotype xmi.idref="ww8sprm"/>
-          </UML:ModelElement.stereotype>
-          <UML:ModelElement.taggedValue>
-            <UML:TaggedValue>
-              <UML:TaggedValue.dataValue>0x4874</UML:TaggedValue.dataValue>
-              <UML:TaggedValue.type>
-                <UML:TagDefinition xmi.idref="sprmcode"/>
-              </UML:TaggedValue.type>
-            </UML:TaggedValue>
-          </UML:ModelElement.taggedValue>
-        </UML:Class>
-        <!--SPRM sprmCRgLid1-->
         <!--SPRMS-->
       </UML:Namespace.ownedElement>
     </UML:Model>
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 712690d..6dbe1fb 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2988,17 +2988,29 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         case RTF_EXPNDTW: nSprm = NS_ooxml::LN_EG_RPrBase_spacing; break;
         case RTF_KERNING: nSprm = NS_ooxml::LN_EG_RPrBase_kern; break;
         case RTF_CHARSCALEX: nSprm = NS_ooxml::LN_EG_RPrBase_w; break;
-        case RTF_LANG: nSprm = NS_sprm::LN_CRgLid0; break;
-        case RTF_LANGFE: nSprm = NS_sprm::LN_CRgLid1; break;
-        case RTF_ALANG: nSprm = NS_sprm::LN_CLidBi; break;
         default: break;
     }
     if (nSprm > 0)
     {
         m_aStates.top().aCharacterSprms.set(nSprm, pIntValue);
+        return 0;
+    }
+    // Trivial character attributes.
+    switch (nKeyword)
+    {
+        case RTF_LANG: nSprm = NS_ooxml::LN_CT_Language_val; break;
+        case RTF_LANGFE: nSprm = NS_ooxml::LN_CT_Language_eastAsia; break;
+        case RTF_ALANG: nSprm = NS_ooxml::LN_CT_Language_bidi; break;
+        default: break;
+    }
+    if (nSprm > 0)
+    {
+        LanguageTag aTag((LanguageType)nParam);
+        RTFValue::Pointer_t pValue(new RTFValue(aTag.getBcp47()));
+        lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_lang, nSprm, pValue);
         // Language is a character property, but we should store it at a paragraph level as well for fields.
         if (nKeyword == RTF_LANG && m_bNeedPap)
-            m_aStates.top().aParagraphSprms.set(nSprm, pIntValue);
+            lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_EG_RPrBase_lang, nSprm, pValue);
         return 0;
     }
     // Trivial paragraph sprms.
@@ -3221,10 +3233,12 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
             m_aDefaultState.aCharacterSprms.set(NS_sprm::LN_CRgFtc0, pIntValue);
             break;
         case RTF_DEFLANG:
-            m_aDefaultState.aCharacterSprms.set(NS_sprm::LN_CRgLid0, pIntValue);
-            break;
         case RTF_ADEFLANG:
-            m_aDefaultState.aCharacterSprms.set(NS_sprm::LN_CLidBi, pIntValue);
+            {
+                LanguageTag aTag((LanguageType)nParam);
+                RTFValue::Pointer_t pValue(new RTFValue(aTag.getBcp47()));
+                lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, (nKeyword == RTF_DEFLANG ? NS_ooxml::LN_EG_RPrBase_lang : NS_ooxml::LN_CT_Language_bidi), nSprm, pValue);
+            }
             break;
         case RTF_CHCBPAT:
             {


More information about the Libreoffice-commits mailing list