lib
stringelement.cc00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "textelement.h"
00021 #include "stringelement.h"
00022
00023 KFORMULA_NAMESPACE_BEGIN
00024
00025 StringElement::StringElement( BasicElement* parent ) : TokenElement( parent )
00026 {
00027 }
00028
00029 bool StringElement::readAttributesFromMathMLDom(const QDomElement& element)
00030 {
00031 if ( ! BasicElement::readAttributesFromMathMLDom( element ) ) {
00032 return false;
00033 }
00034
00035 if ( ! inherited::readAttributesFromMathMLDom( element ) ) {
00036 return false;
00037 }
00038
00039 m_lquote = element.attribute( "lquote" );
00040 if ( ! m_lquote.isNull() ) {
00041 m_customLquote = true;
00042 }
00043 m_rquote = element.attribute( "rquote" );
00044 if ( ! m_rquote.isNull() ) {
00045 m_customRquote = true;
00046 }
00047
00048 return true;
00049 }
00050
00051 int StringElement::buildChildrenFromMathMLDom(QPtrList<BasicElement>& list, QDomNode n)
00052 {
00053 int count = inherited::buildChildrenFromMathMLDom( list, n );
00054 if ( count == -1 )
00055 return -1;
00056 TextElement* child = new TextElement( '"' );
00057 child->setParent( this );
00058 child->setCharFamily( charFamily() );
00059 child->setCharStyle( charStyle() );
00060 insert( 0, child );
00061 child = new TextElement( '"' );
00062 child->setParent( this );
00063 child->setCharFamily( charFamily() );
00064 child->setCharStyle( charStyle() );
00065 insert( countChildren(), child );
00066 return count;
00067 }
00068
00069 void StringElement::writeMathMLAttributes( QDomElement& element ) const
00070 {
00071 inherited::writeMathMLAttributes( element );
00072 if ( m_customLquote ) {
00073 element.setAttribute( "lquote", m_lquote );
00074 }
00075 if ( m_customRquote ) {
00076 element.setAttribute( "rquote", m_rquote );
00077 }
00078 }
00079
00080 void StringElement::writeMathMLContent( QDomDocument& doc, QDomElement& element, bool oasisFormat ) const
00081 {
00082 for ( uint i = 1; i < countChildren() - 1; ++i ) {
00083 const BasicElement* e = getChild( i );
00084 e->writeMathML( doc, element, oasisFormat );
00085 }
00086 }
00087
00088 KFORMULA_NAMESPACE_END
|