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

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Sun Feb 23 08:40:49 PST 2014


 oox/source/token/tokens.txt                        |    7 
 sw/source/filter/ww8/docxattributeoutput.cxx       |   72 +++-
 sw/source/filter/ww8/docxattributeoutput.hxx       |    2 
 writerfilter/source/dmapper/DomainMapper.cxx       |   33 +-
 writerfilter/source/dmapper/PropertyIds.cxx        |    2 
 writerfilter/source/dmapper/PropertyIds.hxx        |    1 
 writerfilter/source/dmapper/TextEffectsHandler.cxx |  104 +++++-
 writerfilter/source/dmapper/TextEffectsHandler.hxx |   19 -
 writerfilter/source/ooxml/model.xml                |  336 +++++++++++++++++++--
 9 files changed, 491 insertions(+), 85 deletions(-)

New commits:
commit fb217f27eb0f3a34c89d262d2c71a4ac4427ec5f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Sun Feb 23 17:26:30 2014 +0100

    writerfilter: comment out incomplete w14 elements from model.xml
    
    Change-Id: Ifdc0c0802e8d13d57023cb24096f8364e6ee9e91

diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 16fd71e..1f90369 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -5568,6 +5568,10 @@
         </optional>
       </define>
 
+      <define name="CT_TextOutlineEffect">
+        <empty/>
+      </define>
+
       <define name="glow">
         <element name="glow">
           <ref name="CT_Glow"/>
@@ -5588,7 +5592,7 @@
 
       <define name="textOutline">
         <element name="textOutline">
-          <empty/>
+          <ref name="CT_TextOutlineEffect"/>
         </element>
       </define>
 
@@ -17403,7 +17407,7 @@
             <ref name="BUILT_IN_ANY_TYPE"/>
           </element>
         </optional>
-        <optional>
+        <!--<optional>
           <element name="w14:reflection">
             <ref name="BUILT_IN_ANY_TYPE"/>
           </element>
@@ -17452,7 +17456,7 @@
           <element name="w14:cntxtAlts">
             <ref name="BUILT_IN_ANY_TYPE"/>
           </element>
-        </optional>
+        </optional>-->
       </define>
       <define name="EG_RPrContent">
         <optional>
@@ -23422,7 +23426,7 @@
       <element name="oMath" tokenid="ooxml:EG_RPrBase_oMath"/>
       <element name="w14:glow" tokenid="ooxml:EG_RPrBase_w14_glow"/>
       <element name="w14:shadow" tokenid="ooxml:EG_RPrBase_w14_shadow"/>
-      <element name="w14:reflection" tokenid="ooxml:EG_RPrBase_w14_reflection"/>
+      <!--<element name="w14:reflection" tokenid="ooxml:EG_RPrBase_w14_reflection"/>
       <element name="w14:textOutline" tokenid="ooxml:EG_RPrBase_w14_textOutline"/>
       <element name="w14:textFill" tokenid="ooxml:EG_RPrBase_w14_textFill"/>
       <element name="w14:scene3d" tokenid="ooxml:EG_RPrBase_w14_scene3d"/>
@@ -23431,7 +23435,7 @@
       <element name="w14:numForm" tokenid="ooxml:EG_RPrBase_w14_numForm"/>
       <element name="w14:numSpacing" tokenid="ooxml:EG_RPrBase_w14_numSpacing"/>
       <element name="w14:stylisticSets" tokenid="ooxml:EG_RPrBase_w14_stylisticSets"/>
-      <element name="w14:cntxtAlts" tokenid="ooxml:EG_RPrBase_w14_cntxtAlts"/>
+      <element name="w14:cntxtAlts" tokenid="ooxml:EG_RPrBase_w14_cntxtAlts"/>-->
     </resource>
     <resource name="EG_RPrContent" resource="Properties" tag="character">
       <element name="rPrChange" tokenid="ooxml:EG_RPrContent_rPrChange"/>
commit ea7dd1a0551dd70093f7f46d86488b1bc01c3f40
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Sun Feb 23 17:22:12 2014 +0100

    writerfilter: restructure call to TextEffectsHandler
    
    Change-Id: Iba02edccfb09c2b42be164c62c57315b58884c98

diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 8e43ede..b3c419b 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2348,15 +2348,15 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
     case NS_ooxml::LN_stylisticSets_stylisticSets:
     case NS_ooxml::LN_cntxtAlts_cntxtAlts:
     {
-        writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
-        if( pProperties.get())
+        TextEffectsHandlerPtr pTextEffectsHandlerPtr( new TextEffectsHandler(nSprmId) );
+        boost::optional<PropertyIds> aPropertyId = pTextEffectsHandlerPtr->getGrabBagPropertyId();
+        if(aPropertyId)
         {
-            TextEffectsHandlerPtr pTextEffectsHandlerPtr( new TextEffectsHandler(nSprmId) );
-            boost::optional<PropertyIds> aPropertyId = pTextEffectsHandlerPtr->getGrabBagPropertyId();
-
-            if(aPropertyId)
+            writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
+            if( pProperties.get())
             {
                 pProperties->resolve(*pTextEffectsHandlerPtr);
+
                 rContext->Insert(*aPropertyId, uno::makeAny(pTextEffectsHandlerPtr->getInteropGrabBag()), true, CHAR_GRAB_BAG);
             }
         }
commit ab2b20b66394c1d219caafc380488f5296c1c12c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Sat Feb 22 20:42:37 2014 +0100

    ooxml: handle w14:shadow in import/export
    
    Refactor the code to support an additional main element at processing
    of w14 elements for rPr.
    
    Change-Id: Iaf18a11bbda245b0b5b629e5f2e9f1f9682e6d41

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index b81fcc6..b34ce93 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -1123,6 +1123,7 @@ void DocxAttributeOutput::InitCollectedRunProperties()
         FSNS( XML_w, XML_oMath ),
         FSNS( XML_w, XML_rPrChange ),
         FSNS( XML_w14, XML_glow ),
+        FSNS( XML_w14, XML_shadow ),
     };
 
     // postpone the output so that we can later [in EndParagraphProperties()]
