diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-01-20 01:29:50 +0000 |
commit | 8362bf63dea22bbf6736609b0f49c152f975eb63 (patch) | |
tree | 0eea3928e39e50fae91d4e68b21b1e6cbae25604 /lib/kformula/actionelement.cc | |
download | koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.tar.gz koffice-8362bf63dea22bbf6736609b0f49c152f975eb63.zip |
Added old abandoned KDE3 version of koffice
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1077364 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'lib/kformula/actionelement.cc')
-rw-r--r-- | lib/kformula/actionelement.cc | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/lib/kformula/actionelement.cc b/lib/kformula/actionelement.cc new file mode 100644 index 00000000..fdee73a5 --- /dev/null +++ b/lib/kformula/actionelement.cc @@ -0,0 +1,77 @@ +/* This file is part of the KDE project + Copyright (C) 2006 Alfredo Beaumont Sainz <alfredo.beaumont@gmail.com> + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "creationstrategy.h" +#include "actionelement.h" + +KFORMULA_NAMESPACE_BEGIN + +ActionElement::ActionElement( BasicElement* parent ) : SequenceElement( parent ), + m_selection( 0 ) +{ +} + +bool ActionElement::readAttributesFromMathMLDom(const QDomElement& element) +{ + if ( ! BasicElement::readAttributesFromMathMLDom( element ) ) { + return false; + } + + m_actionType = element.attribute( "actiontype" ); + QString selectionStr = element.attribute( "selection" ); + if ( ! selectionStr.isNull() ) { + bool ok; + m_selection = selectionStr.toUInt( &ok ); + if ( ! ok ) m_selection = 0; + } + + return true; +} + +int ActionElement::buildChildrenFromMathMLDom(QPtrList<BasicElement>& list, QDomNode n) +{ + if ( ! n.isElement() ) + return -1; + QDomElement e = n.toElement(); + QString tag = e.tagName().lower(); + BasicElement* child = getCreationStrategy()->createElement( tag, e ); + if ( child == 0 ) + return -1; + child->setParent( this ); + if ( child->buildFromMathMLDom( e ) == -1 ) { + delete child; + return -1; + } + list.append( child ); + parse(); + return 1; +} + +void ActionElement::writeMathMLAttributes( QDomElement& element ) const +{ + if ( ! m_actionType.isNull() ) { + element.setAttribute( "actiontype", m_actionType ); + } + if ( m_selection ) { + element.setAttribute( "selection", QString( "%1" ).arg( m_selection ) ); + } +} + + +KFORMULA_NAMESPACE_END |