[Libreoffice-commits] core.git: 4 commits - editeng/source include/editeng include/oox oox/Library_oox.mk oox/source writerfilter/source

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Mon Mar 10 09:13:00 PDT 2014


 editeng/source/editeng/eerdll.cxx                       |    4 
 include/editeng/eeitem.hxx                              |   18 
 include/editeng/unotext.hxx                             |    4 
 include/oox/drawingml/textcharacterproperties.hxx       |    2 
 include/oox/drawingml/texteffectscontext.hxx            |   50 ++
 include/oox/helper/grabbagstack.hxx                     |    1 
 oox/Library_oox.mk                                      |    1 
 oox/source/drawingml/textcharacterproperties.cxx        |   23 +
 oox/source/drawingml/textcharacterpropertiescontext.cxx |   17 
 oox/source/drawingml/texteffectscontext.cxx             |  303 ++++++++++++++++
 oox/source/helper/grabbagstack.cxx                      |    5 
 oox/source/token/properties.txt                         |    1 
 writerfilter/source/dmapper/TextEffectsHandler.cxx      |   14 
 13 files changed, 425 insertions(+), 18 deletions(-)

New commits:
commit 7a9d4cd51ee9b1ce6cdf076caeeed6d2ae07fb92
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Mar 10 17:04:07 2014 +0100

    writerfilter: stylistic change to TextEffectsHandler
    
    Change-Id: I5be926394dd97897dfb5ef3d4c03bb9ad9865a35

diff --git a/writerfilter/source/dmapper/TextEffectsHandler.cxx b/writerfilter/source/dmapper/TextEffectsHandler.cxx
index ef8efc8..36db317 100644
--- a/writerfilter/source/dmapper/TextEffectsHandler.cxx
+++ b/writerfilter/source/dmapper/TextEffectsHandler.cxx
@@ -27,7 +27,7 @@ using namespace css::beans;
 namespace
 {
 
-OUString getNameForElementId(sal_uInt32 aId)
+OUString lclGetNameForElementId(sal_uInt32 aId)
 {
     static std::map<sal_uInt32, OUString> aIdMap;
     if(aIdMap.empty())
@@ -69,6 +69,8 @@ OUString getNameForElementId(sal_uInt32 aId)
     return aIdMap[aId];
 }
 
+const char constAttributesSequenceName[] = "attributes";
+
 }
 
 OUString TextEffectsHandler::getSchemeColorValTypeString(sal_Int32 nType)