@@ -1145,10 +1146,22 @@ struct NameToId
     const sal_Int32 maId;
 };
 
-const NameToId aNameToIdMapping[] =
+const NameToId constNameToIdMapping[] =
 {
+    { OUString("glow"),      FSNS( XML_w14, XML_glow ) },
+    { OUString("shadow"),    FSNS( XML_w14, XML_shadow ) },
+
     { OUString("val"),       FSNS( XML_w14, XML_val ) },
     { OUString("rad"),       FSNS( XML_w14, XML_rad ) },
+    { OUString("blurRad"),   FSNS( XML_w14, XML_blurRad ) },
+    { OUString("dist"),      FSNS( XML_w14, XML_dist ) },
+    { OUString("dir"),       FSNS( XML_w14, XML_dir ) },
+    { OUString("sx"),        FSNS( XML_w14, XML_sx ) },
+    { OUString("sy"),        FSNS( XML_w14, XML_sy ) },
+    { OUString("kx"),        FSNS( XML_w14, XML_kx ) },
+    { OUString("ky"),        FSNS( XML_w14, XML_ky ) },
+    { OUString("algn"),      FSNS( XML_w14, XML_algn ) },
+
     { OUString("schemeClr"), FSNS( XML_w14, XML_schemeClr ) },
     { OUString("srgbClr"),   FSNS( XML_w14, XML_srgbClr ) },
     { OUString("tint"),      FSNS( XML_w14, XML_tint ) },
@@ -1163,6 +1176,19 @@ const NameToId aNameToIdMapping[] =
     { OUString("lumMod"),    FSNS( XML_w14, XML_lumMod ) },
 };
 
+boost::optional<sal_Int32> lclGetElementIdForName(OUString aName)
+{
+    sal_Int32 aLength = sizeof (constNameToIdMapping) / sizeof(NameToId);
+    for (sal_Int32 i=0; i < aLength; ++i)
+    {
+        if(aName == constNameToIdMapping[i].maName)
+        {
+            return constNameToIdMapping[i].maId;
+        }
+    }
+    return boost::optional<sal_Int32>();
+}
+
 void lclProcessRecursiveGrabBag(sal_Int32 aElementId, css::uno::Sequence<css::beans::PropertyValue> aElements, sax_fastparser::FSHelperPtr pSerializer)
 {
     css::uno::Sequence<css::beans::PropertyValue> aAttributes;
@@ -1190,14 +1216,9 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, css::uno::Sequence<css::be
             aValue =  OUStringToOString(aAny.get<OUString>(), RTL_TEXTENCODING_ASCII_US);
         }
 
-        sal_Int32 aLength = sizeof (aNameToIdMapping) / sizeof(NameToId);
-        for (sal_Int32 i=0; i < aLength; ++i)
-        {
-            if(aAttributes[j].Name == aNameToIdMapping[i].maName)
-            {
-                pAttributes->add( aNameToIdMapping[i].maId, aValue.getStr());
-            }
-        }
+        boost::optional<sal_Int32> aSubElementId = lclGetElementIdForName(aAttributes[j].Name);
+        if(aSubElementId)
+            pAttributes->add(*aSubElementId, aValue.getStr());
     }
 
     XFastAttributeListRef xAttributesList( pAttributes );
@@ -1208,14 +1229,11 @@ void lclProcessRecursiveGrabBag(sal_Int32 aElementId, css::uno::Sequence<css::be
     {
         css::uno::Sequence<css::beans::PropertyValue> aSumElements;
 
-        sal_Int32 aLength = sizeof (aNameToIdMapping) / sizeof(NameToId);
-        for (sal_Int32 i=0; i < aLength; ++i)
+        boost::optional<sal_Int32> aSubElementId = lclGetElementIdForName(aElements[j].Name);
+        if(aSubElementId)
         {
-            if( aElements[j].Name == aNameToIdMapping[i].maName)
-            {
-                aElements[j].Value >>= aSumElements;
-                lclProcessRecursiveGrabBag(aNameToIdMapping[i].maId, aSumElements, pSerializer);
-            }
+            aElements[j].Value >>= aSumElements;
+            lclProcessRecursiveGrabBag(*aSubElementId, aSumElements, pSerializer);
         }
     }
 
@@ -1261,7 +1279,16 @@ void DocxAttributeOutput::WriteCollectedRunProperties()
 
     if (m_aTextEffectsGrabBag.getLength() > 0)
     {
-        lclProcessRecursiveGrabBag(FSNS( XML_w14, XML_glow ), m_aTextEffectsGrabBag, m_pSerializer);
+        for (sal_Int32 i=0; i < m_aTextEffectsGrabBag.getLength(); ++i)
+        {
+            boost::optional<sal_Int32> aElementId = lclGetElementIdForName(m_aTextEffectsGrabBag[i].Name);
+            if(aElementId)
+            {
+                uno::Sequence<beans::PropertyValue> aGrabBagSeq;
+                m_aTextEffectsGrabBag[i].Value >>= aGrabBagSeq;
+                lclProcessRecursiveGrabBag(*aElementId, aGrabBagSeq, m_pSerializer);
+            }
+        }
         m_aTextEffectsGrabBag.realloc(0);
     }
 }
