summaryrefslogtreecommitdiffstats
path: root/filters/kword/kword1.3/import/kword13layout.cpp
blob: cc8a7046d026c7e9597f6ff6cbc90dc5f7ba684d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include <tqtextstream.h>

#include "kword13utils.h"
#include "kword13layout.h"

KWord13Layout::KWord13Layout( void ) : m_outline( false )
{
}

KWord13Layout::~KWord13Layout( void )
{
}

void KWord13Layout::xmldump( TQTextStream& iostream )
{
    iostream << "    <tqlayout name=\"" << EscapeXmlDump( m_name )
        << "\" outline=\"" << ( m_outline ? TQString("true") : TQString("false") ) << "\">\n";
    
    for ( TQMap<TQString,TQString>::ConstIterator it = m_layoutProperties.begin();
        it != m_layoutProperties.end();
        ++it)
    {
        iostream << "     <param key=\"" << it.key() << "\" data=\"" << EscapeXmlDump( it.data() ) << "\"/>\n";
    }
    
    m_format.xmldump( iostream );
    
    iostream << "    </tqlayout>\n";
}

TQString KWord13Layout::key( void ) const
{
    TQString strKey;
    
    strKey += m_name;
    strKey += '@';
    
    // Use the number of properties as it is an easy sorting value
    strKey += TQString::number( m_layoutProperties.count(), 16 );
    strKey += ':';
    
    if ( m_outline )
        strKey += "O1,";
    else
        strKey += "O0,";
    
    // use the worst key: the whole TQMap (### FIXME)
    for ( TQMap<TQString,TQString>::const_iterator it = m_layoutProperties.constBegin() ;
        it != m_layoutProperties.constEnd(); ++it )
    {
        strKey += it.key();
        strKey += '=';
        strKey += it.data();
        strKey += ';';
    }
    
    strKey += '@';
    // At the end, the key from the <FORMAT id="1">
    strKey += m_format.key();
    
    return strKey;
}

TQString KWord13Layout::getProperty( const TQString& name ) const
{
    TQMap<TQString,TQString>::ConstIterator it ( m_layoutProperties.find( name ) );
    if ( it == m_layoutProperties.end() )
    {
        // Property does not exist
        return TQString();
    }
    else
    {
        return it.data();
    }
}