oox/source/drawingml/diagram/diagramlayoutatoms.hxx |   17 ------
 oox/source/drawingml/diagram/layoutnodecontext.cxx  |   49 --------------------
 oox/source/drawingml/diagram/layoutnodecontext.hxx  |    2 
 3 files changed, 2 insertions(+), 66 deletions(-)

New commits:
commit 96b07db82b4a7834246ae8acc395cd2cb355630b
Author: Grzegorz Araminowicz <g.araminow...@gmail.com>
Date:   Wed Aug 23 14:26:03 2017 +0200

    SmartArt: get rid of tagToVarIdx() and change VarMap to std::map
    
    it was unnecessarily complicated
    
    Change-Id: I5ad4b4a6a401ffe6a67a471fa355ade9c1514ef1
    Reviewed-on: https://gerrit.libreoffice.org/41458
    Reviewed-by: Thorsten Behrens <thorsten.behr...@cib.de>
    Tested-by: Thorsten Behrens <thorsten.behr...@cib.de>

diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx 
b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
index a7ff21759174..cb7c84e9e532 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
@@ -22,9 +22,7 @@
 
 #include <map>
 #include <memory>
-#include <array>
 
-#include <com/sun/star/uno/Any.hxx>
 #include <com/sun/star/xml/sax/XFastAttributeList.hpp>
 
 #include "oox/drawingml/shape.hxx"
@@ -207,20 +205,7 @@ class LayoutNode
     : public LayoutAtom
 {
 public:
-    enum {
-        VAR_animLvl = 0,
-        VAR_animOne,
-        VAR_bulletEnabled,
-        VAR_chMax,
-        VAR_chPref,
-        VAR_dir,
-        VAR_hierBranch,
-        VAR_orgChart,
-        VAR_resizeHandles
-    };
-    // we know that the array is of fixed size
-    // the use of Any allow having empty values
-    typedef std::array<css::uno::Any, 9> VarMap;
+    typedef std::map<sal_Int32, OUString> VarMap;
 
     LayoutNode(const Diagram& rDgm) : LayoutAtom(*this), mrDgm(rDgm), 
mnChildOrder(0) {}
     const Diagram& getDiagram() const
diff --git a/oox/source/drawingml/diagram/layoutnodecontext.cxx 
b/oox/source/drawingml/diagram/layoutnodecontext.cxx
index 77a3fa3b8ed8..6fc38a5608a0 100644
--- a/oox/source/drawingml/diagram/layoutnodecontext.cxx
+++ b/oox/source/drawingml/diagram/layoutnodecontext.cxx
@@ -160,12 +160,7 @@ public:
 
     virtual ContextHandlerRef onCreateContext( ::sal_Int32 aElement, const 
AttributeList& rAttribs ) override
         {
-            sal_Int32 nIdx =  LayoutNodeContext::tagToVarIdx( getBaseToken( 
aElement ) );
-            if( nIdx != -1 )
-            {
-                mVariables[ nIdx ] <<= rAttribs.getString( XML_val ).get();
-            }
-
+            mVariables[ getBaseToken(aElement) ] = rAttribs.getString( XML_val 
).get();
             return this;
         }
 private:
@@ -187,48 +182,6 @@ LayoutNodeContext::~LayoutNodeContext()
 {
 }
 
-/** convert the XML tag to a variable index in the array
- * @param aTag the tag, without namespace
- * @return the variable index. -1 is an error
- */
-sal_Int32 LayoutNodeContext::tagToVarIdx( sal_Int32 aTag )
-{
-    sal_Int32 nIdx = -1;
-    switch( aTag )
-    {
-    case DGM_TOKEN( animLvl ):
-        nIdx = LayoutNode::VAR_animLvl;
-        break;
-    case DGM_TOKEN( animOne ):
-        nIdx = LayoutNode::VAR_animOne;
-        break;
-    case DGM_TOKEN( bulletEnabled ):
-        nIdx = LayoutNode::VAR_bulletEnabled;
-        break;
-    case DGM_TOKEN( chMax ):
-        nIdx = LayoutNode::VAR_chMax;
-        break;
-    case DGM_TOKEN( chPref ):
-        nIdx = LayoutNode::VAR_chPref;
-        break;
-    case DGM_TOKEN( dir ):
-        nIdx = LayoutNode::VAR_dir;
-        break;
-    case DGM_TOKEN( hierBranch ):
-        nIdx = LayoutNode::VAR_hierBranch;
-        break;
-    case DGM_TOKEN( orgChart ):
-        nIdx = LayoutNode::VAR_orgChart;
-        break;
-    case DGM_TOKEN( resizeHandles ):
-        nIdx = LayoutNode::VAR_resizeHandles;
-        break;
-    default:
-        break;
-    }
-    return nIdx;
-}
-
 ContextHandlerRef
 LayoutNodeContext::onCreateContext( ::sal_Int32 aElement,
                                     const AttributeList& rAttribs )
diff --git a/oox/source/drawingml/diagram/layoutnodecontext.hxx 
b/oox/source/drawingml/diagram/layoutnodecontext.hxx
index 85f73f029f24..335c86fa13c9 100644
--- a/oox/source/drawingml/diagram/layoutnodecontext.hxx
+++ b/oox/source/drawingml/diagram/layoutnodecontext.hxx
@@ -33,8 +33,6 @@ public:
     virtual ~LayoutNodeContext() override;
 
     virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 
Element, const ::oox::AttributeList& rAttribs ) override;
-
-    static ::sal_Int32 tagToVarIdx( ::sal_Int32 aTag );
 private:
     LayoutAtomPtr mpNode;
 };
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to