@@ -6437,11 +6464,14 @@ void DocxAttributeOutput::CharGrabBag( const SfxGrabBagItem& rItem )
         {
             // just skip these, they were processed before
         }
-        else if (i->first == "CharGlowTextEffect")
+        else if (i->first == "CharGlowTextEffect" ||
+                 i->first == "CharShadowTextEffect")
         {
-            uno::Sequence<beans::PropertyValue> aGrabBagSeq;
-            i->second >>= aGrabBagSeq;
-            m_aTextEffectsGrabBag = aGrabBagSeq;
+            beans::PropertyValue aPropertyValue;
+            i->second >>= aPropertyValue;
+            sal_Int32 aLength = m_aTextEffectsGrabBag.getLength();
+            m_aTextEffectsGrabBag.realloc(m_aTextEffectsGrabBag.getLength() + 1);
+            m_aTextEffectsGrabBag[aLength] = aPropertyValue;
         }
         else
             SAL_INFO("sw.ww8", "DocxAttributeOutput::CharGrabBag: unhandled grab bag property " << i->first);
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 8463d39..30474f1 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -736,7 +736,7 @@ private:
     /// names of these bookmarks for each sequence.
     std::map<OUString, std::vector<OString> > m_aSeqBookmarksNames;
 
-    /// GrabBag for text effexts like glow
+    /// GrabBag for text effexts like glow, shadow, ...
     css::uno::Sequence<css::beans::PropertyValue> m_aTextEffectsGrabBag;
 
     /// The current table helper
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 80f1ed8..8e43ede 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -2336,20 +2336,29 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext, SprmType
         m_pImpl->m_nTableDepth--;
     break;
     case NS_ooxml::LN_glow_glow:
+    case NS_ooxml::LN_shadow_shadow:
+    case NS_ooxml::LN_reflection_reflection:
+    case NS_ooxml::LN_textOutline_textOutline:
+    case NS_ooxml::LN_textFill_textFill:
+    case NS_ooxml::LN_scene3d_scene3d:
+    case NS_ooxml::LN_props3d_props3d:
+    case NS_ooxml::LN_ligatures_ligatures:
+    case NS_ooxml::LN_numForm_numForm:
+    case NS_ooxml::LN_numSpacing_numSpacing:
+    case NS_ooxml::LN_stylisticSets_stylisticSets:
+    case NS_ooxml::LN_cntxtAlts_cntxtAlts:
     {
         writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
         if( pProperties.get())
         {
-            TextEffectsHandlerPtr pTextEffectsHandlerPtr( new TextEffectsHandler );
-            sal_Bool bEnableTempGrabBag = !pTextEffectsHandlerPtr->isInteropGrabBagEnabled();
-            if( bEnableTempGrabBag )
-                pTextEffectsHandlerPtr->enableInteropGrabBag( "glow" );
-
-            pProperties->resolve(*pTextEffectsHandlerPtr);
+            TextEffectsHandlerPtr pTextEffectsHandlerPtr( new TextEffectsHandler(nSprmId) );
+            boost::optional<PropertyIds> aPropertyId = pTextEffectsHandlerPtr->getGrabBagPropertyId();
 
-            rContext->Insert(PROP_CHAR_GLOW_TEXT_EFFECT,  pTextEffectsHandlerPtr->getInteropGrabBag().Value, true, CHAR_GRAB_BAG);
-            if(bEnableTempGrabBag)
-                pTextEffectsHandlerPtr->disableInteropGrabBag();
+            if(aPropertyId)
+            {
+                pProperties->resolve(*pTextEffectsHandlerPtr);
+                rContext->Insert(*aPropertyId, uno::makeAny(pTextEffectsHandlerPtr->getInteropGrabBag()), true, CHAR_GRAB_BAG);
+            }
         }
     }
     break;
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx b/writerfilter/source/dmapper/PropertyIds.cxx
index ce007e2..c3792cc 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -115,7 +115,6 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
             case PROP_CHAR_BOTTOM_BORDER_DISTANCE: sName = "CharBottomBorderDistance"; break;
             case PROP_CHAR_SHADOW_FORMAT: sName = "CharShadowFormat"; break;
             case PROP_CHAR_HIGHLIGHT: sName = "CharHighlight"; break;
-
             case PROP_PARA_STYLE_NAME:      sName = "ParaStyleName"; break;
             case PROP_PARA_ADJUST:     sName = "ParaAdjust"; break;
             case PROP_PARA_VERT_ALIGNMENT: sName = "ParaVertAlignment"; break;
@@ -377,6 +376,7 @@ OUString PropertyNameSupplier::GetName( PropertyIds eId ) const
             case PROP_TOC_PARAGRAPH_OUTLINE_LEVEL   :   sName = "TOCParagraphOutlineLevel"; break;
             case PROP_CHAR_THEME_COLOR_TINT         :   sName = "CharThemeColorTint"; break;
             case PROP_CHAR_GLOW_TEXT_EFFECT         :   sName = "CharGlowTextEffect"; break;
