~ubuntu-branches/ubuntu/edgy/libwpd/edgy-security

« back to all changes in this revision

Viewing changes to src/lib/WPXPageSpan.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Masayuki Hatta (mhatta)
  • Date: 2004-08-10 00:37:47 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20040810003747-5i7g92h2v88z70zo
Tags: 0.7.2-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
}
55
55
 
56
56
WPXHeaderFooter::WPXHeaderFooter(const WPXHeaderFooterType headerFooterType, const WPXHeaderFooterOccurence occurence, 
57
 
                                 const guint8 internalType, const guint16 textPID) :
 
57
                                 const guint8 internalType, const guint16 textPID, WPXTableList *tableList) :
58
58
        m_internalType(internalType),
59
 
        m_textPID(textPID)
60
 
{
61
 
        m_type = headerFooterType;
62
 
        m_occurence = occurence;
63
 
 
 
59
        m_textPID(textPID),
 
60
        m_type(headerFooterType),
 
61
        m_occurence(occurence),
 
62
        m_tableList(tableList)
 
63
{
 
64
}
 
65
 
 
66
WPXHeaderFooter::WPXHeaderFooter(const WPXHeaderFooter &headerFooter) :
 
67
        m_type(headerFooter.getType()),
 
68
        m_occurence(headerFooter.getOccurence()),
 
69
        m_internalType(headerFooter.getInternalType()),
 
70
        m_textPID(headerFooter.getTextPID())
 
71
{
 
72
        WPXTableList *tableList = headerFooter.getTableList();
 
73
        if (tableList)
 
74
        {
 
75
                m_tableList = tableList;
 
76
                m_tableList->addRef();
 
77
        }
 
78
        else
 
79
                m_tableList = NULL;
 
80
}
 
81
 
 
82
WPXHeaderFooter::~WPXHeaderFooter()
 
83
{
64
84
}
65
85
 
66
86
WPXPageSpan::WPXPageSpan() :
89
109
                m_isHeaderFooterSuppressed[i] = false;
90
110
}
91
111
 
 
112
WPXPageSpan::~WPXPageSpan()
 
113
{
 
114
        // we unref the table lists here (instead of in WPXHeaderFooter) because the items in the vector 
 
115
        // are randomly alloc'd and dealloc'd
 
116
        for (vector<WPXHeaderFooter>::iterator iter = m_headerFooterList.begin(); iter != m_headerFooterList.end(); iter++)
 
117
        {
 
118
                if ((*iter).getTableList())
 
119
                        (*iter).getTableList()->unRef();
 
120
        }
 
121
}
92
122
 
93
 
void WPXPageSpan::setHeaderFooter(const guint8 headerFooterType, const guint8 occurenceBits, const guint16 textPID)
 
123
void WPXPageSpan::setHeaderFooter(const guint8 headerFooterType, const guint8 occurenceBits, 
 
124
                                  const guint16 textPID, WPXTableList *tableList)
94
125
{
95
126
        WPXHeaderFooterType wpxType = _convertHeaderFooterType(headerFooterType);
96
127
        WPXHeaderFooterOccurence wpxOccurence = _convertHeaderFooterOccurence(occurenceBits);
97
 
        WPXHeaderFooter headerFooter(wpxType, wpxOccurence, headerFooterType, textPID);
 
128
        WPXHeaderFooter headerFooter(wpxType, wpxOccurence, headerFooterType, textPID, tableList);
98
129
        switch (wpxOccurence) 
99
130
        {
100
131
        case ALL:
116
147
        if (containsHFLeft && !containsHFRight)
117
148
        {
118
149
                WPD_DEBUG_MSG(("Inserting dummy header right\n"));
119
 
                WPXHeaderFooter dummyHeader(wpxType, EVEN, DUMMY_INTERNAL_HEADER_FOOTER, 0);
 
150
                WPXHeaderFooter dummyHeader(wpxType, EVEN, DUMMY_INTERNAL_HEADER_FOOTER, 0, NULL);
120
151
                m_headerFooterList.push_back(dummyHeader);
121
152
        }
122
153
        else if (!containsHFLeft && containsHFRight)
123
154
        {
124
155
                WPD_DEBUG_MSG(("Inserting dummy header left\n"));
125
 
                WPXHeaderFooter dummyHeader(wpxType, ODD, DUMMY_INTERNAL_HEADER_FOOTER, 0);
 
156
                WPXHeaderFooter dummyHeader(wpxType, ODD, DUMMY_INTERNAL_HEADER_FOOTER, 0, NULL);
126
157
                m_headerFooterList.push_back(dummyHeader);
127
158
        }
128
159
}