@@ -496,8 +498,8 @@ boost::optional<PropertyIds> TextEffectsHandler::getGrabBagPropertyId()
 
 void TextEffectsHandler::lcl_attribute(Id aName, Value& aValue)
 {
-    if (mpGrabBagStack->getCurrentName() != "attributes")
-        mpGrabBagStack->push("attributes");
+    if (mpGrabBagStack->getCurrentName() != constAttributesSequenceName)
+        mpGrabBagStack->push(constAttributesSequenceName);
 
     switch(aName)
     {
@@ -720,11 +722,11 @@ void TextEffectsHandler::lcl_attribute(Id aName, Value& aValue)
 
 void TextEffectsHandler::lcl_sprm(Sprm& rSprm)
 {
-    if (mpGrabBagStack->getCurrentName() == "attributes")
+    if (mpGrabBagStack->getCurrentName() == constAttributesSequenceName)
         mpGrabBagStack->pop();
 
     sal_uInt32 nSprmId = rSprm.getId();
-    OUString aElementName = getNameForElementId(nSprmId);
+    OUString aElementName = lclGetNameForElementId(nSprmId);
     if(aElementName.isEmpty())
     {
         // Element is unknown -> leave.
@@ -739,7 +741,7 @@ void TextEffectsHandler::lcl_sprm(Sprm& rSprm)
 
     pProperties.get()->resolve( *this );
 
-    if (mpGrabBagStack->getCurrentName() == "attributes")
+    if (mpGrabBagStack->getCurrentName() == constAttributesSequenceName)
         mpGrabBagStack->pop();
 
     mpGrabBagStack->pop();
commit fc46b5acc4ae354f712f5afcb6a42c2f09e03e96
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Mar 10 17:03:01 2014 +0100

    editeng: Add CharInteropGrabBag to editeng.
    
    Change-Id: I91c816499f463febc536d79e4a9fd9804f74df00

diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index 2045105..05d1bfb 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -39,6 +39,7 @@
 #include <editeng/scriptspaceitem.hxx>
 #include <editeng/numdef.hxx>
 #include <svl/itempool.hxx>
+#include <svl/grabbagitem.hxx>
 #include <vcl/virdev.hxx>
 
 #include <editeng/autokernitem.hxx>
@@ -160,8 +161,9 @@ SfxPoolItem** GlobalEditData::GetDefItems()
         ppDefItems[50] = new SfxVoidItem( EE_FEATURE_LINEBR );
         ppDefItems[51] = new SvxCharSetColorItem( Color( COL_RED ), RTL_TEXTENCODING_DONTKNOW, EE_FEATURE_NOTCONV );
         ppDefItems[52] = new SvxFieldItem( SvxFieldData(), EE_FEATURE_FIELD );
+        ppDefItems[53] = new SfxGrabBagItem( EE_CHAR_GRABBAG );
 
-        DBG_ASSERT( EDITITEMCOUNT == 53, "ITEMCOUNT geaendert, DefItems nicht angepasst!" );
+        DBG_ASSERT( EDITITEMCOUNT == 54, "ITEMCOUNT geaendert, DefItems nicht angepasst!" );
 
         // Init DefFonts:
         GetDefaultFonts( *(SvxFontItem*)ppDefItems[EE_CHAR_FONTINFO - EE_ITEMS_START],
diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx
index 5a239927..5d90714 100644
--- a/include/editeng/eeitem.hxx
+++ b/include/editeng/eeitem.hxx
@@ -79,17 +79,17 @@
 #define EE_CHAR_XMLATTRIBS          (EE_ITEMS_START+46)
 #define EE_CHAR_OVERLINE            (EE_ITEMS_START+47)
 #define EE_CHAR_CASEMAP             (EE_ITEMS_START+48)
-#define EE_CHAR_END                 (EE_ITEMS_START+48)
+#define EE_CHAR_GRABBAG             (EE_ITEMS_START+49)
+#define EE_CHAR_END                 (EE_ITEMS_START+49)
 
+#define EE_FEATURE_START            (EE_ITEMS_START+50)
+#define EE_FEATURE_TAB              (EE_ITEMS_START+50)
+#define EE_FEATURE_LINEBR           (EE_ITEMS_START+51)
+#define EE_FEATURE_NOTCONV          (EE_ITEMS_START+52)
+#define EE_FEATURE_FIELD            (EE_ITEMS_START+53)
+#define EE_FEATURE_END              (EE_ITEMS_START+53)
 
-#define EE_FEATURE_START            (EE_ITEMS_START+49)
-#define EE_FEATURE_TAB              (EE_ITEMS_START+49)
-#define EE_FEATURE_LINEBR           (EE_ITEMS_START+50)
-#define EE_FEATURE_NOTCONV          (EE_ITEMS_START+51)
-#define EE_FEATURE_FIELD            (EE_ITEMS_START+52)
-#define EE_FEATURE_END              (EE_ITEMS_START+52)
-
-#define EE_ITEMS_END                (EE_ITEMS_START+52)
+#define EE_ITEMS_END                (EE_ITEMS_START+53)
 
 #define EDITITEMCOUNT ( EE_ITEMS_END - EE_ITEMS_START + 1 )
 
diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx
index 5c1f11c..b8c758c 100644
--- a/include/editeng/unotext.hxx
+++ b/include/editeng/unotext.hxx
@@ -125,7 +125,9 @@ class SvxItemPropertySet;
     { OUString(UNO_NAME_EDIT_CHAR_POSTURE_COMPLEX),     EE_CHAR_ITALIC_CTL,     ::getCppuType((const ::com::sun::star::awt::FontSlant*)0),0, MID_POSTURE }, \
     { OUString(UNO_NAME_EDIT_CHAR_WEIGHT_COMPLEX),      EE_CHAR_WEIGHT_CTL,     ::getCppuType((const float*)0),            0, MID_WEIGHT }, \
     { OUString(UNO_NAME_EDIT_CHAR_LOCALE_COMPLEX),      EE_CHAR_LANGUAGE_CTL,   ::getCppuType((const ::com::sun::star::lang::Locale*)0),0, MID_LANG_LOCALE }, \
-    { OUString("CharRelief"),                           EE_CHAR_RELIEF,         ::getCppuType((const sal_Int16*)0),    0, MID_RELIEF }
+    { OUString("CharRelief"),                           EE_CHAR_RELIEF,         ::getCppuType((const sal_Int16*)0),    0, MID_RELIEF }, \
+    { OUString("CharInteropGrabBag"),                   EE_CHAR_GRABBAG,        ::getCppuType((css::uno::Sequence<css::beans::PropertyValue >*)0), 0, 0}
+
 
 #define SVX_UNOEDIT_FONT_PROPERTIES \
     {OUString(UNO_NAME_EDIT_FONT_DESCRIPTOR),   WID_FONTDESC,       ::getCppuType((const ::com::sun::star::awt::FontDescriptor*)0),    0, MID_FONT_FAMILY_NAME }
commit 1959431528686bd1b73b73c2664c8c161c2194f5
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Mar 10 14:19:26 2014 +0100

    oox: handle all w14 text effects at groupshape import
    
    When dealing with groupshapes, the responsibility to process the
    w14 text effects elements is in oox. This commit adds the code
    to handle all elements and its children elements and attributes and
    puts the values into a CharInteropGrabBag.
    
    Change-Id: Iafb8759bd60e0ee831296dc2d9159f4311ad5403

diff --git a/include/oox/drawingml/textcharacterproperties.hxx b/include/oox/drawingml/textcharacterproperties.hxx
index cdcdd26..e51937f 100644
--- a/include/oox/drawingml/textcharacterproperties.hxx
+++ b/include/oox/drawingml/textcharacterproperties.hxx
@@ -57,6 +57,8 @@ struct TextCharacterProperties
     OptValue< bool >    moUnderlineLineFollowText;
     OptValue< bool >    moUnderlineFillFollowText;
 
+    std::vector<css::beans::PropertyValue> maTextEffectsProperties;
+
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const TextCharacterProperties& rSourceProps );
 
diff --git a/include/oox/drawingml/texteffectscontext.hxx b/include/oox/drawingml/texteffectscontext.hxx
new file mode 100644
index 0000000..b8e3aeb
--- /dev/null
+++ b/include/oox/drawingml/texteffectscontext.hxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#ifndef INCLUDED_OOX_DRAWINGML_TEXTEFFECTSCONTEXT_HXX
+#define INCLUDED_OOX_DRAWINGML_TEXTEFFECTSCONTEXT_HXX
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <oox/helper/grabbagstack.hxx>
+#include <oox/core/contexthandler2.hxx>
+#include <boost/scoped_ptr.hpp>
+#include <vector>
+
+namespace oox { namespace drawingml {
+
+class TextEffectsContext : public oox::core::ContextHandler2
+{
+public:
+    TextEffectsContext(oox::core::ContextHandler2Helper& rParent,
+                       sal_Int32 aElementToken,
+                       std::vector<css::beans::PropertyValue>& rTextEffectsProperties);
+    virtual ~TextEffectsContext();
+
+    virtual void onStartElement(const oox::AttributeList& rAttribs) SAL_OVERRIDE;
+    virtual void onEndElement() SAL_OVERRIDE;
+
+    virtual oox::core::ContextHandlerRef onCreateContext(sal_Int32 Element, const oox::AttributeList& rAttribs) SAL_OVERRIDE;
+
+protected:
+    std::vector<css::beans::PropertyValue>& mrTextEffectsProperties;
+    boost::scoped_ptr<oox::GrabBagStack> mpGrabBagStack;
+    sal_Int32 mnCurrentElement;
+
+private:
+    void processAttributes(const AttributeList& rAttribs);
+    void pushAttributeToGrabBag (const sal_Int32& aAttributeId, const OUString& rElementName, const AttributeList& rAttribs);
+};
+
+} }
+
+#endif // INCLUDED_OOX_DRAWINGML_TEXTEFFECTSCONTEXT_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index cdda38a..007c22f 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -187,6 +187,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
     oox/source/drawingml/textbodyproperties \
     oox/source/drawingml/textcharacterpropertiescontext \
     oox/source/drawingml/textcharacterproperties \
+    oox/source/drawingml/texteffectscontext \
     oox/source/drawingml/textfieldcontext \
     oox/source/drawingml/textfield \
     oox/source/drawingml/textfont \
diff --git a/oox/source/drawingml/textcharacterproperties.cxx b/oox/source/drawingml/textcharacterproperties.cxx
index 7f2e3a7..bb7b227 100644
--- a/oox/source/drawingml/textcharacterproperties.cxx
+++ b/oox/source/drawingml/textcharacterproperties.cxx
@@ -63,6 +63,8 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource
     moItalic.assignIfUsed( rSourceProps.moItalic );
     moUnderlineLineFollowText.assignIfUsed( rSourceProps.moUnderlineLineFollowText );
     moUnderlineFillFollowText.assignIfUsed( rSourceProps.moUnderlineFillFollowText );
+
+    maTextEffectsProperties = rSourceProps.maTextEffectsProperties;
 }
 
 void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFilterBase& rFilter, bool bUseOptional ) const
@@ -159,11 +161,30 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
     }
 }
 