+            case PROP_CHAR_SHADOW_TEXT_EFFECT       :   sName = "CharShadowTextEffect"; break;
         }
         ::std::pair<PropertyNameMap_t::iterator,bool> aInsertIt =
                 m_pImpl->aNameMap.insert( PropertyNameMap_t::value_type( eId, sName ));
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx b/writerfilter/source/dmapper/PropertyIds.hxx
index c8155b1..18ba148 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -348,6 +348,7 @@ enum PropertyIds
         ,PROP_TOC_PARAGRAPH_OUTLINE_LEVEL
         ,PROP_CHAR_THEME_COLOR_TINT
         ,PROP_CHAR_GLOW_TEXT_EFFECT
+        ,PROP_CHAR_SHADOW_TEXT_EFFECT
     };
 struct PropertyNameSupplier_Impl;
 class PropertyNameSupplier
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.cxx b/writerfilter/source/dmapper/TextEffectsHandler.cxx
index 060a389..edb219e 100644
--- a/writerfilter/source/dmapper/TextEffectsHandler.cxx
+++ b/writerfilter/source/dmapper/TextEffectsHandler.cxx
@@ -98,7 +98,7 @@ public:
     }
 };
 
-OUString TextEffectsHandler::getSchemeColorTypeString(sal_Int32 nType)
+OUString TextEffectsHandler::getSchemeColorValTypeString(sal_Int32 nType)
 {
     switch (nType)
     {
@@ -118,17 +118,70 @@ OUString TextEffectsHandler::getSchemeColorTypeString(sal_Int32 nType)
     return OUString();
 }
 
+OUString TextEffectsHandler::getRectAlignmentString(sal_Int32 nType)
+{
+    switch (nType)
+    {
+        case NS_ooxml::LN_ST_RectAlignment_none: return OUString("none");
+        case NS_ooxml::LN_ST_RectAlignment_tl: return OUString("tl");
+        case NS_ooxml::LN_ST_RectAlignment_t: return OUString("t");
+        case NS_ooxml::LN_ST_RectAlignment_tr: return OUString("tr");
+        case NS_ooxml::LN_ST_RectAlignment_l: return OUString("l");
+        case NS_ooxml::LN_ST_RectAlignment_ctr: return OUString("ctr");
+        case NS_ooxml::LN_ST_RectAlignment_r: return OUString("r");
+        case NS_ooxml::LN_ST_RectAlignment_bl: return OUString("bl");
+        case NS_ooxml::LN_ST_RectAlignment_b: return OUString("b");
+        case NS_ooxml::LN_ST_RectAlignment_br: return OUString("br");
 
-TextEffectsHandler::TextEffectsHandler() :
+        default: break;
+    }
+    return OUString();
+}
+
+void TextEffectsHandler::convertElementIdToPropertyId(sal_Int32 aElementId)
+{
+    switch(aElementId)
+    {
+        case NS_ooxml::LN_glow_glow:
+            maPropertyId = PROP_CHAR_GLOW_TEXT_EFFECT;
+            maElementName = "glow";
+            break;
+        case NS_ooxml::LN_shadow_shadow:
+            maPropertyId = PROP_CHAR_SHADOW_TEXT_EFFECT;
+            maElementName = "shadow";
+            break;
+        case NS_ooxml::LN_reflection_reflection:
+        case NS_ooxml::LN_textOutline_textOutline:
+        case NS_ooxml::LN_textFill_textFill:
+        case NS_ooxml::LN_scene3d_scene3d:
+        case NS_ooxml::LN_props3d_props3d:
+        case NS_ooxml::LN_ligatures_ligatures:
+        case NS_ooxml::LN_numForm_numForm:
+        case NS_ooxml::LN_numSpacing_numSpacing:
+        case NS_ooxml::LN_stylisticSets_stylisticSets:
+        case NS_ooxml::LN_cntxtAlts_cntxtAlts:
+        default:
+            break;
+    }
+}
+
+TextEffectsHandler::TextEffectsHandler(sal_uInt32 aElementId) :
     LoggedProperties(dmapper_logger, "TextEffectsHandler"),
     mpGrabBagStack(NULL)
 {
+    convertElementIdToPropertyId(aElementId);
+    mpGrabBagStack.reset(new GrabBagStack(maElementName));
 }
 
 TextEffectsHandler::~TextEffectsHandler()
 {
 }
 
+boost::optional<PropertyIds> TextEffectsHandler::getGrabBagPropertyId()
+{
+    return maPropertyId;
+}
+
 void TextEffectsHandler::lcl_attribute(Id aName, Value& aValue)
 {
 
@@ -147,7 +200,7 @@ void TextEffectsHandler::lcl_attribute(Id aName, Value& aValue)
             mpGrabBagStack->appendElement("val", makeAny(sal_Int32(aValue.getInt())));
             break;
         case NS_ooxml::LN_CT_SchemeColor_val:
-            mpGrabBagStack->appendElement("val", makeAny(getSchemeColorTypeString(sal_Int32(aValue.getInt()))));
+            mpGrabBagStack->appendElement("val", makeAny(getSchemeColorValTypeString(sal_Int32(aValue.getInt()))));
             break;
         case NS_ooxml::LN_CT_SRgbColor_val:
             {
@@ -155,12 +208,39 @@ void TextEffectsHandler::lcl_attribute(Id aName, Value& aValue)
                 OUStringBuffer aStr;
                 comphelper::string::padToLength(aStr, 6 - aBuf.getLength(), '0');
                 aStr.append(aBuf.getStr());
-                mpGrabBagStack->appendElement("val", makeAny(aStr.makeStringAndClear()));
+                mpGrabBagStack->appendElement("val", makeAny(aStr.makeStringAndClear().toAsciiUpperCase()));
             }
             break;
         case NS_ooxml::LN_CT_Glow_rad:
             mpGrabBagStack->appendElement("rad", makeAny(sal_Int32(aValue.getInt())));
             break;
+        case NS_ooxml::LN_CT_Shadow_blurRad:
+            mpGrabBagStack->appendElement("blurRad", makeAny(sal_Int32(aValue.getInt())));
+            break;
+        case NS_ooxml::LN_CT_Shadow_dist:
+            mpGrabBagStack->appendElement("dist", makeAny(sal_Int32(aValue.getInt())));
+            break;
+        case NS_ooxml::LN_CT_Shadow_dir:
+            mpGrabBagStack->appendElement("dir", makeAny(sal_Int32(aValue.getInt())));
+            break;
+        case NS_ooxml::LN_CT_Shadow_sx:
+            mpGrabBagStack->appendElement("sx", makeAny(sal_Int32(aValue.getInt())));
+            break;
+        case NS_ooxml::LN_CT_Shadow_sy:
+            mpGrabBagStack->appendElement("sy", makeAny(sal_Int32(aValue.getInt())));
+            break;
+        case NS_ooxml::LN_CT_Shadow_kx:
+            mpGrabBagStack->appendElement("kx", makeAny(sal_Int32(aValue.getInt())));
+            break;
+        case NS_ooxml::LN_CT_Shadow_ky:
+            mpGrabBagStack->appendElement("ky", makeAny(sal_Int32(aValue.getInt())));
+            break;
+        case NS_ooxml::LN_CT_Shadow_algn:
+            {
+                uno::Any aAny = makeAny(getRectAlignmentString(sal_Int32(aValue.getInt())));
+                mpGrabBagStack->appendElement("algn", aAny);
+            }
+            break;
         default:
             break;
     }
@@ -251,22 +331,6 @@ beans::PropertyValue TextEffectsHandler::getInteropGrabBag()
     return aReturn;
 }
 
