~ubuntu-branches/ubuntu/precise/koffice/precise

« back to all changes in this revision

Viewing changes to filters/kword/msword-odf/document.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#ifndef DOCUMENT_H
25
25
#define DOCUMENT_H
26
26
 
 
27
#include "generated/leinputstream.h"
 
28
#include "pole.h"
27
29
#include "tablehandler.h"
28
30
 
 
31
 
29
32
#include <wv2/src/handlers.h>
30
33
#include <wv2/src/functor.h>
 
34
#include <wv2/src/functordata.h>
31
35
 
32
36
#include <QString>
33
37
#include <qdom.h>
58
62
class KWordTableHandler;
59
63
class KWordPictureHandler;
60
64
class KWordTextHandler;
61
 
class KWordDrawingHandler;
 
65
class KWordGraphicsHandler;
62
66
 
63
67
class Document : public QObject, public wvWare::SubDocumentHandler
64
68
{
65
69
    Q_OBJECT
66
70
public:
67
71
    Document(const std::string& fileName, KoFilterChain* chain, KoXmlWriter* bodyWriter,
68
 
             KoGenStyles* mainStyles, KoXmlWriter* metaWriter, KoStore* store, KoXmlWriter* manifestWriter);
 
72
             KoGenStyles* mainStyles, KoXmlWriter* metaWriter, KoXmlWriter* manifestWriter,
 
73
             KoStore* store, POLE::Storage* storage,
 
74
             LEInputStream* data, LEInputStream* table, LEInputStream* wdoc);
69
75
    virtual ~Document();
70
76
 
71
 
    KWordTextHandler *textHandler() const {
72
 
        return m_textHandler;
73
 
    }
74
 
 
75
 
    bool hasParser() const {
76
 
        return m_parser != 0L;
77
 
    }
78
 
    bool bodyFound() const {
79
 
        return m_bodyFound;
80
 
    }
81
 
 
82
77
    virtual void bodyStart();
83
78
    virtual void bodyEnd();
84
79
 
85
80
    virtual void headerStart(wvWare::HeaderData::Type type);
86
81
    virtual void headerEnd();
 
82
    virtual void headersMask(QList<bool> mask);
87
83
 
88
84
    virtual void footnoteStart();
89
85
    virtual void footnoteEnd();
108
104
        QString extraName;
109
105
    };
110
106
 
111
 
    // Provide access to those attributes for texthandler.cpp and tablehandler.cpp
 
107
    // Provide access to private attributes for our handlers
112
108
    QString masterPageName(void) const { return m_masterPageName_list.first(); }
113
109
    void set_writeMasterPageName(bool val) { m_writeMasterPageName = val; }
114
110
    bool writeMasterPageName(void) const { return m_writeMasterPageName; }
 
111
    bool omittMasterPage(void) const { return m_omittMasterPage; }
115
112
    bool writingHeader(void) const { return m_writingHeader; }
116
113
    KoXmlWriter* headerWriter(void) const { return m_headerWriter; }
117
 
 
 
114
    KWordTextHandler *textHandler(void) const { return m_textHandler; }
 
115
    bool hasParser(void) const { return m_parser != 0L; }
 
116
    bool bodyFound(void) const { return m_bodyFound; }
 
117
 
 
118
    /**
 
119
     * Add element val to the backgroud-color stack.
 
120
     */
 
121
    void addBgColor(const QString val) { m_bgColors.push(val); }
 
122
 
 
123
    /**
 
124
     * Remove the last item from the backgroud-color stack.
 
125
     */
 
126
    void rmBgColor(void) { m_bgColors.pop(); }
 
127
 
 
128
    /**
 
129
     * Update the last item of the background-color stack.
 
130
     */
 
131
    void updateBgColor(const QString val) { m_bgColors.pop(); m_bgColors.push(val); }
 
132
 
 
133
    /**
 
134
     * @return the current background-color.
 
135
     */
 
136
    QString currentBgColor(void) { return m_bgColors.top(); }
 
137
 
 
138
    /**
 
139
     * Checks if the header/footer content of the current section differs from
 
140
     * the previous section's header/footer.  @return TRUE - different content;
 
141
     * FALSE - no difference or the Header document doesn't exist.
 
142
     */
 
143
    bool headersChanged(void) const;
 
144
 
 
145
    POLE::Storage* storage(void) const { return m_storage; }
 
146
    LEInputStream* data_stream(void) const { return m_data_stream; }
 
147
    LEInputStream* table_stream(void) const { return m_table_stream; }
 