-    void TextCharacterProperties::pushToPropSet( PropertySet& rPropSet, const XmlFilterBase& rFilter, bool bUseOptional ) const
+void pushToGrabBag( PropertySet& rPropSet, const std::vector<PropertyValue>& aVectorOfProperyValues )
+{
+    Sequence<PropertyValue> aGrabBag;
+    Any aAnyGrabBag = rPropSet.getAnyProperty(PROP_CharInteropGrabBag);
+    aAnyGrabBag >>= aGrabBag;
+
+    sal_Int32 nLength = aGrabBag.getLength();
+    aGrabBag.realloc(nLength + aVectorOfProperyValues.size());
+
+    for (size_t i = 0; i < aVectorOfProperyValues.size(); i++)
+    {
+        PropertyValue aPropertyValue = aVectorOfProperyValues[i];
+        aGrabBag[nLength + i] = aPropertyValue;
+    }
+
+    rPropSet.setAnyProperty(PROP_CharInteropGrabBag, makeAny(aGrabBag));
+}
+
+void TextCharacterProperties::pushToPropSet( PropertySet& rPropSet, const XmlFilterBase& rFilter, bool bUseOptional ) const
 {
     PropertyMap aPropMap;
     pushToPropMap( aPropMap, rFilter, bUseOptional );
     rPropSet.setProperties( aPropMap );
+    pushToGrabBag(rPropSet, maTextEffectsProperties);
 }
 
 float TextCharacterProperties::getCharHeightPoints( float fDefault ) const