-void TextEffectsHandler::enableInteropGrabBag(OUString aName)
-{
-    mpGrabBagStack.reset(new GrabBagStack(aName));
-}
-
-void TextEffectsHandler::disableInteropGrabBag()
-{
-    mpGrabBagStack.reset();
-}
-
-bool TextEffectsHandler::isInteropGrabBagEnabled()
-{
-    return mpGrabBagStack.get() != NULL;
-}
-
-
 }//namespace dmapper
 } //namespace writerfilter
 
diff --git a/writerfilter/source/dmapper/TextEffectsHandler.hxx b/writerfilter/source/dmapper/TextEffectsHandler.hxx
index f224c63..a2d2ca9 100644
--- a/writerfilter/source/dmapper/TextEffectsHandler.hxx
+++ b/writerfilter/source/dmapper/TextEffectsHandler.hxx
@@ -13,10 +13,15 @@
 
 #include <WriterFilterDllApi.hxx>
 #include <resourcemodel/LoggedResources.hxx>
+
 #include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/lang/XComponent.hpp>
 #include <i18nlangtag/languagetag.hxx>
+
+#include <PropertyIds.hxx>
+
 #include <boost/scoped_ptr.hpp>
+#include <boost/optional.hpp>
 
 namespace writerfilter {
 namespace dmapper
@@ -28,22 +33,26 @@ class GrabBagStack;
 class TextEffectsHandler : public LoggedProperties
 {
 private:
+    boost::optional<PropertyIds>    maPropertyId;
+    OUString                        maElementName;
     boost::scoped_ptr<GrabBagStack> mpGrabBagStack;
 
+    void convertElementIdToPropertyId(sal_Int32 aElementId);
+
     // LoggedProperties
     virtual void lcl_attribute(Id aName, Value& aValue);
     virtual void lcl_sprm(Sprm& sprm);
 
 public:
-    TextEffectsHandler();
+    TextEffectsHandler(sal_uInt32 aElementId);
     virtual ~TextEffectsHandler();
 
+    boost::optional<PropertyIds> getGrabBagPropertyId();
+
     css::beans::PropertyValue getInteropGrabBag();
-    void enableInteropGrabBag(OUString aName);
-    void disableInteropGrabBag();
-    bool isInteropGrabBagEnabled();
 
-    static OUString getSchemeColorTypeString(sal_Int32 nType);
+    static OUString getSchemeColorValTypeString(sal_Int32 nType);
+    static OUString getRectAlignmentString(sal_Int32 nType);
 };
 
 typedef boost::shared_ptr<TextEffectsHandler> TextEffectsHandlerPtr;
commit 7f93b4001f3b7266695b46b3a5c95d0b9c66af35
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Sat Feb 22 20:37:28 2014 +0100

    writerfilter: add all main w14 elements for a rPr
    
    Change-Id: I8fa71bdf837eac6ea277d2e2507622a783625a11

diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index 69b97dd..16fd71e 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -5317,8 +5317,49 @@
   </namespace>
   <namespace name="w14" file="w14.rng">
     <start name="glow"/>
+    <start name="shadow"/>
+    <start name="reflection"/>
+    <start name="textOutline"/>
+    <start name="textFill"/>
+    <start name="scene3d"/>
+    <start name="props3d"/>
+    <start name="ligatures"/>
+    <start name="numForm"/>
+    <start name="numSpacing"/>
+    <start name="stylisticSets"/>
+    <start name="cntxtAlts"/>
     <grammar xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://relaxng.org/ns/structure/1.0" ns="http://schemas.microsoft.com/office/word/2010/wordml" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes" attributeFormDefault="qualified">
 
+      <define name="ST_SchemeColorVal">
+        <choice>
+          <value>bg1</value>
+          <value>tx1</value>
+          <value>bg2</value>
+          <value>tx2</value>
+          <value>accent1</value>
+          <value>accent2</value>
+          <value>accent3</value>
+          <value>accent4</value>
+          <value>accent5</value>
+          <value>accent6</value>
+        </choice>
+      </define>
+
+      <define name="ST_RectAlignment">
+        <choice>
+          <value>none</value>
+          <value>tl</value>
+          <value>t</value>
+          <value>tr</value>
+          <value>l</value>
+          <value>ctr</value>
+          <value>r</value>
+          <value>bl</value>
+          <value>b</value>
+          <value>br</value>
+        </choice>
+      </define>
+
       <define name="ST_PositiveCoordinate">
         <data type="long">
           <xs:documentation>Positive Coordinate</xs:documentation>
@@ -5358,19 +5399,20 @@
         </data>
       </define>
 
-      <define name="ST_SchemeColorVal">
-        <choice>
-          <value>bg1</value>
-          <value>tx1</value>
-          <value>bg2</value>
-          <value>tx2</value>
-          <value>accent1</value>
-          <value>accent2</value>
-          <value>accent3</value>
-          <value>accent4</value>
-          <value>accent5</value>
-          <value>accent6</value>
-        </choice>
+      <define name="ST_PositiveFixedAngle">
+        <data type="int">
+          <xs:documentation>Positive fixed angle</xs:documentation>
+          <param name="minInclusive">0</param>
+          <param name="maxInclusive">21600000</param>
+        </data>
+      </define>
+
+      <define name="ST_FixedAngle">
+        <data type="int">
+          <xs:documentation>Fixed angle</xs:documentation>
+          <param name="minInclusive">-5400000</param>
+          <param name="maxInclusive">5400000</param>
+        </data>
       </define>
 
       <define name="EG_ColorChoice">
@@ -5443,29 +5485,18 @@
         </choice>
       </define>
 
-      <define name="CT_Glow">
-        <optional>
-            <ref name="EG_ColorChoice"/>
-        </optional>
-        <attribute name="rad">
-          <ref name="ST_PositiveCoordinate"/>
-        </attribute>
-      </define>
-
       <define name="CT_SRgbColor">
         <ref name="EG_ColorTransform"/>
         <attribute name="val">
           <ref name="ST_HexColorRGB"/>
         </attribute>
       </define>
-
       <define name="CT_SchemeColor">
         <ref name="EG_ColorTransform"/>
         <attribute name="val">
           <ref name="ST_SchemeColorVal"/>
         </attribute>
       </define>
-
       <define name="CT_PositiveFixedPercentage">
         <attribute name="val">
           <ref name="ST_PositiveFixedPercentage"/>
@@ -5482,13 +5513,136 @@
         </attribute>
       </define>
 
+      <define name="CT_Glow">
+        <optional>
+            <ref name="EG_ColorChoice"/>
+        </optional>
+        <attribute name="rad">
+          <ref name="ST_PositiveCoordinate"/>
+        </attribute>
+      </define>
+
+      <define name="CT_Shadow">
+        <optional>
+            <ref name="EG_ColorChoice"/>
+        </optional>
+        <optional>
+          <attribute name="blurRad">
+            <ref name="ST_PositiveCoordinate"/>
+          </attribute>
+        </optional>
+        <optional>
+          <attribute name="dist">
+            <ref name="ST_PositiveCoordinate"/>
+          </attribute>
+        </optional>
+        <optional>
+          <attribute name="dir">
+            <ref name="ST_PositiveFixedAngle"/>
+          </attribute>
+        </optional>
+        <optional>
+          <attribute name="sx">
+            <ref name="ST_Percentage"/>
+          </attribute>
+        </optional>
+        <optional>
+          <attribute name="sy">
+            <ref name="ST_Percentage"/>
+          </attribute>
+        </optional>
+        <optional>
+          <attribute name="kx">
+            <ref name="ST_FixedAngle"/>
+          </attribute>
+        </optional>
+        <optional>
+          <attribute name="ky">
+            <ref name="ST_FixedAngle"/>
+          </attribute>
+        </optional>
+        <optional>
+          <attribute name="algn">
+            <ref name="ST_RectAlignment"/>
+          </attribute>
+        </optional>
+      </define>
+
       <define name="glow">
         <element name="glow">
           <ref name="CT_Glow"/>
         </element>
       </define>
+
+      <define name="shadow">
+        <element name="shadow">
+          <ref name="CT_Shadow"/>
+        </element>
+      </define>
+
+      <define name="reflection">
+        <element name="reflection">
+          <empty/>
+        </element>
+      </define>
+
+      <define name="textOutline">
+        <element name="textOutline">
+          <empty/>
+        </element>
+      </define>
+
+      <define name="textFill">
+        <element name="textFill">
+          <empty/>
+        </element>
+      </define>
+
+      <define name="scene3d">
+        <element name="scene3d">
+          <empty/>
+        </element>
+      </define>
+
+      <define name="props3d">
+        <element name="props3d">
+          <empty/>
+        </element>
+      </define>
+
+      <define name="ligatures">
+        <element name="ligatures">
+          <empty/>
+        </element>
+      </define>
+
+      <define name="numForm">
+        <element name="numForm">
+          <empty/>
+        </element>
+      </define>
+
+      <define name="numSpacing">
+        <element name="numSpacing">
+          <empty/>
+        </element>
+      </define>
+
+      <define name="stylisticSets">
+        <element name="stylisticSets">
+          <empty/>
+        </element>
+      </define>
+
+      <define name="cntxtAlts">
+        <element name="cntxtAlts">
+          <empty/>
+        </element>
+      </define>
+
     </grammar>
 
+    <!-- Simple Types Resource Definitions -->
     <resource name="ST_SchemeColorVal" resource="List" generated="yes">
       <value name="bg1" tokenid="ooxml:ST_SchemeColorVal_bg1">bg1</value>
       <value name="tx1" tokenid="ooxml:ST_SchemeColorVal_tx1">tx1</value>
@@ -5501,12 +5655,29 @@
       <value name="accent5" tokenid="ooxml:ST_SchemeColorVal_accent5">accent5</value>
       <value name="accent6" tokenid="ooxml:ST_SchemeColorVal_accent6">accent6</value>
     </resource>
+
+    <resource name="ST_RectAlignment" resource="List" generated="yes">
+      <value name="none" tokenid="ooxml:ST_RectAlignment_none">none</value>
+      <value name="tl" tokenid="ooxml:ST_RectAlignment_tl">tl</value>
+      <value name="t" tokenid="ooxml:ST_RectAlignment_t">t</value>
+      <value name="tr" tokenid="ooxml:ST_RectAlignment_tr">tr</value>
+      <value name="l" tokenid="ooxml:ST_RectAlignment_l">l</value>
+      <value name="ctr" tokenid="ooxml:ST_RectAlignment_ctr">ctr</value>
+      <value name="r" tokenid="ooxml:ST_RectAlignment_r">r</value>
+      <value name="bl" tokenid="ooxml:ST_RectAlignment_bl">bl</value>
+      <value name="b" tokenid="ooxml:ST_RectAlignment_b">b</value>
+      <value name="br" tokenid="ooxml:ST_RectAlignment_br">br</value>
+    </resource>
+
     <resource name="ST_PositiveCoordinate" resource="Integer" generated="yes"/>
     <resource name="ST_HexColorRGB" resource="Hex"/>
     <resource name="ST_PositivePercentage" resource="Integer" generated="yes"/>
     <resource name="ST_PositiveFixedPercentage" resource="Integer" generated="yes"/>
     <resource name="ST_Percentage" resource="Integer" generated="yes"/>
+    <resource name="ST_PositiveFixedAngle" resource="Integer" generated="yes"/>
+    <resource name="ST_FixedAngle" resource="Integer" generated="yes"/>
 
+    <!-- Groups Resource Definitions -->
     <resource name="EG_ColorTransform" resource="Properties" tag="character">
       <element name="tint" tokenid="ooxml:EG_ColorTransform_tint"/>
       <element name="shade" tokenid="ooxml:EG_ColorTransform_shade"/>
@@ -5523,6 +5694,8 @@
       <element name="srgbClr" tokenid="ooxml:EG_ColorChoice_srgbClr"/>
       <element name="schemeClr" tokenid="ooxml:EG_ColorChoice_schemeClr"/>
     </resource>
+
+    <!-- Complex Types Resource Definitions -->
     <resource name="CT_Glow" resource="Properties" tag="character">
       <attribute name="rad" tokenid="ooxml:CT_Glow_rad"/>
     </resource>
@@ -5541,9 +5714,52 @@
     <resource name="CT_Percentage" resource="Properties" tag="character">
       <attribute name="val" tokenid="ooxml:CT_Percentage_val"/>
     </resource>
+    <resource name="CT_Shadow" resource="Properties" tag="character">
+      <attribute name="blurRad" tokenid="ooxml:CT_Shadow_blurRad"/>
+      <attribute name="dist" tokenid="ooxml:CT_Shadow_dist"/>
+      <attribute name="dir" tokenid="ooxml:CT_Shadow_dir"/>
+      <attribute name="sx" tokenid="ooxml:CT_Shadow_sx"/>
+      <attribute name="sy" tokenid="ooxml:CT_Shadow_sy"/>
+      <attribute name="kx" tokenid="ooxml:CT_Shadow_kx"/>
+      <attribute name="ky" tokenid="ooxml:CT_Shadow_ky"/>
+      <attribute name="algn" tokenid="ooxml:CT_Shadow_algn"/>
+    </resource>
     <resource name="glow" resource="Properties" tag="character">
       <element name="glow" tokenid="ooxml:glow_glow"/>
     </resource>
+    <resource name="shadow" resource="Properties" tag="character">
+      <element name="shadow" tokenid="ooxml:shadow_shadow"/>
+    </resource>
+    <resource name="reflection" resource="Properties" tag="character">
+      <element name="reflection" tokenid="ooxml:reflection_reflection"/>
+    </resource>
+    <resource name="textOutline" resource="Properties" tag="character">
+      <element name="textOutline" tokenid="ooxml:textOutline_textOutline"/>
+    </resource>
+    <resource name="textFill" resource="Properties" tag="character">
+      <element name="textFill" tokenid="ooxml:textFill_textFill"/>
+    </resource>
+    <resource name="scene3d" resource="Properties" tag="character">
+      <element name="scene3d" tokenid="ooxml:scene3d_scene3d"/>
+    </resource>
+    <resource name="props3d" resource="Properties" tag="character">
+      <element name="props3d" tokenid="ooxml:props3d_props3d"/>
+    </resource>
+    <resource name="ligatures" resource="Properties" tag="character">
+      <element name="ligatures" tokenid="ooxml:ligatures_ligatures"/>
+    </resource>
+    <resource name="numForm" resource="Properties" tag="character">
+      <element name="numForm" tokenid="ooxml:numForm_numForm"/>
+    </resource>
+    <resource name="numSpacing" resource="Properties" tag="character">
+      <element name="numSpacing" tokenid="ooxml:numSpacing_numSpacing"/>
+    </resource>
+    <resource name="stylisticSets" resource="Properties" tag="character">
+      <element name="stylisticSets" tokenid="ooxml:stylisticSets_stylisticSets"/>
+    </resource>
+    <resource name="cntxtAlts" resource="Properties" tag="character">
+      <element name="cntxtAlts" tokenid="ooxml:cntxtAlts_cntxtAlts"/>
+    </resource>
   </namespace>
   <namespace name="dml-shapeGeometry" file="dml-shapeGeometry.rng" todo="ignore">
     <grammar xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2006/xpath-functions" xmlns="http://relaxng.org/ns/structure/1.0" ns="http://schemas.openxmlformats.org/drawingml/2006/main" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
@@ -17177,11 +17393,66 @@
             <ref name="CT_OnOff"/>
           </element>
         </optional>
-         <optional>
+        <optional>
           <element name="w14:glow">
             <ref name="BUILT_IN_ANY_TYPE"/>
           </element>
         </optional>
+        <optional>
+          <element name="w14:shadow">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:reflection">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:textOutline">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:textFill">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:scene3d">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:props3d">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:ligatures">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:numForm">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:numSpacing">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:stylisticSets">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
+        <optional>
+          <element name="w14:cntxtAlts">
+            <ref name="BUILT_IN_ANY_TYPE"/>
+          </element>
+        </optional>
       </define>
       <define name="EG_RPrContent">
         <optional>
@@ -23150,6 +23421,17 @@
       <element name="specVanish" tokenid="sprm:CFspecVanish"/>
       <element name="oMath" tokenid="ooxml:EG_RPrBase_oMath"/>
       <element name="w14:glow" tokenid="ooxml:EG_RPrBase_w14_glow"/>
+      <element name="w14:shadow" tokenid="ooxml:EG_RPrBase_w14_shadow"/>
+      <element name="w14:reflection" tokenid="ooxml:EG_RPrBase_w14_reflection"/>
+      <element name="w14:textOutline" tokenid="ooxml:EG_RPrBase_w14_textOutline"/>
+      <element name="w14:textFill" tokenid="ooxml:EG_RPrBase_w14_textFill"/>
+      <element name="w14:scene3d" tokenid="ooxml:EG_RPrBase_w14_scene3d"/>
+      <element name="w14:props3d" tokenid="ooxml:EG_RPrBase_w14_props3d"/>
+      <element name="w14:ligatures" tokenid="ooxml:EG_RPrBase_w14_ligatures"/>
+      <element name="w14:numForm" tokenid="ooxml:EG_RPrBase_w14_numForm"/>
+      <element name="w14:numSpacing" tokenid="ooxml:EG_RPrBase_w14_numSpacing"/>
+      <element name="w14:stylisticSets" tokenid="ooxml:EG_RPrBase_w14_stylisticSets"/>
+      <element name="w14:cntxtAlts" tokenid="ooxml:EG_RPrBase_w14_cntxtAlts"/>
     </resource>
     <resource name="EG_RPrContent" resource="Properties" tag="character">
       <element name="rPrChange" tokenid="ooxml:EG_RPrContent_rPrChange"/>
commit c7f6b816469136aa9b444515a4dfbc5bebb47501
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Sat Feb 22 20:36:35 2014 +0100

    oox: add some more missing w14 tokens
    
    Change-Id: Ied80a30419ac809c0cb20f8c29427ff0945f5904

diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt
index 6f62edd..20ca75f 100644
--- a/oox/source/token/tokens.txt
+++ b/oox/source/token/tokens.txt
@@ -1224,6 +1224,7 @@ cmd
 cmpd
 cnfStyle
 cnt
+cntxtAlts
 code
 codeName
 codePage
@@ -3015,6 +3016,7 @@ lgDashDotDot
 lgGrid
 license
 lid
+ligatures
 light1
 light2
 lightBulb
@@ -3544,6 +3546,7 @@ numCol
 numFmt
 numFmtId
 numFmts
+numForm
 numId
 numIdMacAtCleanup
 numLit
@@ -3553,6 +3556,7 @@ numPr
 numRef
 numRestart
 numSld
+numSpacing
 numStart
 numStyleLink
 numTab
@@ -4026,6 +4030,7 @@ proofErr
 proofState
 property
 propertyName
+props3d
 prot
 protected
 protectedRange
@@ -4914,6 +4919,7 @@ stylePaneFormatFilter
 stylePaneSortMethod
 styleSheet
 styles
+stylisticSets
 sub
 subDoc
 subFontBySize
@@ -5123,6 +5129,7 @@ textInflateTop
 textInput
 textLength
 textNoShape
+textOutline
 textPlain
 textPr
 textRingInside


More information about the Libreoffice-commits mailing list