filters

kword13layout.cpp
1#include <tqtextstream.h>
2
3#include "kword13utils.h"
4#include "kword13layout.h"
5
6KWord13Layout::KWord13Layout( void ) : m_outline( false )
7{
8}
9
10KWord13Layout::~KWord13Layout( void )
11{
12}
13
14void KWord13Layout::xmldump( TQTextStream& iostream )
15{
16 iostream << " <layout name=\"" << EscapeXmlDump( m_name )
17 << "\" outline=\"" << ( m_outline ? TQString("true") : TQString("false") ) << "\">\n";
18
19 for ( TQMap<TQString,TQString>::ConstIterator it = m_layoutProperties.begin();
20 it != m_layoutProperties.end();
21 ++it)
22 {
23 iostream << " <param key=\"" << it.key() << "\" data=\"" << EscapeXmlDump( it.data() ) << "\"/>\n";
24 }
25
26 m_format.xmldump( iostream );
27
28 iostream << " </layout>\n";
29}
30
31TQString KWord13Layout::key( void ) const
32{
33 TQString strKey;
34
35 strKey += m_name;
36 strKey += '@';
37
38 // Use the number of properties as it is an easy sorting value
39 strKey += TQString::number( m_layoutProperties.count(), 16 );
40 strKey += ':';
41
42 if ( m_outline )
43 strKey += "O1,";
44 else
45 strKey += "O0,";
46
47 // use the worst key: the whole TQMap (### FIXME)
48 for ( TQMap<TQString,TQString>::const_iterator it = m_layoutProperties.constBegin() ;
49 it != m_layoutProperties.constEnd(); ++it )
50 {
51 strKey += it.key();
52 strKey += '=';
53 strKey += it.data();
54 strKey += ';';
55 }
56
57 strKey += '@';
58 // At the end, the key from the <FORMAT id="1">
59 strKey += m_format.key();
60
61 return strKey;
62}
63
64TQString KWord13Layout::getProperty( const TQString& name ) const
65{
66 TQMap<TQString,TQString>::ConstIterator it ( m_layoutProperties.find( name ) );
67 if ( it == m_layoutProperties.end() )
68 {
69 // Property does not exist
70 return TQString();
71 }
72 else
73 {
74 return it.data();
75 }
76}
77
TQString key(void) const
Get a key representating the properties.
TQString m_name
Name of the style (either the used one or the one currently being defined).
KWord13FormatOneData m_format
Character format properties.