diff --git a/oox/source/drawingml/textcharacterpropertiescontext.cxx b/oox/source/drawingml/textcharacterpropertiescontext.cxx
index cde4a63..b432c80 100644
--- a/oox/source/drawingml/textcharacterpropertiescontext.cxx
+++ b/oox/source/drawingml/textcharacterpropertiescontext.cxx
@@ -22,6 +22,7 @@
 #include "oox/helper/attributelist.hxx"
 #include "oox/drawingml/drawingmltypes.hxx"
 #include "oox/drawingml/colorchoicecontext.hxx"
+#include "oox/drawingml/texteffectscontext.hxx"
 #include "oox/drawingml/lineproperties.hxx"
 #include "oox/drawingml/textparagraphproperties.hxx"
 #include "oox/core/relations.hxx"
@@ -194,6 +195,22 @@ ContextHandlerRef TextCharacterPropertiesContext::onCreateContext( sal_Int32 aEl
                     mrTextCharacterProperties.moCaseMap = XML_none;
             }
             break;
+        case OOX_TOKEN(w14, glow):
+        case OOX_TOKEN(w14, shadow):
+        case OOX_TOKEN(w14, reflection):
+        case OOX_TOKEN(w14, textOutline):
+        case OOX_TOKEN(w14, textFill):
+        case OOX_TOKEN(w14, scene3d):
+        case OOX_TOKEN(w14, props3d):
+        case OOX_TOKEN(w14, ligatures):
+        case OOX_TOKEN(w14, numForm):
+        case OOX_TOKEN(w14, numSpacing):
+        case OOX_TOKEN(w14, stylisticSets):
+        case OOX_TOKEN(w14, cntxtAlts):
+            {
+                return new TextEffectsContext( *this, aElementToken, mrTextCharacterProperties.maTextEffectsProperties );
+            }
+            break;
         default:
             SAL_WARN("oox", "TextCharacterPropertiesContext::onCreateContext: unhandled element: " << getBaseToken(aElementToken));
             break;
