Ulrich Van Den Hekke 11 years ago
parent
commit
08a0ae104c
  1. 2
      datas/core_html_definition.xml
  2. 12
      plugins/core/editors/models/html_xsl_base/definition_attributenode.cpp
  3. 4
      plugins/core/editors/models/html_xsl_base/definition_attributenode.h
  4. 23
      plugins/core/editors/models/html_xsl_base/definition_balisenode.cpp
  5. 4
      plugins/core/editors/models/html_xsl_base/definition_balisenode.h

2
datas/core_html_definition.xml

@ -868,7 +868,7 @@
<attribute name="onselect" />
<attribute name="tabindex" />
<attribute name="title" />
<attribute name="id" />
<attribute name="id" default="true" />
<attribute name="style" />
<attribute name="onclick" />
<attribute name="name" default="true" />

12
plugins/core/editors/models/html_xsl_base/definition_attributenode.cpp

@ -39,7 +39,7 @@ QSharedPointer<AttributeNode> AttributeNode::create(const QString & name, QShare
return ptr;
}
AttributeNode::AttributeNode(const QString& name): ContentView3::Node(name.trimmed())
AttributeNode::AttributeNode(const QString& name): ContentView3::Node(name.trimmed()), _ord(0)
{
setIcon(":/images/noeud.png");
setType(tr("Attribute"));
@ -60,6 +60,16 @@ void AttributeNode::setDefault(bool value)
_is_default = value;
}
void AttributeNode::setOrd(int value)
{
_ord = value;
}
int AttributeNode::ord() const
{
return _ord;
}
QList< QSharedPointer<ValueNode> > AttributeNode::defaultValues() const
{
QList< QSharedPointer<ValueNode> > result;

4
plugins/core/editors/models/html_xsl_base/definition_attributenode.h

@ -48,6 +48,9 @@ public:
bool isDefault() const;
void setDefault(bool value);
void setOrd(int value);
int ord() const;
QList< QSharedPointer<ValueNode> > defaultValues() const;
QList< QSharedPointer<ValueNode> > values() const;
void addValue(QSharedPointer<ValueNode> value);
@ -57,6 +60,7 @@ public:
protected:
AttributeNode(const QString& name);
private:
int _ord;
bool _is_default;
QHash< QString, QSharedPointer<ValueNode> > _values;
};

23
plugins/core/editors/models/html_xsl_base/definition_balisenode.cpp

@ -29,6 +29,11 @@ namespace Core
namespace BaliseDefinition
{
template<class T> static bool nodeOrdLessThan(const QSharedPointer<T> & v1, const QSharedPointer<T> & v2)
{
return v1->ord() < v2->ord();
}
QSharedPointer<BaliseNode> BaliseNode::create(const QString & name, ContentView3::NodePtr parent)
{
QSharedPointer<BaliseNode> ptr(new BaliseNode(name));
@ -47,7 +52,7 @@ QSharedPointer<BaliseNode> BaliseNode::create(const QString & name, ContentView3
return ptr;
}
BaliseNode::BaliseNode(const QString& name): ContentView3::Node(name.trimmed())
BaliseNode::BaliseNode(const QString& name): ContentView3::Node(name.trimmed()), _ord(0)
{
setIcon(":/images/template.png");
setType(tr("Balise"));
@ -58,6 +63,16 @@ BaliseNode::~BaliseNode()
}
int BaliseNode::ord() const
{
return _ord;
}
void BaliseNode::setOrd(int value)
{
_ord = value;
}
bool BaliseNode::isDefault() const
{
return _is_default;
@ -80,6 +95,8 @@ QList< QSharedPointer<BaliseNode> > BaliseNode::defaultBalises() const
}
}
qSort(result.begin(), result.end(), nodeOrdLessThan<BaliseNode>);
return result;
}
@ -90,6 +107,7 @@ QList< QSharedPointer<BaliseNode> > BaliseNode::balises() const
void BaliseNode::addBalise(QSharedPointer<BaliseNode> node)
{
node->setOrd(_balises.size());
_balises.insert(node->name(), node);
addChild(node);
@ -112,6 +130,8 @@ QList< QSharedPointer<AttributeNode> > BaliseNode::defaultAttributes() const
}
}
qSort(result.begin(), result.end(), nodeOrdLessThan<AttributeNode>);
return result;
}
@ -122,6 +142,7 @@ QList< QSharedPointer<AttributeNode> > BaliseNode::attributes() const
void BaliseNode::addAttribute(QSharedPointer<AttributeNode> node)
{
node->setOrd(_attributes.size());
_attributes.insert(node->name(), node);
addChild(node);
}

4
plugins/core/editors/models/html_xsl_base/definition_balisenode.h

@ -48,6 +48,9 @@ public:
bool isDefault() const;
void setDefault(bool value);
int ord() const;
void setOrd(int value);
QList< QSharedPointer<BaliseNode> > defaultBalises() const;
QList< QSharedPointer<BaliseNode> > balises() const;
void addBalise(QSharedPointer<BaliseNode> node);
@ -64,6 +67,7 @@ protected:
private:
QWeakPointer<RootNode> _rootNode;
int _ord;
bool _is_default;
QHash<QString,QSharedPointer<AttributeNode> > _attributes;
QHash<QString,QSharedPointer<BaliseNode> > _balises;

Loading…
Cancel
Save