filters

kword13layout.cpp

00001 #include <qtextstream.h>
00002 
00003 #include "kword13utils.h"
00004 #include "kword13layout.h"
00005 
00006 KWord13Layout::KWord13Layout( void ) : m_outline( false )
00007 {
00008 }
00009 
00010 KWord13Layout::~KWord13Layout( void )
00011 {
00012 }
00013 
00014 void KWord13Layout::xmldump( QTextStream& iostream )
00015 {
00016     iostream << "    <layout name=\"" << EscapeXmlDump( m_name )
00017         << "\" outline=\"" << ( m_outline ? QString("true") : QString("false") ) << "\">\n";
00018     
00019     for ( QMap<QString,QString>::ConstIterator it = m_layoutProperties.begin();
00020         it != m_layoutProperties.end();
00021         ++it)
00022     {
00023         iostream << "     <param key=\"" << it.key() << "\" data=\"" << EscapeXmlDump( it.data() ) << "\"/>\n";
00024     }
00025     
00026     m_format.xmldump( iostream );
00027     
00028     iostream << "    </layout>\n";
00029 }
00030 
00031 QString KWord13Layout::key( void ) const
00032 {
00033     QString strKey;
00034     
00035     strKey += m_name;
00036     strKey += '@';
00037     
00038     // Use the number of properties as it is an easy sorting value
00039     strKey += QString::number( m_layoutProperties.count(), 16 );
00040     strKey += ':';
00041     
00042     if ( m_outline )
00043         strKey += "O1,";
00044     else
00045         strKey += "O0,";
00046     
00047     // use the worst key: the whole QMap (### FIXME)
00048     for ( QMap<QString,QString>::const_iterator it = m_layoutProperties.constBegin() ;
00049         it != m_layoutProperties.constEnd(); ++it )
00050     {
00051         strKey += it.key();
00052         strKey += '=';
00053         strKey += it.data();
00054         strKey += ';';
00055     }
00056     
00057     strKey += '@';
00058     // At the end, the key from the <FORMAT id="1">
00059     strKey += m_format.key();
00060     
00061     return strKey;
00062 }
00063 
00064 QString KWord13Layout::getProperty( const QString& name ) const
00065 {
00066     QMap<QString,QString>::ConstIterator it ( m_layoutProperties.find( name ) );
00067     if ( it == m_layoutProperties.end() )
00068     {
00069         // Property does not exist
00070         return QString::null;
00071     }
00072     else
00073     {
00074         return it.data();
00075     }
00076 }
00077 
KDE Home | KDE Accessibility Home | Description of Access Keys