diff --git a/oox/source/drawingml/texteffectscontext.cxx b/oox/source/drawingml/texteffectscontext.cxx
new file mode 100644
index 0000000..ffe3283
--- /dev/null
+++ b/oox/source/drawingml/texteffectscontext.cxx
@@ -0,0 +1,303 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ */
+
+#include "oox/drawingml/texteffectscontext.hxx"
+
+#include <map>
+
+namespace oox { namespace drawingml {
+
+namespace
+{
+
+OUString lclGetNameForElementId(sal_uInt32 aId)
+{
+    static std::map<sal_uInt32, OUString> aIdMap;
+    if(aIdMap.empty())
+    {
+        aIdMap[OOX_TOKEN(w14, srgbClr)]      = "srgbClr";
+        aIdMap[OOX_TOKEN(w14, schemeClr)]    = "schemeClr";
+        aIdMap[OOX_TOKEN(w14, tint)]         = "tint";
+        aIdMap[OOX_TOKEN(w14, shade)]        = "shade";
+        aIdMap[OOX_TOKEN(w14, alpha)]        = "alpha";
+        aIdMap[OOX_TOKEN(w14, hueMod)]       = "hueMod";
+        aIdMap[OOX_TOKEN(w14, sat)]          = "sat";
+        aIdMap[OOX_TOKEN(w14, satOff)]       = "satOff";
+        aIdMap[OOX_TOKEN(w14, satMod)]       = "satMod";
+        aIdMap[OOX_TOKEN(w14, lum)]          = "lum";
+        aIdMap[OOX_TOKEN(w14, lumOff)]       = "lumOff";
+        aIdMap[OOX_TOKEN(w14, lumMod)]       = "lumMod";
+        aIdMap[OOX_TOKEN(w14, noFill)]       = "noFill";
+        aIdMap[OOX_TOKEN(w14, solidFill)]    = "solidFill";
+        aIdMap[OOX_TOKEN(w14, gradFill)]     = "gradFill";
+        aIdMap[OOX_TOKEN(w14, gsLst)]        = "gsLst";
+        aIdMap[OOX_TOKEN(w14, gs)]           = "gs";
+        aIdMap[OOX_TOKEN(w14, pos)]          = "pos";
+        aIdMap[OOX_TOKEN(w14, lin)]          = "lin";
+        aIdMap[OOX_TOKEN(w14, path)]         = "path";
+        aIdMap[OOX_TOKEN(w14, fillToRect)]   = "fillToRect";
+        aIdMap[OOX_TOKEN(w14, prstDash)]     = "prstDash";
+        aIdMap[OOX_TOKEN(w14, round)]        = "round";
+        aIdMap[OOX_TOKEN(w14, bevel)]        = "bevel";
+        aIdMap[OOX_TOKEN(w14, miter)]        = "miter";
+        aIdMap[OOX_TOKEN(w14, camera)]       = "camera";
+        aIdMap[OOX_TOKEN(w14, lightRig)]     = "lightRig";
+        aIdMap[OOX_TOKEN(w14, rot)]          = "rot";
+        aIdMap[OOX_TOKEN(w14, bevelT)]       = "bevelT";
+        aIdMap[OOX_TOKEN(w14, bevelB)]       = "bevelB";
+        aIdMap[OOX_TOKEN(w14, extrusionClr)] = "extrusionClr";
+        aIdMap[OOX_TOKEN(w14, contourClr)]   = "contourClr";
+        aIdMap[OOX_TOKEN(w14, styleSet)]     = "styleSet";
+
+        aIdMap[OOX_TOKEN(w14, glow)]         = "CharGlowTextEffect";
+        aIdMap[OOX_TOKEN(w14, shadow)]       = "CharShadowTextEffect";
+        aIdMap[OOX_TOKEN(w14, reflection)]   = "CharReflectionTextEffect";
+        aIdMap[OOX_TOKEN(w14, textOutline)]  = "CharTextOutlineTextEffect";
+        aIdMap[OOX_TOKEN(w14, textFill)]     = "CharTextFillTextEffect";
+        aIdMap[OOX_TOKEN(w14, scene3d)]      = "CharScene3DTextEffect";
+        aIdMap[OOX_TOKEN(w14, props3d)]      = "CharProps3DTextEffect";
+        aIdMap[OOX_TOKEN(w14, ligatures)]    = "CharLigaturesTextEffect";
+        aIdMap[OOX_TOKEN(w14, numForm)]      = "CharNumFormTextEffect";
+        aIdMap[OOX_TOKEN(w14, numSpacing)]   = "CharNumSpacingTextEffect";
+        aIdMap[OOX_TOKEN(w14, stylisticSets)]= "CharStylisticSetsTextEffect";
+        aIdMap[OOX_TOKEN(w14, cntxtAlts)]    = "CharCntxtAltsTextEffect";
+    }
+
+    return aIdMap[aId];
+}
+
+const char constAttributesSequenceName[] = "attributes";
+
+}
+
+using namespace oox::core;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::beans;
+
+TextEffectsContext::TextEffectsContext(
+                        ContextHandler2Helper& rParent,
+                        sal_Int32 aElementToken,
+                        std::vector<PropertyValue>& rTextEffectsProperties)
+    : ContextHandler2(rParent)
+    , mrTextEffectsProperties(rTextEffectsProperties)
+    , mpGrabBagStack(NULL)
+    , mnCurrentElement(aElementToken)
+{
+}
+
+TextEffectsContext::~TextEffectsContext()
+{
+}
+
+void TextEffectsContext::pushAttributeToGrabBag (const sal_Int32& aAttributeId, const OUString& rElementName, const AttributeList& rAttribs)
+{
+    if (!rAttribs.hasAttribute(aAttributeId))
+        return;
+    OUString aString = rAttribs.getString(aAttributeId).get();
+    mpGrabBagStack->addString(rElementName, aString);
+}
+
+void TextEffectsContext::processAttributes(const AttributeList& rAttribs)
+{
+    mpGrabBagStack->push(constAttributesSequenceName);
+    switch(mnCurrentElement)
+    {
+        case OOX_TOKEN(w14, glow):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, rad),  "rad",  rAttribs);
+        }
+        case OOX_TOKEN(w14, srgbClr):
+        case OOX_TOKEN(w14, schemeClr):
+        case OOX_TOKEN(w14, tint):
+        case OOX_TOKEN(w14, shade):
+        case OOX_TOKEN(w14, alpha):
+        case OOX_TOKEN(w14, hueMod):
+        case OOX_TOKEN(w14, sat):
+        case OOX_TOKEN(w14, satOff):
+        case OOX_TOKEN(w14, satMod):
+        case OOX_TOKEN(w14, lum):
+        case OOX_TOKEN(w14, lumOff):
+        case OOX_TOKEN(w14, lumMod):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, val),  "val",  rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, shadow):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, blurRad),  "blurRad",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, dist),     "dist",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, dir),      "dir",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, sx),       "sx",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, sy),       "sy",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, kx),       "kx",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, ky),       "ky",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, algn),     "algn",  rAttribs);
+        }
+        case OOX_TOKEN(w14, reflection):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, blurRad),  "blurRad",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, stA),      "stA",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, stPos),    "stPos",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, endA),     "endA",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, endPos),   "endPos",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, dist),     "dist",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, dir),      "dir",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, fadeDir),  "fadeDir",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, sx),       "sx",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, sy),       "sy",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, kx),       "kx",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, ky),       "ky",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, algn),     "algn",  rAttribs);
+        }
+        case OOX_TOKEN(w14, textOutline):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, w),     "w",   rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, cap),  "cap",  rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, cmpd), "cmpd", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, algn), "algn", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, prstDash):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, val),  "val",  rAttribs);
+        }
+        case OOX_TOKEN(w14, gs):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, pos),  "pos", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, lin):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, ang),    "ang", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, scaled), "scaled", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, path):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, path), "path", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, fillToRect):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, l), "l", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, t), "t", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, r), "r", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, b), "b", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, miter):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, lim), "lim", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, camera):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, prst), "prst", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, lightRig):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, rig), "rig", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, dir), "dir", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, rot):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, lat), "lat", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, lon), "lon", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, rev), "rev", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, props3d):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, extrusionH),   "extrusionH", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, contourW),     "contourW", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, prstMaterial), "prstMaterial", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, bevelT):
+        case OOX_TOKEN(w14, bevelB):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, w),    "w", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, h),    "h", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, prst), "prst", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, ligatures):
+        case OOX_TOKEN(w14, numForm):
+        case OOX_TOKEN(w14, numSpacing):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, val), "val", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, styleSet):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, id), "id", rAttribs);
+            pushAttributeToGrabBag(OOX_TOKEN(w14, val), "val", rAttribs);
+        }
+        break;
+        case OOX_TOKEN(w14, cntxtAlts):
+        {
+            pushAttributeToGrabBag(OOX_TOKEN(w14, val), "val", rAttribs);
+        }
+        break;
+        default:
+            break;
+    }
+
+    mpGrabBagStack->pop();
+}
+
+void TextEffectsContext::onStartElement(const oox::AttributeList& rAttribs)
+{
+    OUString aElementName = lclGetNameForElementId(mnCurrentElement);
+    if(mpGrabBagStack.get() == NULL)
+        mpGrabBagStack.reset(new GrabBagStack(aElementName));
+    mpGrabBagStack->push(aElementName);
+    processAttributes(rAttribs);
+}
+
+void TextEffectsContext::onEndElement()
+{
+    mpGrabBagStack->pop();
+    OUString aCurrentElementName = mpGrabBagStack->getCurrentName();
+    OUString aPropertyName;
+
+    if (mpGrabBagStack->isStackEmpty())
+    {
+        if (aCurrentElementName == "CharGlowTextEffect" ||
+            aCurrentElementName == "CharShadowTextEffect" ||
+            aCurrentElementName == "CharReflectionTextEffect" ||
+            aCurrentElementName == "CharTextOutlineTextEffect" ||
+            aCurrentElementName == "CharTextFillTextEffect" ||
+            aCurrentElementName == "CharScene3DTextEffect" ||
+            aCurrentElementName == "CharProps3DTextEffect" ||
+            aCurrentElementName == "CharLigaturesTextEffect" ||
+            aCurrentElementName == "CharNumFormTextEffect" ||
+            aCurrentElementName == "CharNumSpacingTextEffect" ||
+            aCurrentElementName == "CharStylisticSetsTextEffect" ||
+            aCurrentElementName == "CharCntxtAltsTextEffect")
+        {
+            PropertyValue aValue = mpGrabBagStack->getRootProperty();
+            mrTextEffectsProperties.push_back(aValue);
+        }
+    }
+
+}
+
+ContextHandlerRef TextEffectsContext::onCreateContext(sal_Int32 aElementToken, const AttributeList& /*rAttribs*/)
+{
+    mnCurrentElement = aElementToken;
+    return this;
+}
+
+} }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index 7a41af2..e6b824e 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -71,6 +71,7 @@ CharFontPitchComplex
 CharHeight
 CharHeightAsian
 CharHeightComplex
