Kaydet (Commit) 96b07db8 authored tarafından Grzegorz Araminowicz's avatar Grzegorz Araminowicz Kaydeden (comit) Thorsten Behrens

SmartArt: get rid of tagToVarIdx() and change VarMap to std::map

it was unnecessarily complicated

Change-Id: I5ad4b4a6a401ffe6a67a471fa355ade9c1514ef1
Reviewed-on: https://gerrit.libreoffice.org/41458Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
Tested-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
üst 0d46a29b
......@@ -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
......
......@@ -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 )
......
......@@ -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;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment