bool OleStreamParser::getUcs2Char(OleMainStream &stream, ZLUnicodeUtil::Ucs2Char &ucs2char) { while (myCurBufferPosition >= myBuffer.size()) { myBuffer.clear(); myCurBufferPosition = 0; if (!readNextPiece(stream)) { return false; } } ucs2char = myBuffer.at(myCurBufferPosition++); processStyles(stream); switch (ucs2char) { case INLINE_IMAGE: processInlineImage(stream); break; case FLOAT_IMAGE: processFloatImage(stream); break; } ++myCurCharPos; return true; }
//TODO: provide all streams to the wv2 parser; POLE storage is going to replace //OLE storage soon! Document::Document(const std::string& fileName, MSWordOdfImport* filter, // KoFilterChain* chain, KoXmlWriter* bodyWriter, KoXmlWriter* metaWriter, KoXmlWriter* manifestWriter, KoStore* store, KoGenStyles* mainStyles, LEInputStream& wordDocument, POLE::Stream& table, LEInputStream *data, LEInputStream *si) : m_textHandler(0) , m_tableHandler(0) , m_replacementHandler(new WordsReplacementHandler) , m_graphicsHandler(0) , m_filter(filter) // , m_chain(chain) , m_parser(wvWare::ParserFactory::createParser(fileName)) , m_bodyFound(false) , m_footNoteNumber(0) , m_endNoteNumber(0) , m_bodyWriter(0) , m_mainStyles(0) , m_metaWriter(0) , m_headerWriter(0) , m_headerCount(0) , m_writingHeader(false) , m_evenOpen(false) , m_firstOpen(false) , m_buffer(0) , m_bufferEven(0) , m_writeMasterPageName(false) , m_omittMasterPage(false) , m_useLastMasterPage(false) , m_wdstm(wordDocument) , m_tblstm(0) , m_datastm(data) , m_sistm(si) , m_tblstm_pole(table) { kDebug(30513); addBgColor("#ffffff"); //initialize the background-colors stack if (m_parser) { // 0 in case of major error (e.g. unsupported format) m_bodyWriter = bodyWriter; //pointer for writing to the body m_mainStyles = mainStyles; //KoGenStyles object for collecting styles m_metaWriter = metaWriter; //pointer for writing to meta.xml m_buffer = 0; //set pointers to 0 m_bufferEven = 0; m_headerWriter = 0; m_textHandler = new WordsTextHandler(m_parser, bodyWriter, mainStyles); m_textHandler->setDocument(this); m_tableHandler = new WordsTableHandler(bodyWriter, mainStyles); m_tableHandler->setDocument(this); m_graphicsHandler = new WordsGraphicsHandler(this, bodyWriter, manifestWriter, store, mainStyles, m_parser->getDrawings(), m_parser->fib()); connect(m_textHandler, SIGNAL(subDocFound(const wvWare::FunctorBase*, int)), this, SLOT(slotSubDocFound(const wvWare::FunctorBase*, int))); connect(m_textHandler, SIGNAL(footnoteFound(const wvWare::FunctorBase*, int)), this, SLOT(slotFootnoteFound(const wvWare::FunctorBase*, int))); connect(m_textHandler, SIGNAL(annotationFound(const wvWare::FunctorBase*,int)), this, SLOT(slotAnnotationFound(const wvWare::FunctorBase*, int))); connect(m_textHandler, SIGNAL(headersFound(const wvWare::FunctorBase*, int)), this, SLOT(slotHeadersFound(const wvWare::FunctorBase*, int))); connect(m_textHandler, SIGNAL(tableFound(Words::Table*)), this, SLOT(slotTableFound(Words::Table*))); connect(m_textHandler, SIGNAL(inlineObjectFound(const wvWare::PictureData&, KoXmlWriter*)), this, SLOT(slotInlineObjectFound(const wvWare::PictureData&, KoXmlWriter*))); connect(m_textHandler, SIGNAL(floatingObjectFound(unsigned int, KoXmlWriter*)), this, SLOT(slotFloatingObjectFound(unsigned int, KoXmlWriter*))); connect(m_graphicsHandler, SIGNAL(textBoxFound(unsigned int, bool)), this, SLOT(slotTextBoxFound(unsigned int, bool))); m_parser->setSubDocumentHandler(this); m_parser->setTextHandler(m_textHandler); m_parser->setTableHandler(m_tableHandler); m_parser->setGraphicsHandler(m_graphicsHandler); m_parser->setInlineReplacementHandler(m_replacementHandler); processStyles(); processAssociatedStrings(); // connect( m_tableHandler, // SIGNAL( sigTableCellStart( int, int, int, int, const QRectF&, const QString&, // const wvWare::Word97::BRC&, const wvWare::Word97::BRC&, const wvWare::Word97::BRC&, // const wvWare::Word97::BRC&, const wvWare::Word97::SHD& ) ), // this, // SLOT( slotTableCellStart( int, int, int, int, const QRectF&, const QString&, // const wvWare::Word97::BRC&, const wvWare::Word97::BRC&, const wvWare::Word97::BRC&, // const wvWare::Word97::BRC&, const wvWare::Word97::SHD& ) ) ); // connect( m_tableHandler, SIGNAL( sigTableCellEnd() ), this, SLOT( slotTableCellEnd() ) ); } }