+CharInteropGrabBag
 CharKerning
 CharLocale
 CharLocaleAsian
commit d665e63be3e4dfad44b178ee90ad83f9408fd43c
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Mon Mar 10 14:13:51 2014 +0100

    oox: GrabBagStack: add method isStackEmpty
    
    Change-Id: Iec563762e7be7fb6e2d5501fe5efeb88093793cb

diff --git a/include/oox/helper/grabbagstack.hxx b/include/oox/helper/grabbagstack.hxx
index b438ac8..8a73237 100644
--- a/include/oox/helper/grabbagstack.hxx
+++ b/include/oox/helper/grabbagstack.hxx
@@ -47,6 +47,7 @@ public:
     void pop();
     void addInt32(OUString aElementName, sal_Int32 aIntValue);
     void addString(OUString aElementName, OUString aStringValue);
+    bool isStackEmpty();
 };
 
 } // namespace oox
diff --git a/oox/source/helper/grabbagstack.cxx b/oox/source/helper/grabbagstack.cxx
index ee7ec70..b62f5e2 100644
--- a/oox/source/helper/grabbagstack.cxx
+++ b/oox/source/helper/grabbagstack.cxx
@@ -30,6 +30,11 @@ OUString GrabBagStack::getCurrentName()
     return mCurrentElement.maName;
 }
 
+bool GrabBagStack::isStackEmpty()
+{
+    return mStack.empty();
+}
+
 PropertyValue GrabBagStack::getRootProperty()
 {
     while(!mStack.empty())


More information about the Libreoffice-commits mailing list