148
    LEInputStream* wdocument_stream(void) const { return m_wdocument_stream; }
 
149
 
 
150
    // get the style name used for line numbers
 
151
    QString lineNumbersStyleName() const { return m_lineNumbersStyleName; }
118
152
public slots:
119
153
    // Connected to the KWordTextHandler only when parsing the body
120
154
    void slotSectionFound(wvWare::SharedPtr<const wvWare::Word97::SEP>);
133
167
 
134
168
    void slotTableFound(KWord::Table* table);
135
169
 
136
 
    // Write out the frameset and add the key to the PICTURES tag
137
 
    void slotPictureFound(const QString& frameName, const QString& pictureName, KoXmlWriter* writer,
138
 
                          const wvWare::FunctorBase*);
139
 
 
140
 
    void slotDrawingFound(unsigned int globalCP, KoXmlWriter* writer);
141
 
 
142
 
    void slotTextBoxFound(uint lid, KoXmlWriter* writer);
 
170
    void slotInlineObjectFound(const wvWare::PictureData& data, KoXmlWriter* writer);
 
171
 
 
172
    void slotFloatingObjectFound(unsigned int globalCP, KoXmlWriter* writer);
 
173
 
 
174
    void slotTextBoxFound(uint lid, bool bodyDrawing);
143
175
 
144
176
    // Similar to footnoteStart/footnoteEnd but for cells.
145
177
    // This is connected to KWordTableHandler
158
190
    KWordTextHandler*        m_textHandler;
159
191
    KWordTableHandler*       m_tableHandler;
160
192
    KWordReplacementHandler* m_replacementHandler;
161
 
    KWordPictureHandler*     m_pictureHandler;
162
 
    KWordDrawingHandler*     m_drawingHandler;
 
193
    KWordGraphicsHandler*    m_graphicsHandler;
163
194
 
164
195
    KoFilterChain* m_chain;
165
196
    wvWare::SharedPtr<wvWare::Parser> m_parser;
166
197
    std::queue<SubDocument> m_subdocQueue;
167
198
    std::queue<KWord::Table> m_tableQueue;
168
 
    QStringList m_pictureList; // for <PICTURES>
169
199
 
170
200
    bool m_bodyFound;
171
201
 
178
208
    KoXmlWriter* m_metaWriter;      //for writing to meta.xml
179
209
    KoXmlWriter* m_headerWriter;    //for header/footer writing in styles.xml
180
210
 
181
 
    //    unsigned char m_headerFooters; // a mask of HeaderData::Type bits
182
211
    int m_headerCount; //to have a unique name for element we're putting into an masterPageStyle
183
212
    bool m_writingHeader; //flag for headers/footers, where we write the actual text to styles.xml
184
213
    bool m_evenOpen;  //processing an even header/footer
185
214
    bool m_firstOpen; //processing a first page header/footer
186
215
    QBuffer* m_buffer; //for odd and first page header/footer tags
187
216
    QBuffer* m_bufferEven; //for even header/footer tags
 
217
 
 
218
    QList<KoGenStyle*> m_masterPageStyle_list; //master-page styles
 
219
    QList<KoGenStyle*> m_pageLayoutStyle_list; //page-layout styles
 
220
    QStringList m_masterPageName_list; //master-page names
 
221
 
 
222
    QList<bool> m_headersMask; //mask informing of section's empty/nonempty header/footer stories
188
223
    QList<bool> m_hasHeader_list; //does master-page/page-layout require a header element
189
224
    QList<bool> m_hasFooter_list; //does master-page/page-layout require a footer element
190
225
 
191
 
    QStringList m_masterPageName_list; //master-page names
192
 
    QStringList m_pageLayoutName_list; //page-layout names
193
226
    bool m_writeMasterPageName; //whether to write the master-page name into a paragraph/table
 
227
    bool m_omittMasterPage; //whether master-page style for current section has been omitted
194
228
 
195
229
    int m_initialFootnoteNumber;
196
230
    int m_initialEndnoteNumber;
 
231
 
 
232
    QString m_lineNumbersStyleName;
 
233
 
 
234
    //pointers to the POLE store content
 
235
    LEInputStream* m_data_stream;
 
236
    LEInputStream* m_table_stream;
 
237
    LEInputStream* m_wdocument_stream;
 
238
    POLE::Storage* m_storage; // pointer to the pole storage
 
239
 
 
240
    //A stack for backgroud-colors, which represets a background color context
 
241
    //for automatic colors.
 
242
    QStack<QString> m_bgColors;
197
243
};
198
244
 
199
245
#endif // DOCUMENT_H