├── VERSION_WV2 ├── README.md ├── tests ├── iconvtest.cpp ├── testole.doc ├── test.h ├── parsertest.cpp ├── sharedptrtest.cpp ├── parsertest_mem.cpp └── ustringtest.cpp ├── Sandcastle ├── testole.doc ├── Sandcastle.pro └── main.cpp ├── doc ├── msole_file_format.html └── The_Storage_of_Macros_and_OLE_Objects.pdf ├── config.h ├── AUTHORS ├── src ├── wv2_export.h ├── crc32.h ├── wvlog.cpp ├── functor.cpp ├── dllmagic.h ├── word95_helper.h ├── utilities.h ├── utilities.cpp ├── parser95.h ├── parser97.h ├── functordata.cpp ├── wv2version.cpp ├── parser97.cpp ├── parserfactory.h ├── parser95.cpp ├── generator │ ├── spec_defects │ ├── template-Word95.h │ ├── template-Word95.cpp │ ├── template-conv.h │ ├── _no_CMakeLists.txt │ ├── template-conv.cpp │ └── template-Word97.cpp ├── word97_helper.h ├── headers97.h ├── global.cpp ├── headers95.h ├── headers97.cpp ├── paragraphproperties.cpp ├── olestorage.cpp ├── fonts.h ├── headers95.cpp ├── functor.h ├── headers.h ├── wv2version.h ├── paragraphproperties.h ├── associatedstrings.cpp ├── annotations.h ├── convert.h ├── fields.h ├── associatedstrings.h ├── footnotes97.h ├── parser.cpp ├── SPRMS ├── textconverter.h ├── fonts.cpp ├── olestorage.h ├── properties97.h ├── functordata.h ├── bookmark.h ├── global.h ├── sharedptr.h ├── pole.h ├── zcodec.hxx ├── annotations.cpp ├── olestream.cpp ├── wvlog.h ├── parserfactory.cpp └── olestream.h ├── README.txt ├── CmdDebug.h ├── README_QT5 ├── Sandcastle5 └── fox_office │ ├── docfox.h │ ├── fox_office.pri │ ├── foxpdf_handler.h │ ├── foxdocx_handler.h │ ├── foxodt_handler.h │ └── foxdoc_handler.h ├── fox_xmlsession.cpp ├── wv5qt.pro └── wv2qt.pro /VERSION_WV2: -------------------------------------------------------------------------------- 1 | 0.4.2 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | wv2qt 2 | ===== 3 | 4 | Read Microsoft Word Document not xml based 5 | -------------------------------------------------------------------------------- /tests/iconvtest.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pehohlva/wv2qt/HEAD/tests/iconvtest.cpp -------------------------------------------------------------------------------- /tests/testole.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pehohlva/wv2qt/HEAD/tests/testole.doc -------------------------------------------------------------------------------- /Sandcastle/testole.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pehohlva/wv2qt/HEAD/Sandcastle/testole.doc -------------------------------------------------------------------------------- /doc/msole_file_format.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pehohlva/wv2qt/HEAD/doc/msole_file_format.html -------------------------------------------------------------------------------- /doc/The_Storage_of_Macros_and_OLE_Objects.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pehohlva/wv2qt/HEAD/doc/The_Storage_of_Macros_and_OLE_Objects.pdf -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | /* 2 | config to all this file 3 | + image handling by qt5 4 | */ 5 | 6 | #ifndef WINPORT_H 7 | #define WINPORT_H 8 | 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | #endif /* WINPORT_H */ 18 | 19 | 20 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Shaheed Haque 2 | Werner Trobin 3 | David Faure 4 | Benjamin Cail 5 | Peter Hohl (qt5 adapter) 6 | 7 | This repository includes open-source libraries used by Onyx 8 | International and some of Onyx International's own applications. 9 | 10 | Please check http://github.com/onyx-intl for other opensource packages 11 | released by Onyx International. 12 | -------------------------------------------------------------------------------- /src/wv2_export.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef WV2_EXPORT_H 3 | #define WV2_EXPORT_H 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | #include 18 | #include 19 | #include 20 | 21 | #ifdef ESCHER_DOCSTREAM 22 | # define WV2_EXPORT Q_DECL_EXPORT 23 | #else 24 | # define WV2_EXPORT Q_DECL_IMPORT 25 | #endif 26 | 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /README.txt: -------------------------------------------------------------------------------- 1 | This library depends on libgsf >= 1.7.2, but it doesn't need the GNOME part 2 | of it, so it's probably a good idea to configure libgsf with the 3 | --without-gnome option (then you don't have to install bonobo et al.) 4 | For newer libgsf versions this is detected automatically, so you don't have 5 | to specify that anymore. 6 | 7 | You can download libgsf at: ftp://ftp.gnome.org/pub/GNOME/sources/libgsf 8 | 9 | libgsf depends on glib2 (www.gtk.org) and libxml2 (www.xmlsoft.org), in case 10 | you use the --without-gnome option. 11 | 12 | Additionally you need pkg-config (www.freedesktop.org/software/pkgconfig/) 13 | 14 | In case you want to package wv2, please use the --disable-debug flag to get 15 | rid of the debug output. 16 | -------------------------------------------------------------------------------- /Sandcastle/Sandcastle.pro: -------------------------------------------------------------------------------- 1 | TEMPLATE = app 2 | TARGET = xx 3 | # release 4 | DESTDIR = ./ 5 | 6 | CONFIG += qt warn_off silent debug 7 | QT += core xml network 8 | CONFIG += qt warn_off silent release 9 | 10 | CONFIG -= app_bundle 11 | 12 | cache() 13 | QT += core 14 | ## not need 15 | ## LANGUAGE = C 16 | ## /opt/icon/include/wv2qt 17 | INCLUDEPATH += /opt/icon/include 18 | DEPENDPATH += /opt/icon/include 19 | ## netbean 7.1 follow header 20 | ## cp -r /opt/icon/include/wv2qt ./ 21 | 22 | LIBS += -lz 23 | LIBS += -L/opt/icon/lib -liconv -I/opt/icon/include 24 | LIBS += -L/opt/icon/lib -lwv2qt -I/opt/icon/include 25 | 26 | HEADERS += document_doc_handler.h 27 | SOURCES += main.cpp document_doc_handler.cpp 28 | -------------------------------------------------------------------------------- /src/crc32.h: -------------------------------------------------------------------------------- 1 | /* crc32.h 2 | 3 | header file for crc32 checksum 4 | */ 5 | 6 | #define CRC32_XINIT 0xFFFFFFFFL /* initial value */ 7 | #define CRC32_XOROT 0xFFFFFFFFL /* final xor value */ 8 | 9 | #define MINIMUM_CHECKSUM_LEN 8 10 | #define MAXIMUM_CHECKSUM_LEN 99 11 | 12 | /* NAACCR 6.0 Specifications */ 13 | #define NAACCR_60_CHECKSUM_POS 942 14 | #define NAACCR_60_CHECKSUM_LEN 10 15 | 16 | /* function prototypes */ 17 | 18 | #ifdef __cplusplus 19 | extern "C" 20 | { 21 | #endif 22 | 23 | unsigned long CalcCRC32(unsigned char *, unsigned long, unsigned long, unsigned long); 24 | int AssignCRC32(unsigned char *, unsigned long, unsigned long, unsigned long); 25 | int CompareCRC32(unsigned char *, unsigned long, unsigned long, unsigned long); 26 | 27 | #ifdef __cplusplus 28 | } 29 | #endif 30 | -------------------------------------------------------------------------------- /src/wvlog.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "wvlog.h" 20 | 21 | namespace wvWare 22 | { 23 | const wvlogstream wvlog = wvlog; 24 | } // wvWare 25 | 26 | 27 | -------------------------------------------------------------------------------- /src/functor.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "functor.h" 20 | 21 | using namespace wvWare; 22 | 23 | FunctorBase::~FunctorBase() 24 | { 25 | } 26 | 27 | void FunctorBase::operator()() const 28 | { 29 | } 30 | 31 | -------------------------------------------------------------------------------- /src/dllmagic.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef DLLMAGIC_H 20 | #define DLLMAGIC_H 21 | 22 | #ifdef WV2_DLL 23 | # define WV2_DLLEXPORT __declspec(dllexport) 24 | #else 25 | # define WV2_DLLEXPORT 26 | #endif 27 | 28 | #endif // DLLMAGIC_H 29 | -------------------------------------------------------------------------------- /Sandcastle/main.cpp: -------------------------------------------------------------------------------- 1 | #include "document_doc_handler.h" 2 | /// grep -R "ParserFactory::createParser" * 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | /* 10 | void msgHandler(QtMsgType type, const char* msg) { 11 | const char symbols[] = {'I', 'E', '!', 'X'}; 12 | QString output = QString("[%1] %2").arg(symbols[type]).arg(msg); 13 | std::cerr << output.toStdString() << std::endl; 14 | if (type == QtFatalMsg) abort(); 15 | } 16 | */ 17 | int main(int argc, char *argv[]) { 18 | 19 | //// qInstallMsgHandler(msgHandler); 20 | QCoreApplication a(argc, argv); 21 | QTextStream out(stdout); 22 | QString str("x"); 23 | out << str.fill('*',100) << "\n"; 24 | const QString qtfileword = QString("testole.doc"); 25 | DocModelRead *doc = new DocModelRead("utf-8"); 26 | doc->readDocument(qtfileword); 27 | const QString xml_LONG = ReaderSession::self()->doc().toString(5); 28 | ReaderSession::self()->nextOle(); 29 | out << xml_LONG << "\n"; 30 | out << str.fill('*',100) << "\n"; 31 | out.flush(); 32 | QTimer::singleShot(4000, &a, SLOT(quit())); 33 | return a.exec(); 34 | } 35 | -------------------------------------------------------------------------------- /src/word95_helper.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001 S.R.Haque 3 | Copyright (C) 2003 Werner Trobin 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License version 2 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #ifndef WORD95_HELPER_H 21 | #define WORD95_HELPER_H 22 | 23 | #include "global.h" 24 | #include "wv2_export.h" 25 | 26 | 27 | namespace wvWare 28 | { 29 | namespace Word95 30 | { 31 | namespace SPRM 32 | { 33 | 34 | U16 determineParameterLength( U8 sprm, const U8* in ); 35 | 36 | } // namespace SPRM 37 | } // namespace Word95 38 | } // namespace wvWare 39 | 40 | #endif // WORD95_HELPER_H 41 | -------------------------------------------------------------------------------- /src/utilities.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef UTILITIES_H 20 | #define UTILITIES_H 21 | 22 | #include 23 | #include // std::unary_function is in this header with gcc 2.9x 24 | #include 25 | #include "wv2_export.h" 26 | 27 | namespace wvWare 28 | { 29 | template struct Delete : public std::unary_function 30 | { 31 | void operator() (T* t) const { delete t; } 32 | }; 33 | 34 | std::string int2string( int i ); 35 | std::string uint2string( unsigned int i ); 36 | } 37 | 38 | #endif // UTILITIES_H 39 | -------------------------------------------------------------------------------- /src/utilities.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the Library GNU General Public 6 | version 2 of the License, or (at your option) version 3 or, 7 | at the discretion of KDE e.V (which shall act as a proxy as in 8 | section 14 of the GPLv3), any later version.. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public License 16 | along with this library; see the file COPYING.LIB. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 | Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #include "utilities.h" 22 | #include 23 | 24 | namespace wvWare 25 | { 26 | 27 | std::string int2string( int i ) 28 | { 29 | char buf[ 40 ]; 30 | snprintf( buf, 40, "%d", i ); 31 | return std::string( buf ); 32 | } 33 | 34 | std::string uint2string( unsigned int i ) 35 | { 36 | char buf[ 40 ]; 37 | snprintf( buf, 40, "%u", i ); 38 | return std::string( buf ); 39 | } 40 | } // namespace wvWare 41 | -------------------------------------------------------------------------------- /src/parser95.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef PARSER95_H 20 | #define PARSER95_H 21 | 22 | #include "parser9x.h" 23 | #include "wv2_export.h" 24 | 25 | namespace wvWare 26 | { 27 | 28 | /** 29 | * This class is the main parser class for Word95 documents. 30 | */ 31 | class Parser95 : public Parser9x 32 | { 33 | public: 34 | Parser95( OLEStorage* storage, OLEStreamReader* wordDocument ); 35 | virtual ~Parser95(); 36 | 37 | private: 38 | // don't copy or assing us 39 | Parser95( const Parser95& rhs ); 40 | Parser95& operator=( const Parser95& rhs ); 41 | 42 | void init(); 43 | }; 44 | 45 | } // namespace wvWare 46 | 47 | #endif // PARSER95_H 48 | -------------------------------------------------------------------------------- /src/parser97.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef PARSER97_H 20 | #define PARSER97_H 21 | 22 | #include "parser9x.h" 23 | #include "wv2_export.h" 24 | 25 | namespace wvWare 26 | { 27 | 28 | /** 29 | * This class is the main parser class for Word97 documents. 30 | */ 31 | class Parser97 : public Parser9x 32 | { 33 | public: 34 | Parser97( OLEStorage* storage, OLEStreamReader* wordDocument ); 35 | virtual ~Parser97(); 36 | 37 | private: 38 | // Don't copy or assign us 39 | Parser97( const Parser97& rhs ); 40 | Parser97& operator=( const Parser97& rhs ); 41 | 42 | void init(); 43 | }; 44 | 45 | } // namespace wvWare 46 | 47 | #endif // PARSER97_H 48 | -------------------------------------------------------------------------------- /src/functordata.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "functordata.h" 20 | #include "word97_generated.h" 21 | 22 | using namespace wvWare; 23 | 24 | 25 | TableRowData::TableRowData( unsigned int sp, unsigned int so, unsigned int len, 26 | int subDoc, SharedPtr sharedTap ) : 27 | startPiece( sp ), startOffset( so ), length( len ), subDocument( subDoc ), tap( sharedTap ) 28 | { 29 | } 30 | 31 | TableRowData::~TableRowData() 32 | { 33 | } 34 | 35 | 36 | PictureData::PictureData( U32 fc, SharedPtr sharedPicf ) : 37 | fcPic( fc ), picf( sharedPicf ) 38 | { 39 | } 40 | 41 | PictureData::~PictureData() 42 | { 43 | } 44 | -------------------------------------------------------------------------------- /src/wv2version.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2003 Calligra Team 3 | Copyright (C) 2003 Werner Trobin 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the Library GNU General Public 7 | version 2 of the License, or (at your option) version 3 or, 8 | at the discretion of KDE e.V (which shall act as a proxy as in 9 | section 14 of the GPLv3), any later version.. 10 | 11 | This library is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | Library General Public License for more details. 15 | 16 | You should have received a copy of the GNU Library General Public License 17 | along with this library; see the file COPYING.LIB. If not, write to 18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 19 | Boston, MA 02110-1301, USA. 20 | */ 21 | 22 | // NOTE: Obsolete 23 | 24 | #include "wv2version.h" 25 | 26 | unsigned int wvWare::version() 27 | { 28 | return WV2_VERSION; 29 | } 30 | 31 | unsigned int wvWare::versionMajor() 32 | { 33 | return WV2_VERSION_MAJOR; 34 | } 35 | 36 | unsigned int wvWare::versionMinor() 37 | { 38 | return WV2_VERSION_MINOR; 39 | } 40 | 41 | unsigned int wvWare::versionRelease() 42 | { 43 | return WV2_VERSION_RELEASE; 44 | } 45 | 46 | const char *wvWare::versionString() 47 | { 48 | return WV2_VERSION_STRING; 49 | } 50 | -------------------------------------------------------------------------------- /src/parser97.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "parser97.h" 20 | #include "headers97.h" 21 | 22 | using namespace wvWare; 23 | 24 | 25 | Parser97::Parser97( OLEStorage* storage, OLEStreamReader* wordDocument ) : 26 | Parser9x( storage, wordDocument, Word97::FIB( wordDocument, true ) ) 27 | { 28 | if ( !isOk() ) 29 | return; 30 | 31 | // Initialize the remaining data structures 32 | init(); 33 | } 34 | 35 | Parser97::~Parser97() 36 | { 37 | } 38 | 39 | void Parser97::init() 40 | { 41 | if ( m_fib.ccpHdd != 0 ) 42 | m_headers = new Headers97( m_fib.ccpHdd, 43 | m_fib.fcPlcfhdd, m_fib.lcbPlcfhdd, 44 | m_fib.fcPlcfsed, m_fib.lcbPlcfsed, m_table ); 45 | } 46 | -------------------------------------------------------------------------------- /tests/test.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | namespace wvWare 26 | { 27 | 28 | void test( bool result, const std::string& failureMessage, const std::string& successMessage = "" ) 29 | { 30 | if ( result ) { 31 | if ( !successMessage.empty() ) 32 | std::cerr << successMessage << std::endl; 33 | } 34 | else { 35 | std::cerr << failureMessage << std::endl; 36 | std::cerr << "Test NOT finished successfully." << std::endl; 37 | ::exit( 1 ); 38 | } 39 | } 40 | 41 | void test( bool result ) 42 | { 43 | test( result, "Failed", "Passed" ); 44 | } 45 | 46 | } // namespace wvWare 47 | -------------------------------------------------------------------------------- /src/parserfactory.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef PARSERFACTORY_H 20 | #define PARSERFACTORY_H 21 | 22 | #include 23 | #include "sharedptr.h" 24 | #include "wv2_export.h" 25 | 26 | namespace wvWare 27 | { 28 | 29 | class Parser; 30 | class OLEStorage; 31 | 32 | class WV2_EXPORT ParserFactory 33 | { 34 | public: 35 | /** 36 | * This method opens a storage on the file, determines the nFib, 37 | * and creates a proper parser for it. 38 | * All you have to do with that parser is to call parse() on it 39 | * and it will start firing callbacks. 40 | * This method will return 0 if it wasn't successful (e.g unknown 41 | * version, corrupted file,...). 42 | */ 43 | static SharedPtr createParser( const std::string& fileName ); 44 | }; 45 | 46 | } // namespace wvWare 47 | 48 | #endif // PARSERFACTORY_H 49 | -------------------------------------------------------------------------------- /src/parser95.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "parser95.h" 20 | #include "convert.h" 21 | #include "headers95.h" 22 | #include "properties97.h" 23 | 24 | using namespace wvWare; 25 | 26 | Parser95::Parser95( OLEStorage* storage, OLEStreamReader* wordDocument ) : 27 | Parser9x( storage, wordDocument, Word95::toWord97( Word95::FIB( wordDocument, true ) ) ) 28 | { 29 | if ( !isOk() ) 30 | return; 31 | 32 | // Initialize the remaining data structures 33 | init(); 34 | } 35 | 36 | Parser95::~Parser95() 37 | { 38 | } 39 | 40 | void Parser95::init() 41 | { 42 | if ( m_fib.ccpHdd != 0 ) 43 | m_headers = new Headers95( m_fib.ccpHdd, m_fib.fcPlcfhdd, m_fib.lcbPlcfhdd, 44 | m_fib.fcPlcfsed, m_fib.lcbPlcfsed, 45 | m_table, m_properties->dop().grpfIhdt ); 46 | } 47 | -------------------------------------------------------------------------------- /tests/parsertest.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | using namespace wvWare; 25 | 26 | // A small testcase for the parser (Word97) 27 | int main( int argc, char** argv ) 28 | { 29 | if ( argc > 2 ) { 30 | std::cerr << "Usage: parsertest [foo.doc]" << std::endl; 31 | ::exit( 1 ); 32 | } 33 | 34 | std::string file; 35 | if ( argc == 1 ) 36 | file = "testole.doc"; 37 | else 38 | file = argv[ 1 ]; 39 | 40 | std::cerr << "Testing the parser with " << file << "..." << std::endl; 41 | 42 | SharedPtr parser( ParserFactory::createParser( file ) ); 43 | std::cerr << "Trying... " << std::endl; 44 | if ( parser ) 45 | test ( parser->parse() ); 46 | std::cerr << "Done." << std::endl; 47 | 48 | return 0; 49 | } 50 | -------------------------------------------------------------------------------- /src/generator/spec_defects: -------------------------------------------------------------------------------- 1 | This file lists a few known defects in the Word specs: 2 | - Word6 spec: 3 | 4 | 5 | 6 | - Word8 spec: 7 | + The LSTF structures are stored as strange PLF (with a short count instead of 8 | the integer count known from plain PLFs) and it's labeled plcflst. Normally 9 | a PLCF also contains an array of CPs or FCs, so this is a clear error in the 10 | spec. 11 | + The name of a style (STD::xstzName) is stored as pascal string. According to 12 | the spec it's preceded by a length byte, to me it looks like a length short. 13 | In Shaheed's code it looks like older versions (baseSize < 10) don't store it 14 | as Unicode string. The whole style docu looks like Word6 documentation to me. 15 | + The PAP spec suggests that fMultLineSpace and dyaLine should be set to some 16 | default values. I think they mean fMinHeight and dyaHeight, but we don't need 17 | that stuff, do we? 18 | + It looks like sprmCHpsKern has a two byte data field, but I found a document 19 | where it's only one byte long. Any special case we're missing? 20 | + I added a few sprms as sprmUnknown1,2,... to the jump tables, to avoid warnings 21 | we can't do anything about. I also added sprmPJcFE (0x2461) with the same 22 | behavior as plain old sprmPJc (as seen in OOo). 23 | + sprmPIncLvl talks about an stc, but it's istd now in Word97 (check wv/sprm.c) 24 | + The header/footer documentation is crap, look at the code 25 | + The footnote/endnote documentation is crap too 26 | 27 | - Word 2000: 28 | + OOo reverse-engineered a field of the FIB they called fcMagicTable. A PLCF 29 | with information about table cell start CPs in the file. For now I decided 30 | not to use this information, as Word 8 doesn't have it anyway. 31 | -------------------------------------------------------------------------------- /CmdDebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | * File: msoDebug.h 3 | * Author: dev 4 | * Debug macro from all file on this lib 5 | * Created on 15. dicembre 2013, 10:48 6 | */ 7 | 8 | #ifndef MSODEBUG_H 9 | #define MSODEBUG_H 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #ifdef HAVE_CONFIG_H 17 | #include 18 | #endif 19 | 20 | #ifdef HAVE_ICONV_H 21 | #include 22 | #define ICONV_CONST 23 | #endif 24 | #ifdef HAVE_SYS_ICONV_H 25 | #include 26 | #endif 27 | 28 | // ...and work around gcc 2.95.x's STL problems (e.g. ostream isn't a template) 29 | #if defined(__GNUC__) 30 | # if __GNUC__ < 3 31 | # define WV2_OLD_STL_WORKAROUND 1 32 | # endif 33 | #endif 34 | 35 | /// at end set to 1 and no debug message from wv2 36 | #if 0 //// 1 or 0 37 | #define internqt qDebug() 38 | #else 39 | #define internqt if (0) qDebug() 40 | #endif 41 | 42 | #if 0 //// 1 or 0 43 | #define DCALLIGRA qDebug 44 | #else 45 | #define DCALLIGRA if (0) qDebug 46 | #endif 47 | 48 | 49 | 50 | 51 | 52 | #if 0 //// 1 or 0 53 | #define kDebug qDebug() 54 | #else 55 | #define kDebug if (0) qDebug() 56 | #endif 57 | 58 | #if 0 //// 1 or 0 59 | #define kDebug qDebug 60 | #else 61 | #define kDebug if (0) qDebug 62 | #endif 63 | 64 | #if 1 //// 1 or 0 65 | #define kWarning qWarning() 66 | #else 67 | #define kWarning if (0) qWarning() 68 | #endif 69 | 70 | #if 1 //// 1 or 0 71 | #define kWarning qWarning 72 | #else 73 | #define kWarning if (0) qWarning 74 | #endif 75 | 76 | class InvalidFormatException : public std::exception 77 | { 78 | public: 79 | const QString msg; 80 | InvalidFormatException() {} 81 | explicit InvalidFormatException(const QString &m) :msg(m) {} 82 | ~InvalidFormatException() throw() {} 83 | }; 84 | 85 | 86 | 87 | 88 | #endif /* MSODEBUG_H */ 89 | 90 | -------------------------------------------------------------------------------- /src/word97_helper.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef WORD97_HELPER_H 20 | #define WORD97_HELPER_H 21 | 22 | #include "global.h" 23 | #include "wv2_export.h" 24 | #include "word97_generated.h" 25 | 26 | namespace wvWare 27 | { 28 | class OLEStreamReader; 29 | class ParagraphProperties; 30 | class StyleSheet; 31 | 32 | namespace Word97 33 | { 34 | struct TAP; 35 | } 36 | 37 | namespace Word97 38 | { 39 | ParagraphProperties* initPAPFromStyle( const U8* exceptions, const StyleSheet* styleSheet, OLEStreamReader* dataStream, WordVersion version ); 40 | Word97::TAP* initTAP( const U8* exceptions, OLEStreamReader* dataStream, WordVersion version ); 41 | 42 | namespace SPRM 43 | { 44 | U16 unzippedOpCode( U8 isprm ); 45 | U16 determineParameterLength( U16 sprm, const U8* in, WordVersion version ); 46 | U16 word6toWord8( U8 sprm ); 47 | } 48 | } // namespace Word97 49 | } // namespace wvWare 50 | 51 | #endif // WORD97_HELPER_H 52 | -------------------------------------------------------------------------------- /src/headers97.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef HEADERS97_H 20 | #define HEADERS97_H 21 | 22 | #include "headers.h" 23 | #include "wv2_export.h" 24 | 25 | namespace wvWare 26 | { 27 | /** 28 | * @internal 29 | * A tiny helper class to move some header/footer code out of the parser. 30 | * Might not be ultra-elegant, but I don't like it if the parser code 31 | * grows too much. 32 | */ 33 | class Headers97 : public Headers 34 | { 35 | public: 36 | Headers97( U32 ccpHdd, U32 fcPlcfhdd, U32 lcbPlcfhdd, U32 fcPlcfsed, U32 lcbPlcfsed, 37 | OLEStreamReader* tableStream ); 38 | 39 | /** 40 | * Returns the header if there is any for the given mask. If we didn't find 41 | * any header the pair's values are 0, 0. 42 | */ 43 | virtual std::pair findHeader( int sectionNumber, unsigned char mask ) const; 44 | 45 | private: 46 | int maskToOffset( unsigned char mask ) const; 47 | }; 48 | 49 | } // namespace wvWare 50 | 51 | #endif // HEADERS97_H 52 | -------------------------------------------------------------------------------- /README_QT5: -------------------------------------------------------------------------------- 1 | new 2017 mac osx el capitan: 2 | search "libiconv-1.9.2.tar.gz" if the same url... 3 | 4 | mkdir ~/__sandbox 5 | # or make alias to your path .bash_profil: alias go='cd ~/__sandbox/' 6 | cd __sandbox 7 | wget https://ftp.gnu.org/gnu/libiconv/libiconv-1.9.2.tar.gz 8 | extract libiconv-1.9.2.tar.gz 9 | extract on console 10 | inside your .bash_profile 11 | # extract: Extract most know archives with one command 12 | # --------------------------------------------------------- 13 | extract () { 14 | if [ -f $1 ] ; then 15 | case $1 in 16 | *.tar.bz2) tar xjf $1 ;; 17 | *.tar.gz) tar xzf $1 ;; 18 | *.bz2) bunzip2 $1 ;; 19 | *.rar) unrar e $1 ;; 20 | *.gz) gunzip $1 ;; 21 | *.tar) tar xf $1 ;; 22 | *.tbz2) tar xjf $1 ;; 23 | *.tgz) tar xzf $1 ;; 24 | *.zip) unzip $1 ;; 25 | *.Z) uncompress $1 ;; 26 | *.7z) 7z x $1 ;; 27 | *) echo "'$1' cannot be extracted via extract()" ;; 28 | esac 29 | else 30 | echo "'$1' is not a valid file" 31 | fi 32 | } 33 | 34 | cd libiconv-1.9.2 35 | ./configure --prefix=/opt/box 36 | make 37 | sudo make install 38 | # libiconv-1.9.2 can now use... 39 | 40 | 41 | 42 | 43 | # end 2017.. 44 | 45 | This is wv2qt-0.4.2, see: http://wvware.sourceforge.net/ 46 | We slightly modified the code to meet our need. 47 | 48 | To build libs ... take qt5 & cd to wv2qt path 49 | qmake && make 50 | at end 51 | sudo make install 52 | on error handle this.. 53 | 54 | this static lib only need iconv.. this is deal... qt having all to manage other item 55 | on Window .... hmm 56 | 57 | 58 | Ready to use on project: 59 | 60 | LIBS += -lz 61 | LIBS += -L/opt/icon/lib -liconv -I/opt/icon/include 62 | LIBS += -L/opt/icon/lib -lwv2qt -I/opt/icon/include 63 | -------------------------------------------------------------------------------- /Sandcastle5/fox_office/docfox.h: -------------------------------------------------------------------------------- 1 | #ifndef FOXCORE_H 2 | #define FOXCORE_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | #ifdef DOCGUIRUN 30 | /// running on gui graphic 31 | const int RUNGUI = 1; 32 | #else 33 | /// only on console 34 | const int RUNGUI = 0; 35 | #endif 36 | 37 | class FoxCore : public QObject { 38 | Q_OBJECT 39 | public: 40 | explicit FoxCore(QObject *parent = 0); 41 | #ifdef DOCGUIRUN 42 | void openfile(const QString file); 43 | #endif 44 | signals: 45 | void ready(); 46 | #ifdef DOCGUIRUN 47 | void takefile(QString); 48 | void errormsg(QString); 49 | void handlemsg(QString); 50 | #endif 51 | public slots: 52 | void checkstyle(); 53 | void downloadProgress(qint64 r, qint64 tot); 54 | void doDownload(const QUrl &url); 55 | void domd5check(const QUrl &url); 56 | void downloadFinished(QNetworkReply *reply); 57 | void downmd5check(QNetworkReply *reply); /// update check 58 | void countfile(); 59 | void checkupdate(); 60 | private: 61 | #ifndef DOCGUIRUN 62 | QString pendingfile(); 63 | #endif 64 | bool saveToDisk(const QString &filename, QIODevice *data); 65 | bool runlocalStyle(const QString style); 66 | QStringList allstyle; 67 | QString oldmd5disk; 68 | QDir dir; 69 | int inventar; 70 | int inventarnet; 71 | bool operative; 72 | QNetworkAccessManager updatem; 73 | QNetworkAccessManager manager; 74 | }; 75 | 76 | #endif // FOXCORE_H 77 | -------------------------------------------------------------------------------- /src/generator/template-Word95.h: -------------------------------------------------------------------------------- 1 | ### As you recognized already, "###" at the begin of a line 2 | ### marks a comment. 3 | 4 | ### Everything between start and end will be put into the file 5 | @@license-start@@ 6 | /* This file is part of the wvWare 2 project 7 | Copyright (C) 2001 Werner Trobin 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Library General Public 11 | License version 2 as published by the Free Software Foundation. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Library General Public License for more details. 17 | 18 | You should have received a copy of the GNU Library General Public License 19 | along with this library; see the file COPYING.LIB. If not, write to 20 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | Boston, MA 02111-1307, USA. 22 | */ 23 | 24 | // This code is generated from the Microsoft HTML specification of the 25 | // WinWord format. Do NOT edit this code, but fix the spec or the script 26 | // generating the sources. 27 | // For information about the script and the "hidden features" please read 28 | // the comments at the begin of the script. 29 | 30 | // If you find bugs or strange behavior please contact Werner Trobin 31 | // 32 | @@license-end@@ 33 | 34 | ### Everything between @@includes-start@@ and -end will be added to 35 | ### the generated includes (e.g. "#include ") 36 | @@includes-start@@ 37 | ####include // test 38 | @@includes-end@@ 39 | 40 | ### These are the "borders" of the namespace (e.g. namespace Word97 { .. }) 41 | ### Everything you add in here will be added to the generated code 42 | @@namespace-start@@ 43 | ### nothing 44 | ### This tag "expands" to all the structs :) 45 | @@generated-code@@ 46 | ### nothing 47 | @@namespace-end@@ 48 | -------------------------------------------------------------------------------- /tests/sharedptrtest.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | using namespace wvWare; 23 | 24 | struct Foo : public Shared 25 | { 26 | Foo() : bar( 42 ), baz( 42.42 ) { std::cerr << "Creating Foo" << std::endl; } 27 | ~Foo() { std::cerr << "Destroying Foo" << std::endl; } 28 | 29 | int bar; 30 | double baz; 31 | }; 32 | 33 | SharedPtr createFoo() 34 | { 35 | return SharedPtr( new Foo() ); 36 | } 37 | 38 | void testMe() 39 | { 40 | SharedPtr foo = createFoo(); 41 | std::cerr << "Test 1: Passing around the object: "; 42 | test( foo->bar == 42 && foo.count() == 1 ); 43 | 44 | std::cerr << "Test 2: Copying the \"pointer\": "; 45 | SharedPtr foo2( foo ); 46 | test( foo2->bar == 42 && foo2.count() == 2 && foo->bar == 42 && foo.count() == 2 ); 47 | 48 | std::cerr << "Going out of scope..." << std::endl; 49 | } 50 | 51 | // A small testcase for the SharedPtr template 52 | int main( int, char** ) 53 | { 54 | std::cerr << "Testing the SharedPtr template..." << std::endl; 55 | testMe(); 56 | std::cerr << "Done." << std::endl; 57 | return 0; 58 | } 59 | -------------------------------------------------------------------------------- /src/global.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "global.h" 20 | 21 | #ifdef HAVE_CONFIG_H 22 | #include 23 | #endif 24 | 25 | namespace wvWare { 26 | 27 | // Endianness fun 28 | U16 toLittleEndian( U16 data ) 29 | { 30 | #if defined(WORDS_BIGENDIAN) 31 | return ( ( data & 0x00ffU ) << 8 ) | ( ( data & 0xff00U ) >> 8 ); 32 | #else 33 | return data; 34 | #endif 35 | } 36 | 37 | U16 toBigEndian( U16 data ) 38 | { 39 | #if defined(WORDS_BIGENDIAN) 40 | return data; 41 | #else 42 | return ( ( data & 0x00ffU ) << 8 ) | ( ( data & 0xff00U ) >> 8 ); 43 | #endif 44 | } 45 | 46 | U32 toLittleEndian( U32 data ) 47 | { 48 | #if defined(WORDS_BIGENDIAN) 49 | return ( ( data & 0x000000ffU ) << 24 ) | ( ( data & 0x0000ff00U ) << 8 ) | 50 | ( ( data & 0x00ff0000U ) >> 8 ) | ( ( data & 0xff000000U ) >> 24 ); 51 | #else 52 | return data; 53 | #endif 54 | } 55 | 56 | U32 toBigEndian( U32 data ) 57 | { 58 | #if defined(WORDS_BIGENDIAN) 59 | return data; 60 | #else 61 | return ( ( data & 0x000000ffU ) << 24 ) | ( ( data & 0x0000ff00U ) << 8 ) | 62 | ( ( data & 0x00ff0000U ) >> 8 ) | ( ( data & 0xff000000U ) >> 24 ); 63 | #endif 64 | } 65 | 66 | } // namespace wvWare 67 | -------------------------------------------------------------------------------- /src/generator/template-Word95.cpp: -------------------------------------------------------------------------------- 1 | ### As you recognized already, "###" at the begin of a line 2 | ### marks a comment. 3 | 4 | ### Everything between start and end will be put into the file 5 | @@license-start@@ 6 | /* This file is part of the wvWare 2 project 7 | Copyright (C) 2001 Werner Trobin 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Library General Public 11 | License version 2 as published by the Free Software Foundation. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Library General Public License for more details. 17 | 18 | You should have received a copy of the GNU Library General Public License 19 | along with this library; see the file COPYING.LIB. If not, write to 20 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | Boston, MA 02111-1307, USA. 22 | */ 23 | 24 | // This code is generated from the Microsoft HTML specification of the 25 | // WinWord format. Do NOT edit this code, but fix the spec or the script 26 | // generating the sources. If you want to add some additional code, some 27 | // includes or any other stuff, please add it to the template file! 28 | // For information about the script and the "hidden features" please read 29 | // the comments at the begin of the script. 30 | 31 | // If you find bugs or strange behavior please contact Werner Trobin 32 | // 33 | @@license-end@@ 34 | 35 | ### Everything between @@includes-start@@ and -end will be added to 36 | ### the generated includes (e.g. "#include ") 37 | @@includes-start@@ 38 | ####include // test 39 | @@includes-end@@ 40 | 41 | ### These are the "borders" of the namespace (e.g. namespace Word97 { .. }) 42 | ### Everything you add in here will be added to the generated code 43 | @@namespace-start@@ 44 | ### nothing 45 | ### This tag "expands" to all the structs :) 46 | @@generated-code@@ 47 | ### nothing 48 | @@namespace-end@@ 49 | -------------------------------------------------------------------------------- /src/headers95.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef HEADERS95_H 20 | #define HEADERS95_H 21 | 22 | #include "headers.h" 23 | #include "wv2_export.h" 24 | 25 | namespace wvWare 26 | { 27 | /** 28 | * @internal 29 | * A tiny helper class to move some header/footer code out of the parser. 30 | * Might not be ultra-elegant, but I don't like it if the parser code 31 | * grows too much. 32 | */ 33 | class Headers95 : public Headers 34 | { 35 | public: 36 | Headers95( U32 ccpHdd, U32 fcPlcfhdd, U32 lcbPlcfhdd, U32 fcPlcfsed, U32 lcbPlcfsed, 37 | OLEStreamReader* tableStream, U8 dop_grpfIhdt ); 38 | 39 | /** 40 | * Returns the header if there is any for the given mask. If we didn't find 41 | * any header the pair's values are 0, 0. 42 | */ 43 | virtual std::pair findHeader( int sectionNumber, unsigned char mask ) const; 44 | 45 | virtual void set_headerMask( U8 sep_grpfIhdt ); 46 | 47 | private: 48 | // Counts the '1' bits in from the lsb up to (exclusively) 49 | int countOnes( U8 mask, U8 limit ) const; 50 | 51 | const int ihddOffset; 52 | QList m_headerCount; 53 | QList m_grpfIhdt; 54 | }; 55 | 56 | } // namespace wvWare 57 | 58 | #endif // HEADERS95_H 59 | -------------------------------------------------------------------------------- /Sandcastle5/fox_office/fox_office.pri: -------------------------------------------------------------------------------- 1 | ## netbean 7.1 follow header use this from wv5qt.pro 2 | ## cp -r /opt/icon/include/wv5qt ./ 3 | 4 | mac { 5 | INCLUDEPATH += /opt/icon/include 6 | INCLUDEPATH += /opt/icon/include/libxml2 7 | INCLUDEPATH += /opt/icon/include/libxml2/libxml 8 | INCLUDEPATH += /opt/icon/include/libxslt 9 | DEPENDPATH += /opt/icon/include 10 | LIBS += -lxml2 -lxslt 11 | } 12 | 13 | 14 | ## DEFINES += CLEANHTML_FULL 15 | 16 | greaterThan(QT_MAJOR_VERSION, 4) { 17 | DEFINES += HAVING_QTFIVE 18 | 19 | DEFINES += HAVE5DOCX 20 | DEFINES += HAVE4ODT 21 | DEFINES += HAVE5ODT 22 | DEFINES += SUPPORTDOCOK 23 | DEFINES += HAVE4RTF 24 | ## not pdftohtml bad DEFINES += HAVE5PDF 25 | DEFINES += HAVEOLEMICROSOFT 26 | QT += xmlpatterns 27 | } else { 28 | 29 | DEFINES += HAVING_QT 30 | DEFINES += HAVEOLEMICROSOFT 31 | DEFINES += HAVE4ODT 32 | DEFINES += HAVE4RTF 33 | DEFINES += SUPPORTDOCOK 34 | } 35 | 36 | DEFINES += DOCGUIRUN 37 | ## /opt/icon/include/wv2qt ./configure --prefix=/opt/icon --without-freetype-src ./configure.in --prefix=/opt/icon 38 | INCLUDEPATH += /opt/icon/include 39 | DEPENDPATH += /opt/icon/include 40 | 41 | # CONFIG += qt warn_off silent debug 42 | QT += core xml network gui 43 | CONFIG += qt warn_off silent release 44 | # QTextDocument need gui.. 45 | greaterThan(QT_MAJOR_VERSION, 4) { 46 | QT += widgets 47 | } 48 | 49 | LIBS += -lz 50 | LIBS += -L/opt/icon/lib -liconv -I/opt/icon/include 51 | LIBS += -L/opt/icon/lib -lwv5qt -I/opt/icon/include 52 | 53 | DEPENDSPATH += $$PWD 54 | INCLUDEPATH += $$PWD 55 | 56 | # Input $$PWD/foxpdf_handler.h \ $$PWD/foxpdf_handler.cpp \ 57 | HEADERS += $$PWD/fox_base.h \ 58 | $$PWD/docfox.h \ 59 | $$PWD/foxdoc_handler.h \ 60 | $$PWD/foxdoc_texthandler.h \ 61 | $$PWD/foxdocx_handler.h \ 62 | $$PWD/foxodt_handler.h \ 63 | $$PWD/foxrtf_handler.h 64 | SOURCES += $$PWD/fox_base.cpp \ 65 | $$PWD/docfox.cpp \ 66 | $$PWD/foxdoc_handler.cpp \ 67 | $$PWD/foxdoc_texthandler.cpp \ 68 | $$PWD/foxdocx_handler.cpp \ 69 | $$PWD/foxodt_handler.cpp \ 70 | $$PWD/foxrtf_handler.cpp 71 | -------------------------------------------------------------------------------- /src/headers97.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "headers97.h" 20 | 21 | using namespace wvWare; 22 | 23 | Headers97::Headers97( U32 ccpHdd, U32 fcPlcfhdd, U32 lcbPlcfhdd, U32 fcPlcfsed, U32 lcbPlcfsed, 24 | OLEStreamReader* tableStream ) : 25 | Headers( ccpHdd, fcPlcfhdd, lcbPlcfhdd, fcPlcfsed, lcbPlcfsed, tableStream, Word8 ) 26 | { 27 | } 28 | 29 | std::pair Headers97::findHeader( int sectionNumber, unsigned char mask ) const 30 | { 31 | // NOTE: An empty header/footer story specifies that the previous section's 32 | // header/footer of the corresponding type is used. For the first section, 33 | // an empty header/footer story specifies that it does not have a 34 | // header/footer of this type. MS-DOC, p.34 35 | 36 | U32 start = 0; 37 | U32 lim = 0; 38 | const int offset = maskToOffset( mask ); 39 | do { 40 | const int tmp = sectionNumber * headerTypes + offset; 41 | start = m_headers[ tmp ]; 42 | lim = m_headers[ tmp + 1 ]; 43 | --sectionNumber; 44 | } while ( start == lim && sectionNumber >= 0 ); 45 | 46 | return std::make_pair( start, lim ); 47 | } 48 | 49 | int Headers97::maskToOffset( unsigned char mask ) const 50 | { 51 | int offset = 0; 52 | while ( mask != 0 && ( mask & 1 ) == 0 ) { 53 | ++offset; 54 | mask >>= 1; 55 | } 56 | return offset; 57 | } 58 | -------------------------------------------------------------------------------- /src/generator/template-conv.h: -------------------------------------------------------------------------------- 1 | ### As you recognized already, "###" at the begin of a line 2 | ### marks a comment. 3 | 4 | ### Everything between start and end will be put into the file 5 | @@license-start@@ 6 | /* This file is part of the wvWare 2 project 7 | Copyright (C) 2001 Werner Trobin 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Library General Public 11 | License version 2 as published by the Free Software Foundation. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Library General Public License for more details. 17 | 18 | You should have received a copy of the GNU Library General Public License 19 | along with this library; see the file COPYING.LIB. If not, write to 20 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | Boston, MA 02111-1307, USA. 22 | */ 23 | 24 | // This code is generated from the Microsoft HTML specification of the 25 | // WinWord format. Do NOT edit this code, but fix the spec or the script 26 | // generating the sources. 27 | // For information about the script and the "hidden features" please read 28 | // the comments at the begin of the script. 29 | 30 | // If you find bugs or strange behavior please contact Werner Trobin 31 | // 32 | @@license-end@@ 33 | 34 | ### Everything between @@includes-start@@ and -end will be added to 35 | ### the generated includes (e.g. "#include ") 36 | @@includes-start@@ 37 | ####include // test 38 | @@includes-end@@ 39 | 40 | ### These are the "borders" of the namespace (e.g. namespace Word97 { .. }) 41 | ### Everything you add in here will be added to the generated code 42 | @@namespace-start@@ 43 | ### nothing 44 | 45 | // This has been added to the template file, as the mapping is 46 | // non-trivial. Shaheed: Please check the implementation 47 | Word97::BRC toWord97(const Word95::BRC &s); 48 | Word97::STSHI toWord97(const Word95::STSHI &s); 49 | ### This tag "expands" to all the structs :) 50 | @@generated-code@@ 51 | ### nothing 52 | @@namespace-end@@ 53 | -------------------------------------------------------------------------------- /src/paragraphproperties.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "paragraphproperties.h" 20 | #include "lists.h" 21 | 22 | using namespace wvWare; 23 | 24 | ParagraphProperties::ParagraphProperties() : m_listInfo( 0 ) 25 | { 26 | } 27 | 28 | ParagraphProperties::ParagraphProperties( const Word97::PAP& pap ) : 29 | m_pap( pap ), m_listInfo( 0 ) 30 | { 31 | } 32 | 33 | ParagraphProperties::ParagraphProperties( const ParagraphProperties& rhs ) : 34 | Shared( rhs ), m_pap( rhs.pap() ), m_listInfo( 0 ) 35 | { 36 | if ( rhs.listInfo() ) 37 | m_listInfo = new ListInfo( *rhs.listInfo() ); 38 | } 39 | 40 | ParagraphProperties::~ParagraphProperties() 41 | { 42 | delete m_listInfo; 43 | } 44 | 45 | Word97::PAP& ParagraphProperties::pap() 46 | { 47 | return m_pap; 48 | } 49 | 50 | const Word97::PAP& ParagraphProperties::pap() const 51 | { 52 | return m_pap; 53 | } 54 | 55 | const ListInfo* ParagraphProperties::listInfo() const 56 | { 57 | return m_listInfo; 58 | } 59 | 60 | void ParagraphProperties::setBulletPictureName(const QString& name) 61 | { 62 | m_listInfo->setBulletPictureName(name); 63 | } 64 | 65 | void ParagraphProperties::createListInfo( ListInfoProvider& listInfoProvider, Word97::CHP& chp) 66 | { 67 | if ( m_listInfo || !listInfoProvider.isValid( m_pap.ilfo, m_pap.nLvlAnm ) ) { 68 | return; 69 | } 70 | m_listInfo = new ListInfo( m_pap, chp, listInfoProvider ); 71 | } 72 | -------------------------------------------------------------------------------- /src/generator/_no_CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Generate parsers for some Word structures. 2 | CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) 3 | 4 | #cmake_policy CMP0017 was introduced in version 2.8.4 5 | if(${CMAKE_VERSION} VERSION_GREATER 2.8.3) 6 | cmake_policy(SET CMP0017 NEW) 7 | endif() 8 | 9 | SET( scanner_word95 10 | ${CMAKE_CURRENT_BINARY_DIR}/word95_generated.h 11 | ${CMAKE_CURRENT_BINARY_DIR}/word95_generated.cpp 12 | ${CMAKE_CURRENT_BINARY_DIR}/word95_test.cpp 13 | ) 14 | 15 | SET( scanner_word97 16 | ${CMAKE_CURRENT_BINARY_DIR}/word97_generated.h 17 | ${CMAKE_CURRENT_BINARY_DIR}/word97_generated.cpp 18 | ${CMAKE_CURRENT_BINARY_DIR}/word97_test.cpp 19 | ) 20 | 21 | SET( converter 22 | ${CMAKE_CURRENT_BINARY_DIR}/convert.h 23 | ${CMAKE_CURRENT_BINARY_DIR}/convert.cpp 24 | ) 25 | 26 | ADD_CUSTOM_COMMAND( 27 | OUTPUT ${scanner_word95} 28 | COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && perl generate.pl generator_wword6.htm Word95 && mv word95_*.* ${CMAKE_CURRENT_BINARY_DIR} 29 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generate.pl 30 | ${CMAKE_CURRENT_SOURCE_DIR}/generator_wword6.htm 31 | ${CMAKE_CURRENT_SOURCE_DIR}/template-Word95.h 32 | ${CMAKE_CURRENT_SOURCE_DIR}/template-Word95.cpp 33 | ) 34 | 35 | ADD_CUSTOM_COMMAND( 36 | OUTPUT ${scanner_word97} 37 | COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && perl generate.pl generator_wword8.htm Word97 && mv word97_*.* ${CMAKE_CURRENT_BINARY_DIR} 38 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/generate.pl 39 | ${CMAKE_CURRENT_SOURCE_DIR}/generator_wword8.htm 40 | ${CMAKE_CURRENT_SOURCE_DIR}/template-Word97.h 41 | ${CMAKE_CURRENT_SOURCE_DIR}/template-Word97.cpp 42 | ) 43 | 44 | ADD_CUSTOM_COMMAND( 45 | OUTPUT ${converter} 46 | COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && perl converter.pl generator_wword6.htm generator_wword8.htm && mv convert.* ${CMAKE_CURRENT_BINARY_DIR} 47 | DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/converter.pl 48 | ${CMAKE_CURRENT_SOURCE_DIR}/generator_wword6.htm 49 | ${CMAKE_CURRENT_SOURCE_DIR}/generator_wword8.htm 50 | ${CMAKE_CURRENT_SOURCE_DIR}/template-conv.h 51 | ${CMAKE_CURRENT_SOURCE_DIR}/template-conv.cpp 52 | ) 53 | 54 | ADD_CUSTOM_TARGET( generator ALL DEPENDS ${scanner_word95} ${scanner_word97} ${converter} ) 55 | 56 | -------------------------------------------------------------------------------- /tests/parsertest_mem.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | using namespace wvWare; 25 | 26 | // A small testcase for the parser (Word97) 27 | int main( int argc, char** argv ) 28 | { 29 | if ( argc > 2 ) { 30 | std::cerr << "Usage: parsertest_mem [foo.doc]" << std::endl; 31 | ::exit( 1 ); 32 | } 33 | 34 | std::string file; 35 | if ( argc == 1 ) 36 | file = "testole.doc"; 37 | else 38 | file = argv[ 1 ]; 39 | 40 | std::cerr << "Testing the parser with " << file << "..." << std::endl; 41 | 42 | FILE *fp; 43 | if( ( fp = fopen( file.c_str(), "rb" ) ) != 0 ) 44 | { 45 | fseek( fp, 0, SEEK_END ); 46 | size_t size = ftell( fp ); 47 | fseek( fp, 0, SEEK_SET ); 48 | unsigned char *mem = new unsigned char[ size ]; 49 | if ( fread( mem, 1, size, fp ) == size ) 50 | { 51 | SharedPtr parser( ParserFactory::createParser( mem, size ) ); 52 | std::cerr << "Trying... " << std::endl; 53 | if ( parser ) 54 | test ( parser->parse() ); 55 | std::cerr << "Done." << std::endl; 56 | } 57 | else 58 | std::cerr << "couldn't read file" << std::endl; 59 | fclose( fp ); 60 | delete [] mem; 61 | } 62 | else 63 | std::cerr << "couldn't open file" << std::endl; 64 | 65 | return 0; 66 | } 67 | -------------------------------------------------------------------------------- /src/olestorage.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "olestorage.h" 20 | #include "olestream.h" 21 | #include "wvlog.h" 22 | #include "pole.h" 23 | 24 | using namespace wvWare; 25 | 26 | OLEStorage::OLEStorage() 27 | : m_storage( 0 ) 28 | , m_fileName( "" ) 29 | { 30 | } 31 | 32 | OLEStorage::OLEStorage( const std::string& fileName ) 33 | : m_storage( 0 ) 34 | , m_fileName( fileName ) 35 | { 36 | } 37 | 38 | OLEStorage::~OLEStorage() 39 | { 40 | close(); // just in case 41 | } 42 | 43 | bool OLEStorage::open( Mode mode ) 44 | { 45 | if (!m_storage) { 46 | m_storage = new POLE::Storage( m_fileName.c_str() ); 47 | } 48 | 49 | return m_storage->open(); 50 | } 51 | 52 | void OLEStorage::close() 53 | { 54 | m_streams.clear(); 55 | 56 | if (m_storage) { 57 | m_storage->close(); 58 | delete m_storage; 59 | m_storage = 0; 60 | } 61 | } 62 | 63 | bool OLEStorage::isValid() const 64 | { 65 | return (m_storage != 0); 66 | } 67 | 68 | OLEStreamReader* OLEStorage::createStreamReader( const std::string& stream ) 69 | { 70 | if (!m_storage) 71 | return 0; 72 | 73 | // the stream is deleted by m_storage 74 | POLE::Stream *poleStream = new POLE::Stream(m_storage, stream); 75 | OLEStreamReader* reader = new OLEStreamReader(poleStream, this); 76 | m_streams.push_back( reader ); 77 | return reader; 78 | } 79 | 80 | OLEStreamWriter* OLEStorage::createStreamWriter( const std::string& stream ) 81 | { 82 | return 0; 83 | } 84 | -------------------------------------------------------------------------------- /src/fonts.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef FONTS_H 20 | #define FONTS_H 21 | 22 | #include "global.h" 23 | #include 24 | #include "wv2_export.h" 25 | 26 | namespace wvWare 27 | { 28 | class OLEStreamReader; 29 | namespace Word97 30 | { 31 | struct FIB; 32 | struct FFN; 33 | } 34 | 35 | /** 36 | * The FontCollection can be used to map ftc (font code) values to font names. 37 | */ 38 | class FontCollection 39 | { 40 | public: 41 | /** 42 | * You shouldn't construct such objects yourself, the Parser interface 43 | * provides accesst to the internal font collection. 44 | * @param reader is either a table or a document stream (97+ / older versions) 45 | */ 46 | FontCollection( OLEStreamReader* reader, const Word97::FIB& fib ); 47 | ~FontCollection(); 48 | 49 | /** 50 | * Returns the matching FFN structure for the given font code. If no matching 51 | * FFN is found, a fallback defaulting to "Helvetica" is returned. 52 | */ 53 | const Word97::FFN& font( S16 ftc ) const; 54 | 55 | /** 56 | * Dump all the font information, used for debugging. 57 | */ 58 | void dump() const; 59 | 60 | private: 61 | FontCollection( const FontCollection& rhs ); 62 | FontCollection& operator=( const FontCollection& rhs ); 63 | 64 | std::vector m_fonts; 65 | Word97::FFN* m_fallbackFont; 66 | }; 67 | 68 | } // namespace wvWare 69 | 70 | #endif // FONTS_H 71 | -------------------------------------------------------------------------------- /src/headers95.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "headers95.h" 20 | #include "wvlog.h" 21 | 22 | using namespace wvWare; 23 | 24 | Headers95::Headers95( U32 ccpHdd, U32 fcPlcfhdd, U32 lcbPlcfhdd, U32 fcPlcfsed, U32 lcbPlcfsed, 25 | OLEStreamReader* tableStream, U8 dop_grpfIhdt ) : 26 | Headers( ccpHdd, fcPlcfhdd, lcbPlcfhdd, fcPlcfsed, lcbPlcfsed, tableStream, Word67 ), 27 | ihddOffset( countOnes( dop_grpfIhdt, 0x40 ) ) 28 | { 29 | m_headerCount.push_back( 0 ); 30 | } 31 | 32 | std::pair Headers95::findHeader( int sectionNumber, unsigned char mask ) const 33 | { 34 | if ( m_grpfIhdt.size() <= sectionNumber ) { 35 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Warning: You are trying to access a section that has not been registered yet!" << endl; 36 | return std::make_pair( 0u, 0u ); 37 | } 38 | 39 | // The offset to the begin of the section + offset due to mask/grpfIhdt 40 | const int ihdd = ihddOffset + m_headerCount[ sectionNumber ] + 41 | countOnes( m_grpfIhdt[ sectionNumber ], mask ); 42 | return std::make_pair( m_headers[ ihdd ], m_headers[ ihdd + 1 ] ); 43 | } 44 | 45 | void Headers95::set_headerMask( U8 sep_grpfIhdt ) 46 | { 47 | m_grpfIhdt.push_back( sep_grpfIhdt ); 48 | m_headerCount.push_back( countOnes( sep_grpfIhdt, 0x40 ) + m_headerCount.back() ); 49 | } 50 | 51 | int Headers95::countOnes( U8 mask, U8 limit ) const 52 | { 53 | int count = 0; 54 | for ( U8 m = 1; m < limit; m <<= 1 ) { 55 | if ( m & mask ) { 56 | ++count; 57 | } 58 | } 59 | return count; 60 | } 61 | -------------------------------------------------------------------------------- /src/functor.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef FUNCTOR_H 20 | #define FUNCTOR_H 21 | 22 | #include "wv2_export.h" 23 | #include "parser9x.h" 24 | namespace wvWare 25 | { 26 | /** 27 | * FunctorBase is provided to allow polymorphic handling of different 28 | * types of functors. Use it like the real functor. 29 | */ 30 | class WV2_EXPORT FunctorBase 31 | { 32 | public: 33 | virtual ~FunctorBase() = 0; 34 | virtual void operator()() const; 35 | }; 36 | 37 | /** 38 | * The Functor class is used to pass on callback information to the 39 | * consumer filter. You may copy and assign it, to invoke it just 40 | * call operator(). 41 | */ 42 | template 43 | class WV2_EXPORT Functor : public FunctorBase 44 | { 45 | public: 46 | typedef void (ParserT::*F)( const Data& ); 47 | 48 | Functor( ParserT& parser, F f, const Data& data ) 49 | : m_parser( &parser ), f_( f ), m_data( data ) {} 50 | virtual void operator()() const { (m_parser->*f_)( m_data ); } 51 | 52 | private: 53 | ParserT* m_parser; 54 | F f_; 55 | Data m_data; 56 | }; 57 | 58 | /** 59 | * A small helper function to avoid unnecessary ugliness in the template 60 | * creation code. The function figures out the types and we don't have to 61 | * specify them explicitly every time we create a functor. 62 | */ 63 | template 64 | Functor make_functor( ParserT& parser, void (ParserT::*f) ( const Data& ), const Data& data ) 65 | { 66 | return Functor( parser, f, data ); 67 | } 68 | 69 | } // namespace wvWare 70 | 71 | #endif // FUNCTOR_H 72 | -------------------------------------------------------------------------------- /src/headers.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef HEADERS_H 20 | #define HEADERS_H 21 | 22 | //// #include "../../exceptions.h" 23 | 24 | #include "global.h" 25 | #include "wv2_export.h" 26 | #include 27 | #include 28 | 29 | namespace wvWare 30 | { 31 | 32 | class OLEStreamReader; 33 | 34 | /** 35 | * @internal 36 | * A tiny helper class to move some header/footer code out of the parser. 37 | * Might not be ultra-elegant, but I don't like it if the parser code 38 | * grows too much. 39 | * Abstract base class for the Word 6/7 and Word 8 variants. 40 | */ 41 | class Headers 42 | { 43 | public: 44 | Headers( U32 ccpHdd, U32 fcPlcfhdd, U32 lcbPlcfhdd, U32 fcPlcfsed, U32 lcbPlcfsed, 45 | OLEStreamReader* tableStream, WordVersion version ); 46 | virtual ~Headers(); 47 | 48 | /** 49 | * Returns the header if there is any for the given mask. If we didn't find 50 | * any header the pair's values are 0, 0. 51 | */ 52 | virtual std::pair findHeader( int sectionNumber, unsigned char mask ) const = 0; 53 | 54 | /** 55 | * A helper method to implement Word 6 support. 56 | */ 57 | virtual void set_headerMask( U8 sep_grpfIhdt ); 58 | 59 | /** 60 | * Returns a binary mask providing the information of empty/nonempty 61 | * header and footer stories for each section. Size of the list equals 62 | * the number of sections present in the document. 63 | */ 64 | QList headersMask( void ); 65 | 66 | protected: 67 | QList m_headers; 68 | static const uint headerTypes; 69 | }; 70 | 71 | } // namespace wvWare 72 | 73 | #endif // HEADERS_H 74 | -------------------------------------------------------------------------------- /src/wv2version.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2003 Calligra Team 3 | Copyright (C) 2003 Werner Trobin 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License version 2 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #ifndef WV2_VERSION_H 21 | #define WV2_VERSION_H 22 | 23 | // NOTE: Obsolete 24 | 25 | #define WV2_VERSION_STRING "0.4.2" 26 | #define WV2_VERSION_MAJOR 0 27 | #define WV2_VERSION_MINOR 4 28 | #define WV2_VERSION_RELEASE 2 29 | #define WV2_MAKE_VERSION( a, b, c ) ( ( ( a ) << 16 ) | ( ( b ) << 8 ) | ( c ) ) 30 | 31 | #define WV2_VERSION \ 32 | WV2_MAKE_VERSION( WV2_VERSION_MAJOR, WV2_VERSION_MINOR, WV2_VERSION_RELEASE ) 33 | 34 | #define WV2_IS_VERSION( a, b, c ) ( WV2_VERSION >= WV2_MAKE_VERSION( a, b, c ) ) 35 | 36 | namespace wvWare 37 | { 38 | /** 39 | * Returns the encoded number of wv2's version, see the WV2_VERSION macro. 40 | * In contrary to that macro this function returns the number of the actually 41 | * installed wv2 version, not the number of the wv2 version that was 42 | * installed when the program was compiled. 43 | * @return the version number, encoded in a single uint 44 | */ 45 | unsigned int version(); 46 | /** 47 | * Returns the major number of wv2's version, e.g. 48 | * 0 for wv2 0.2.5. 49 | * @return the major version number 50 | */ 51 | unsigned int versionMajor(); 52 | /** 53 | * Returns the minor number of wv2's version, e.g. 54 | * 2 for wv2 0.2.5. 55 | * @return the minor version number 56 | */ 57 | unsigned int versionMinor(); 58 | /** 59 | * Returns the release of wv2's version, e.g. 60 | * 5 for wv2 0.2.5. 61 | * @return the release number 62 | */ 63 | unsigned int versionRelease(); 64 | /** 65 | * Returns the wv2 version as string, e.g. "0.2.5". 66 | * @return the wv2 version. You can keep the string forever 67 | */ 68 | const char *versionString(); 69 | } 70 | 71 | #endif // WV2_VERSION_H 72 | -------------------------------------------------------------------------------- /src/paragraphproperties.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef PARAGRAPHPROPERTIES_H 20 | #define PARAGRAPHPROPERTIES_H 21 | 22 | #include "word97_generated.h" 23 | #include "wv2_export.h" 24 | 25 | namespace wvWare 26 | { 27 | 28 | class ListInfo; 29 | class ListInfoProvider; 30 | 31 | /** 32 | * A tiny helper class to wrap the PAP and any additional information 33 | * we want to pass to the consumer. Right now we have a ListInfo object 34 | * if the paragraph belongs to some list. 35 | */ 36 | class WV2_EXPORT ParagraphProperties : public Shared 37 | { 38 | public: 39 | ParagraphProperties(); 40 | explicit ParagraphProperties( const Word97::PAP& pap ); 41 | ParagraphProperties( const ParagraphProperties& rhs ); 42 | ~ParagraphProperties(); 43 | 44 | Word97::PAP& pap(); 45 | const Word97::PAP& pap() const; 46 | /** 47 | * If this paragraph belongs to a list, the ListInfo object will be 48 | * valid and contain useful information about the formatting of the 49 | * list counter. @return 0 if the paragraph is not inside of a list 50 | */ 51 | const ListInfo* listInfo() const; 52 | 53 | /** 54 | * Set the name of the bullet picture into ListInfo. 55 | */ 56 | void setBulletPictureName(const QString& name); 57 | 58 | /** 59 | * @internal 60 | * @param list info provider 61 | * @param pragraph mark's CHPs 62 | */ 63 | void createListInfo( ListInfoProvider& listInfoProvider, Word97::CHP& chp ); 64 | 65 | private: 66 | ParagraphProperties& operator=( const ParagraphProperties& rhs ); 67 | 68 | Word97::PAP m_pap; 69 | ListInfo* m_listInfo; 70 | }; 71 | 72 | } // namespace wvWare 73 | 74 | #endif // PARAGRAPHPROPERTIES_H 75 | -------------------------------------------------------------------------------- /fox_xmlsession.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // Transform a doc word document to xml 3 | // to get only target propriety no image or other 4 | // Author: Peter Hohl , 24.10.2013 5 | // http://www.freeroad.ch/ 6 | // Copyright: See COPYING file that comes with this distribution 7 | 8 | 9 | #include "fox_xmlsession.h" 10 | 11 | using namespace FOX; 12 | 13 | XmlSession *XmlSession::theInstance; 14 | 15 | XmlSession* XmlSession::self() { 16 | if (!theInstance) { 17 | theInstance = new XmlSession(); 18 | } 19 | return theInstance; 20 | } 21 | 22 | QDomDocument XmlSession::doc() { 23 | return wv2dom; 24 | } 25 | 26 | XmlSession::XmlSession() { 27 | this->base_header(); 28 | cur_len = -1; 29 | } 30 | 31 | void XmlSession::base_header() { 32 | 33 | QDomProcessingInstruction header = wv2dom.createProcessingInstruction("xml", QString("version=\"1.0\" encoding=\"utf-8\"")); 34 | wv2dom.appendChild(header); 35 | DCroot = wv2dom.createElement(NSPREFIXDOC + QString("root")); 36 | DCroot.setAttribute("xmlns:fox", "http://xmlgraphics.apache.org/fop/extensions"); 37 | DCroot.setAttribute("xmlns:cms", "http://www.freeroad.ch/2013/CMSFormat"); 38 | DCroot.setAttribute("xmlns:svg", "http://www.w3.org/2000/svg"); 39 | DCroot.setAttribute("xmlns:fo", "http://www.w3.org/1999/XSL/Format"); 40 | wv2dom.appendChild(DCroot); 41 | //// XMLBEEP() << " header: " << wv2dom.toString(5); 42 | } 43 | 44 | void XmlSession::report(const QString msg, const int position) { 45 | QDomElement head = XmlSession::self()->doc().documentElement().firstChild().toElement(); 46 | if (!head.isNull() && reportonxml == 1) { 47 | QDomElement error = wv2dom.createElement(NSPREFIXDOC + QString("error")); 48 | error.setAttribute("line", position); 49 | error.setAttribute("msg", msg); 50 | head.appendChild(error); 51 | } 52 | } 53 | 54 | XmlSession::~XmlSession() { 55 | 56 | } 57 | 58 | QDomText XmlSession::createTextNode(const QString txt) { 59 | return wv2dom.createTextNode(txt); 60 | } 61 | 62 | QDomElement XmlSession::createtag(const QString tagname) { 63 | QDomElement htag; 64 | if (tagname.length() > 1) { 65 | cur_len++; 66 | QString part = tagname.mid(0, 2); 67 | part.append("-"); 68 | part.append(QString::number(cur_len)); 69 | htag = wv2dom.createElement(NSPREFIXDOC + tagname); 70 | htag.setAttribute("id", part); 71 | } 72 | return htag; 73 | } 74 | 75 | QDomElement XmlSession::createDtext(const QString txt, const QString tagname) { 76 | QDomElement rnode = this->createtag(tagname); 77 | QDomText liatext = this->createTextNode(txt); 78 | rnode.appendChild(liatext); 79 | return rnode; 80 | } -------------------------------------------------------------------------------- /src/associatedstrings.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002, 2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "associatedstrings.h" 20 | #include "ustring.h" 21 | #include "olestream.h" 22 | #include "word_helper.h" 23 | #include "wvlog.h" 24 | 25 | using namespace wvWare; 26 | 27 | AssociatedStrings::AssociatedStrings( U32 fcSttbfAssoc, U32 lcbSttbfAssoc, U16 lid, OLEStreamReader* tableStream ) : 28 | m_sttbf( 0 ) 29 | { 30 | tableStream->push(); 31 | tableStream->seek( fcSttbfAssoc ); 32 | m_sttbf = new STTBF( lid, tableStream ); 33 | if ( tableStream->tell() - fcSttbfAssoc != lcbSttbfAssoc ) 34 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<__FILE__ << ":" << __LINE__ << " - " << "Warning: Associated strings have a different size than expected!" << endl; 35 | tableStream->pop(); 36 | } 37 | 38 | AssociatedStrings::AssociatedStrings( const AssociatedStrings& rhs ) : 39 | m_sttbf( new STTBF( *rhs.m_sttbf ) ) 40 | { 41 | } 42 | 43 | AssociatedStrings::~AssociatedStrings() 44 | { 45 | delete m_sttbf; 46 | } 47 | 48 | UString AssociatedStrings::associatedTemplate() const 49 | { 50 | return m_sttbf->stringAt( 1 ); 51 | } 52 | 53 | UString AssociatedStrings::title() const 54 | { 55 | return m_sttbf->stringAt( 2 ); 56 | } 57 | 58 | UString AssociatedStrings::subject() const 59 | { 60 | return m_sttbf->stringAt( 3 ); 61 | } 62 | 63 | UString AssociatedStrings::keywords() const 64 | { 65 | return m_sttbf->stringAt( 4 ); 66 | } 67 | 68 | UString AssociatedStrings::comments() const 69 | { 70 | return m_sttbf->stringAt( 5 ); 71 | } 72 | 73 | UString AssociatedStrings::author() const 74 | { 75 | return m_sttbf->stringAt( 6 ); 76 | } 77 | 78 | UString AssociatedStrings::lastRevBy() const 79 | { 80 | return m_sttbf->stringAt( 7 ); 81 | } 82 | 83 | UString AssociatedStrings::dataDocument() const 84 | { 85 | return m_sttbf->stringAt( 8 ); 86 | } 87 | 88 | UString AssociatedStrings::headerDocument() const 89 | { 90 | return m_sttbf->stringAt( 9 ); 91 | } 92 | -------------------------------------------------------------------------------- /src/annotations.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef ANNOTATIONS_H 20 | #define ANNOTATIONS_H 21 | 22 | #include "global.h" 23 | #include "functordata.h" 24 | 25 | #include 26 | #include "wv2_export.h" 27 | 28 | namespace wvWare 29 | { 30 | namespace Word97 31 | { 32 | struct FIB; 33 | struct FRD; 34 | } 35 | template class PLCF; 36 | template class PLCFIterator; 37 | class OLEStreamReader; 38 | struct AnnotationData; 39 | 40 | /** 41 | * @internal 42 | */ 43 | class Annotations 44 | { 45 | public: 46 | Annotations( OLEStreamReader* tableStream, const Word97::FIB& fib ); 47 | ~Annotations(); 48 | 49 | /** 50 | * Get the AnnotationData for the Annotation at @param globalCP. 51 | * The @param ok flag is true if a Annotation has been found. 52 | * If @param ok is false no Annotation has been found and the 53 | * returned AnnotationData structure is invalid. 54 | */ 55 | AnnotationData annotation( U32 globalCP, bool& ok ); 56 | 57 | /** 58 | * Returns the global CP of the next Annotation reference, 59 | * 0xffffffff if none exists. 60 | */ 61 | U32 nextAnnotation() const; 62 | 63 | private: 64 | Annotations( const Annotations& rhs ); 65 | Annotations& operator=( const Annotations& rhs ); 66 | 67 | // Ugly, but helps to avoid code duplication 68 | void init( U32 fcRef, U32 lcbRef, U32 fcTxt, U32 lcbTxt, OLEStreamReader* tableStream, 69 | PLCF** ref, PLCFIterator** refIt, 70 | std::vector& txt, std::vector::const_iterator& txtIt ); 71 | 72 | PLCF* m_annotationRef; 73 | PLCFIterator* m_annotationRefIt; 74 | std::vector m_annotationTxt; 75 | std::vector::const_iterator m_annotationTxtIt; 76 | 77 | }; 78 | 79 | } // namespace wvWare 80 | 81 | #endif // ANNOTATIONS_H 82 | -------------------------------------------------------------------------------- /Sandcastle5/fox_office/foxpdf_handler.h: -------------------------------------------------------------------------------- 1 | // 2 | // C++ Implementation: FOXDocument Reading valid Office (OpenFormat) Document on QBuffer 3 | // to convert html,xhtml Target read fast & simple mail attachment or display doc on 4 | // QWebView or drupal cms.Idea from Calligra, Scribus, KDE libs, Okular, Miniscribus 5 | // 6 | // My Miniscribus from 2008 give me so many idea to render template & invoice an documents. 7 | // XSL Formatting Objects markup language WYSIWYG editor (xsl-fo). 8 | // Formatting Objects Processor (FOP, also known as Apache FOP) xml to pdf. 9 | // Apache FOP have the capacity to render document like AI illustrator and can live on 10 | // web server or office nice work.. 11 | // Apache FOP XML document formatting which is most often used to generate PDFs or 12 | // professional document, books pdf forms to post , and many other nice document. 13 | // My big 2° app XHTML Wysiwyg Editor is qxhtml-edit https://code.google.com/p/qxhtml-edit/ 14 | // Ref. WYSIWYG Miniscribus https://code.google.com/p/fop-miniscribus/ 2008 code.. 15 | // more as 25'000 download on google code sourceforge ecc.. 16 | // 17 | // Any help to convert document symply & easy is appreciated, but not long loading time. 18 | // If QWebView can rotate div layer and support the new css standard ok, lets rock xhtml.. 19 | // 20 | // Note on PDF Format: 21 | // javascript convert pdf! yes :-) if QWebView can display this like Google Chrome 22 | // And render openfont format this is the future... I love progress ... without wasting precious time.. 23 | // http://mozilla.github.io/pdf.js/web/viewer.html 24 | // ok.. this is ok javascript vs. pdf poppler. 25 | // 26 | // Author: Peter Hohl , 24.10.2013 27 | // http://www.freeroad.ch/ 28 | // Copyright: See COPYING file that comes with this distribution 29 | // latest update here 8.12.2013 30 | 31 | #ifndef PDFHTML_H 32 | #define PDFHTML_H 33 | 34 | #include "fox_base.h" 35 | #include "wv5qt/kzip.h" 36 | 37 | 38 | namespace PDF { 39 | 40 | class HtmlDocument : public DObject { 41 | public: 42 | HtmlDocument(const QString docfilename); 43 | 44 | bool isValid() { 45 | return is_loading; 46 | } 47 | 48 | QString lastError() { 49 | return LASTERRORMSG; 50 | } 51 | 52 | QString onfile() { 53 | return lastreturnfile_html; 54 | } 55 | 56 | QString Html_UTF8() { 57 | return HTMLSTREAM; 58 | } 59 | 60 | virtual ~HtmlDocument(); 61 | private: 62 | bool is_loading; 63 | void ScanImageHtml(); // on html insert image 64 | void ScannerImage(); /// on cache dir read image 65 | QByteArray picitem(const QString archive); 66 | QString EmbeddedImage(const QString key); 67 | QMap pdfimagelist; 68 | QString HTMLSTREAM; 69 | QString XMLSTREAM; 70 | QString lastreturnfile_html; 71 | QString LASTERRORMSG; 72 | }; 73 | 74 | 75 | } 76 | 77 | 78 | 79 | #endif /* PDFHTML_H */ 80 | 81 | -------------------------------------------------------------------------------- /src/convert.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | // This code is generated from the Microsoft HTML specification of the 20 | // WinWord format. Do NOT edit this code, but fix the spec or the script 21 | // generating the sources. 22 | // For information about the script and the "hidden features" please read 23 | // the comments at the begin of the script. 24 | 25 | // If you find bugs or strange behavior please contact Werner Trobin 26 | // 27 | 28 | #ifndef CONVERT_H 29 | #define CONVERT_H 30 | 31 | #include 32 | #include 33 | #include "wv2_export.h" 34 | 35 | namespace wvWare { 36 | 37 | namespace Word95 { 38 | 39 | // This has been added to the template file, as the mapping is 40 | // non-trivial. Shaheed: Please check the implementation 41 | Word97::BRC toWord97(const Word95::BRC &s); 42 | Word97::STSHI toWord97(const Word95::STSHI &s); 43 | 44 | Word97::ANLD toWord97(const Word95::ANLD &s); 45 | Word97::ANLV toWord97(const Word95::ANLV &s); 46 | Word97::BKF toWord97(const Word95::BKF &s); 47 | Word97::BKL toWord97(const Word95::BKL &s); 48 | Word97::BRC10 toWord97(const Word95::BRC10 &s); 49 | Word97::BTE toWord97(const Word95::BTE &s); 50 | Word97::CHP toWord97(const Word95::CHP &s); 51 | Word97::DCS toWord97(const Word95::DCS &s); 52 | Word97::DOP toWord97(const Word95::DOP &s); 53 | Word97::DTTM toWord97(const Word95::DTTM &s); 54 | Word97::FIB toWord97(const Word95::FIB &s); 55 | Word97::LSPD toWord97(const Word95::LSPD &s); 56 | Word97::METAFILEPICT toWord97(const Word95::METAFILEPICT &s); 57 | Word97::OBJHEADER toWord97(const Word95::OBJHEADER &s); 58 | Word97::OLST toWord97(const Word95::OLST &s); 59 | Word97::PAP toWord97(const Word95::PAP &s); 60 | Word97::PCD toWord97(const Word95::PCD &s); 61 | Word97::PHE toWord97(const Word95::PHE &s); 62 | Word97::PICF toWord97(const Word95::PICF &s); 63 | Word97::PRM toWord97(const Word95::PRM &s); 64 | Word97::PRM2 toWord97(const Word95::PRM2 &s); 65 | Word97::SED toWord97(const Word95::SED &s); 66 | Word97::SEP toWord97(const Word95::SEP &s); 67 | Word97::SHD toWord97(const Word95::SHD &s); 68 | Word97::TAP toWord97(const Word95::TAP &s); 69 | Word97::TC toWord97(const Word95::TC &s); 70 | Word97::TLP toWord97(const Word95::TLP &s); 71 | 72 | } // namespace Word95 73 | 74 | } // namespace wvWare 75 | 76 | #endif // CONVERT_H 77 | -------------------------------------------------------------------------------- /Sandcastle5/fox_office/foxdocx_handler.h: -------------------------------------------------------------------------------- 1 | // 2 | // C++ Implementation: FOXDocument Reading valid Office (OpenFormat) Document on QBuffer 3 | // to convert html,xhtml Target read fast & simple mail attachment or display doc on 4 | // QWebView or drupal cms.Idea from Calligra, Scribus, KDE libs, Okular, Miniscribus 5 | // 6 | // My Miniscribus from 2008 give me so many idea to render template & invoice an documents. 7 | // XSL Formatting Objects markup language WYSIWYG editor (xsl-fo). 8 | // Formatting Objects Processor (FOP, also known as Apache FOP) xml to pdf. 9 | // Apache FOP have the capacity to render document like AI illustrator and can live on 10 | // web server or office nice work.. 11 | // Apache FOP XML document formatting which is most often used to generate PDFs or 12 | // professional document, books pdf forms to post , and many other nice document. 13 | // My big 2° app XHTML Wysiwyg Editor is qxhtml-edit https://code.google.com/p/qxhtml-edit/ 14 | // Ref. WYSIWYG Miniscribus https://code.google.com/p/fop-miniscribus/ 2008 code.. 15 | // more as 25'000 download on google code sourceforge ecc.. 16 | // 17 | // Any help to convert document symply & easy is appreciated, but not long loading time. 18 | // If QWebView can rotate div layer and support the new css standard ok, lets rock xhtml.. 19 | // 20 | // Note on PDF Format: 21 | // javascript convert pdf! yes :-) if QWebView can display this like Google Chrome 22 | // And render openfont format this is the future... I love progress ... without wasting precious time.. 23 | // http://mozilla.github.io/pdf.js/web/viewer.html 24 | // ok.. this is ok javascript vs. pdf poppler. 25 | // 26 | // Author: Peter Hohl , 24.10.2013 27 | // http://www.freeroad.ch/ 28 | // Copyright: See COPYING file that comes with this distribution 29 | // latest update here 8.12.2013 30 | 31 | #ifndef DOCXZIP_H 32 | #define DOCXZIP_H 33 | 34 | #include "fox_base.h" 35 | #include "wv5qt/kzip.h" 36 | 37 | 38 | 39 | 40 | namespace DOCX { 41 | 42 | class HtmlDocument : public DObject { 43 | public: 44 | HtmlDocument(const QString docfilename , bool bypasscontroll = false ); 45 | QString Html_UTF8(); 46 | 47 | bool load() { 48 | return (HTMLSTREAM.size() > 0)? true : false; 49 | } 50 | QString onfile() { 51 | return lastreturnfile_html; 52 | } 53 | 54 | bool isValid() { 55 | return (HTMLSTREAM.size() > 0)? true : false; 56 | } 57 | 58 | QString lastError() { 59 | return LASTERRORMSG; 60 | } 61 | 62 | virtual ~HtmlDocument(); 63 | private: 64 | QByteArray docitem(const QString archive); 65 | bool docx_validator(const QStringList entries); 66 | void scanimage(); 67 | QString read_docx_index(QByteArray xml, int findertype, const QString Xid); 68 | QMap corefile; 69 | QString HTMLSTREAM; 70 | QString lastreturnfile_html; 71 | QString LASTERRORMSG; 72 | bool bypass_validate; 73 | bool having_image_dir_zip; 74 | 75 | }; 76 | 77 | } 78 | 79 | #endif /* DOCXZIP_H */ 80 | 81 | -------------------------------------------------------------------------------- /src/fields.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef FIELDS_H 20 | #define FIELDS_H 21 | 22 | #include "parser.h" 23 | #include "wv2_export.h" 24 | 25 | namespace wvWare 26 | { 27 | namespace Word97 28 | { 29 | struct FIB; 30 | } 31 | template class PLCF; 32 | template class PLCFMap; 33 | class OLEStreamReader; 34 | 35 | struct FLD 36 | { 37 | FLD(); 38 | FLD( OLEStreamReader* stream, bool preservePos = false ); 39 | FLD( const U8* ptr ); 40 | 41 | bool read( OLEStreamReader* stream, bool preservePos = false ); 42 | bool readPtr( const U8* ptr ); 43 | 44 | void clear(); 45 | 46 | // Data 47 | U8 ch; 48 | union 49 | { 50 | U8 flt; 51 | struct 52 | { 53 | U8 fDiffer:1; 54 | U8 fZombieEmbed:1; 55 | U8 fResultDirty:1; 56 | U8 fResultEdited:1; 57 | U8 fLocked:1; 58 | U8 fPrivateResult:1; 59 | U8 fNested:1; 60 | U8 fHasSep:1; 61 | } flags; 62 | }; 63 | 64 | // Size of the structure (needed for the PLCF template) 65 | static const unsigned int sizeOf; 66 | }; 67 | 68 | bool operator==( const FLD &lhs, const FLD &rhs ); 69 | bool operator!=( const FLD &lhs, const FLD &rhs ); 70 | 71 | 72 | class Fields 73 | { 74 | public: 75 | Fields( OLEStreamReader* tableStream, const Word97::FIB& fib ); 76 | ~Fields(); 77 | 78 | const FLD* fldForCP( Parser::SubDocument subDocument, U32 cp ) const; 79 | 80 | private: 81 | Fields( const Fields& rhs ); 82 | Fields& operator=( const Fields& rhs ); 83 | 84 | void read( U32 fc, U32 lcb, OLEStreamReader* tableStream, PLCFMap** plcf ); 85 | void sanityCheck( const OLEStreamReader* tableStream, U32 nextFC, U32 lcb ) const; 86 | const FLD* fldForCP( const PLCFMap* plcf, U32 cp ) const; 87 | 88 | PLCFMap* m_main; 89 | PLCFMap* m_header; 90 | PLCFMap* m_footnote; 91 | PLCFMap* m_annotation; 92 | PLCFMap* m_endnote; 93 | PLCFMap* m_textbox; 94 | PLCFMap* m_headerTextbox; 95 | PLCFMap* m_bookmark; 96 | }; 97 | 98 | } // namespace wvWare 99 | 100 | #endif // FIELDS_H 101 | -------------------------------------------------------------------------------- /src/associatedstrings.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002, 2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the Library GNU General Public 6 | version 2 of the License, or (at your option) version 3 or, 7 | at the discretion of KDE e.V (which shall act as a proxy as in 8 | section 14 of the GPLv3), any later version.. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public License 16 | along with this library; see the file COPYING.LIB. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 | Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #ifndef ASSOCSTRINGS_H 22 | #define ASSOCSTRINGS_H 23 | 24 | #include "global.h" 25 | #include "wv2_export.h" 26 | 27 | namespace wvWare 28 | { 29 | class OLEStreamReader; 30 | class STTBF; 31 | class UString; 32 | 33 | /** 34 | * AssociatedStrings provides a confortable way to access Word's STTBFASSOC, 35 | * the table of associated strings. This table holds information about the 36 | * author of the document, the tile, keywords, and so on. 37 | */ 38 | class WV2_EXPORT AssociatedStrings 39 | { 40 | public: 41 | /** 42 | * You shouldn't have to create such an object yourself, the Parser provides 43 | * it. 44 | */ 45 | AssociatedStrings( U32 fcSttbfAssoc, U32 lcbSttbfAssoc, U16 lid, OLEStreamReader* tableStream ); 46 | AssociatedStrings( const AssociatedStrings& rhs ); 47 | ~AssociatedStrings(); 48 | 49 | /** 50 | * Provides access to the string described as ibstAssocDot 51 | */ 52 | UString associatedTemplate() const; 53 | /** 54 | * Provides access to the string described as ibstAssocTitle 55 | */ 56 | UString title() const; 57 | /** 58 | * Provides access to the string described as ibstAssocSubject 59 | */ 60 | UString subject() const; 61 | /** 62 | * Provides access to the string described as ibstAssocKeyWords 63 | */ 64 | UString keywords() const; 65 | /** 66 | * Provides access to the string described as ibstAssocComments 67 | */ 68 | UString comments() const; 69 | /** 70 | * Provides access to the string described as ibstAssocAuthor 71 | */ 72 | UString author() const; 73 | /** 74 | * Provides access to the string described as ibstAssocLastRevBy 75 | */ 76 | UString lastRevBy() const; 77 | /** 78 | * Provides access to the string described as ibstAssocDataDoc 79 | */ 80 | UString dataDocument() const; 81 | /** 82 | * Provides access to the string described as ibstAssocHeaderDoc 83 | */ 84 | UString headerDocument() const; 85 | 86 | private: 87 | AssociatedStrings& operator=( const AssociatedStrings& rhs ); 88 | 89 | STTBF* m_sttbf; 90 | }; 91 | 92 | } // namespace wvWare 93 | 94 | #endif // ASSOCSTRINGS_H 95 | -------------------------------------------------------------------------------- /src/generator/template-conv.cpp: -------------------------------------------------------------------------------- 1 | ### As you recognized already, "###" at the begin of a line 2 | ### marks a comment. 3 | 4 | ### Everything between start and end will be put into the file 5 | @@license-start@@ 6 | /* This file is part of the wvWare 2 project 7 | Copyright (C) 2001 Werner Trobin 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Library General Public 11 | License version 2 as published by the Free Software Foundation. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Library General Public License for more details. 17 | 18 | You should have received a copy of the GNU Library General Public License 19 | along with this library; see the file COPYING.LIB. If not, write to 20 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | Boston, MA 02111-1307, USA. 22 | */ 23 | 24 | // This code is generated from the Microsoft HTML specification of the 25 | // WinWord format. Do NOT edit this code, but fix the spec or the script 26 | // generating the sources. If you want to add some additional code, some 27 | // includes or any other stuff, please add it to the template file! 28 | // For information about the script and the "hidden features" please read 29 | // the comments at the begin of the script. 30 | 31 | // If you find bugs or strange behavior please contact Werner Trobin 32 | // 33 | @@license-end@@ 34 | 35 | ### Everything between @@includes-start@@ and -end will be added to 36 | ### the generated includes (e.g. "#include ") 37 | @@includes-start@@ 38 | ####include // test 39 | @@includes-end@@ 40 | 41 | ### These are the "borders" of the namespace (e.g. namespace Word97 { .. }) 42 | ### Everything you add in here will be added to the generated code 43 | @@namespace-start@@ 44 | ### nothing 45 | 46 | // This has been added to the template file, as the mapping is 47 | // non-trivial. Shaheed: Please check the implementation 48 | Word97::BRC toWord97(const Word95::BRC &s) { 49 | 50 | Word97::BRC ret; 51 | 52 | // Check the BRC documentation 53 | if ( s.dxpLineWidth < 6 ) { 54 | ret.dptLineWidth = s.dxpLineWidth * 6; 55 | ret.brcType = s.brcType; 56 | } 57 | else if ( s.dxpLineWidth == 6 ) { 58 | ret.dptLineWidth = 6; // what's the default? 59 | ret.brcType = 6; // dotted 60 | } 61 | else { // s.dxpLineWidth == 7 62 | ret.dptLineWidth = 6; // what's the default? 63 | ret.brcType = 7; 64 | } 65 | ret.fShadow = s.fShadow; 66 | ret.ico = s.ico; 67 | ret.dptSpace = s.dxpSpace; 68 | return ret; 69 | } 70 | 71 | Word97::STSHI toWord97(const Word95::STSHI &s) 72 | { 73 | Word97::STSHI ret; 74 | 75 | ret.cstd=s.cstd; 76 | ret.cbSTDBaseInFile=s.cbSTDBaseInFile; 77 | ret.fStdStylenamesWritten=s.fStdStylenamesWritten; 78 | ret.unused4_2=s.unused4_2; 79 | ret.stiMaxWhenSaved=s.stiMaxWhenSaved; 80 | ret.istdMaxFixedWhenSaved=s.istdMaxFixedWhenSaved; 81 | ret.nVerBuiltInNamesWhenSaved=s.nVerBuiltInNamesWhenSaved; 82 | ret.rgftcStandardChpStsh[0]=s.ftcStandardChpStsh; 83 | ret.rgftcStandardChpStsh[1]=s.ftcStandardChpStsh; // fake them 84 | ret.rgftcStandardChpStsh[2]=s.ftcStandardChpStsh; // fake them 85 | 86 | return ret; 87 | } 88 | ### This tag "expands" to all the structs :) 89 | @@generated-code@@ 90 | ### nothing 91 | @@namespace-end@@ 92 | -------------------------------------------------------------------------------- /src/footnotes97.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | Copyright (C) 2011 Matus Uzak 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License version 2 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #ifndef FOOTNOTES97_H 21 | #define FOOTNOTES97_H 22 | 23 | #include "global.h" 24 | #include "functordata.h" 25 | 26 | #include 27 | #include "wv2_export.h" 28 | 29 | namespace wvWare 30 | { 31 | namespace Word97 32 | { 33 | struct FIB; 34 | struct FRD; 35 | } 36 | template class PLCF; 37 | template class PLCFIterator; 38 | class OLEStreamReader; 39 | struct FootnoteData; 40 | 41 | /** 42 | * @internal 43 | */ 44 | class Footnotes97 45 | { 46 | public: 47 | Footnotes97( OLEStreamReader* tableStream, const Word97::FIB& fib ); 48 | ~Footnotes97(); 49 | 50 | /** 51 | * Get the FootnoteData for the footnote/endnote at @param globalCP. 52 | * The @param ok flag is true if a footnote/endnote has been found. 53 | * If @param ok is false no footnote/endnote has been found and the 54 | * returned FootnoteData structure is invalid. 55 | */ 56 | FootnoteData footnote( U32 globalCP, bool& ok ); 57 | 58 | /** 59 | * Returns the global CP of the next footnote reference, 60 | * 0xffffffff if none exists. 61 | */ 62 | U32 nextFootnote() const; 63 | /** 64 | * Returns the global CP of the next endnote reference, 65 | * 0xffffffff if none exists. 66 | */ 67 | U32 nextEndnote() const; 68 | 69 | /** 70 | * Check for unprocessed footnotes/endnotes located before @param 71 | * globalCP. This might be the result of a skipped chunk or 72 | * overlapping. Any unprocessed footnotes/endnotes are skipped. 73 | */ 74 | void check( U32 globalCP ); 75 | 76 | private: 77 | Footnotes97( const Footnotes97& rhs ); 78 | Footnotes97& operator=( const Footnotes97& rhs ); 79 | 80 | // Ugly, but helps to avoid code duplication 81 | void init( U32 fcRef, U32 lcbRef, U32 fcTxt, U32 lcbTxt, OLEStreamReader* tableStream, 82 | PLCF** ref, PLCFIterator** refIt, 83 | std::vector& txt, std::vector::const_iterator& txtIt ); 84 | 85 | PLCF* m_footnoteRef; 86 | PLCFIterator* m_footnoteRefIt; 87 | std::vector m_footnoteTxt; 88 | std::vector::const_iterator m_footnoteTxtIt; 89 | 90 | PLCF* m_endnoteRef; 91 | PLCFIterator* m_endnoteRefIt; 92 | std::vector m_endnoteTxt; 93 | std::vector::const_iterator m_endnoteTxtIt; 94 | }; 95 | 96 | } // namespace wvWare 97 | 98 | #endif // FOOTNOTES97_H 99 | -------------------------------------------------------------------------------- /src/parser.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the Library GNU General Public 6 | version 2 of the License, or (at your option) version 3 or, 7 | at the discretion of KDE e.V (which shall act as a proxy as in 8 | section 14 of the GPLv3), any later version.. 9 | 10 | This library is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 | Library General Public License for more details. 14 | 15 | You should have received a copy of the GNU Library General Public License 16 | along with this library; see the file COPYING.LIB. If not, write to 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 18 | Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | #include "parser.h" 22 | #include "olestream.h" 23 | #include "handlers.h" 24 | 25 | using namespace wvWare; 26 | 27 | Parser::Parser( OLEStorage* storage, OLEStreamReader* wordDocument ) : 28 | m_inlineHandler( new InlineReplacementHandler ), m_subDocumentHandler( new SubDocumentHandler ), 29 | m_tableHandler( new TableHandler ), m_textHandler( new TextHandler ), 30 | m_graphicsHandler( new GraphicsHandler ), m_ourInlineHandler( true ), 31 | m_ourSubDocumentHandler( true ), m_ourTableHandler( true ), 32 | m_ourTextHandler( true ), m_ourGraphicsHandler ( true ), m_storage( storage ), 33 | m_wordDocument( wordDocument ), m_okay( true ) 34 | { 35 | if ( !storage || !wordDocument ) { 36 | m_okay = false; 37 | return; 38 | } 39 | 40 | // Let the "real" constructor find out which additional 41 | // streams it needs, as only it knows the FIB! 42 | } 43 | 44 | Parser::~Parser() 45 | { 46 | // In case we're still using the default handlers we have 47 | // to clean them up. Messy, but we shouldn't use some smart 48 | // pointer here, as it's very restrictive for the user of 49 | // this library (std::auto_ptr would make it impossible to 50 | // use MI, SharedPtr would potentially lead to circular references). 51 | if ( m_ourInlineHandler ) 52 | delete m_inlineHandler; 53 | if ( m_ourSubDocumentHandler ) 54 | delete m_subDocumentHandler; 55 | if ( m_ourTableHandler ) 56 | delete m_tableHandler; 57 | if ( m_ourTextHandler ) 58 | delete m_textHandler; 59 | if( m_ourGraphicsHandler) 60 | delete m_graphicsHandler; 61 | 62 | // Don't forget to close everything properly here 63 | delete m_wordDocument; 64 | m_storage->close(); 65 | delete m_storage; 66 | } 67 | 68 | void Parser::setInlineReplacementHandler( InlineReplacementHandler* handler ) 69 | { 70 | setHandler( handler, &m_inlineHandler, m_ourInlineHandler ); 71 | } 72 | 73 | void Parser::setSubDocumentHandler( SubDocumentHandler* handler ) 74 | { 75 | setHandler( handler, &m_subDocumentHandler, m_ourSubDocumentHandler ); 76 | } 77 | 78 | void Parser::setTableHandler( TableHandler* handler ) 79 | { 80 | setHandler( handler, &m_tableHandler, m_ourTableHandler ); 81 | } 82 | 83 | void Parser::setTextHandler( TextHandler* handler ) 84 | { 85 | setHandler( handler, &m_textHandler, m_ourTextHandler ); 86 | } 87 | 88 | void Parser::setGraphicsHandler( GraphicsHandler* handler ) 89 | { 90 | setHandler( handler, &m_graphicsHandler, m_ourGraphicsHandler ); 91 | } 92 | -------------------------------------------------------------------------------- /Sandcastle5/fox_office/foxodt_handler.h: -------------------------------------------------------------------------------- 1 | // 2 | // C++ Implementation: FOXDocument Reading valid Office (OpenFormat) Document on QBuffer 3 | // to convert html,xhtml Target read fast & simple mail attachment or display doc on 4 | // QWebView or drupal cms.Idea from Calligra, Scribus, KDE libs, Okular, Miniscribus 5 | // 6 | // My Miniscribus from 2008 give me so many idea to render template & invoice an documents. 7 | // XSL Formatting Objects markup language WYSIWYG editor (xsl-fo). 8 | // Formatting Objects Processor (FOP, also known as Apache FOP) xml to pdf. 9 | // Apache FOP have the capacity to render document like AI illustrator and can live on 10 | // web server or office nice work.. 11 | // Apache FOP XML document formatting which is most often used to generate PDFs or 12 | // professional document, books pdf forms to post , and many other nice document. 13 | // My big 2° app XHTML Wysiwyg Editor is qxhtml-edit https://code.google.com/p/qxhtml-edit/ 14 | // Ref. WYSIWYG Miniscribus https://code.google.com/p/fop-miniscribus/ 2008 code.. 15 | // more as 25'000 download on google code sourceforge ecc.. 16 | // 17 | // Any help to convert document symply & easy is appreciated, but not long loading time. 18 | // If QWebView can rotate div layer and support the new css standard ok, lets rock xhtml.. 19 | // 20 | // Note on PDF Format: 21 | // javascript convert pdf! yes :-) if QWebView can display this like Google Chrome 22 | // And render openfont format this is the future... I love progress ... without wasting precious time.. 23 | // http://mozilla.github.io/pdf.js/web/viewer.html 24 | // ok.. this is ok javascript vs. pdf poppler. 25 | // 26 | // Author: Peter Hohl , 24.10.2013 27 | // http://www.freeroad.ch/ 28 | // Copyright: See COPYING file that comes with this distribution 29 | // latest update here 8.12.2013 30 | 31 | //// memo union xml file http://sourceforge.net/p/qtexcel-xslt/code/HEAD/tree/_odbc_wizard/browser.cpp#l615 32 | 33 | #ifndef ODTZIP_H 34 | #define ODTZIP_H 35 | 36 | #include "fox_base.h" 37 | #include "wv5qt/kzip.h" 38 | 39 | #if 0 //// 1 or 0 40 | #define OOBEEB qDebug 41 | #else 42 | #define OOBEEB if (0) qDebug 43 | #endif 44 | 45 | namespace OASI5 { 46 | 47 | 48 | /// xml inside a calc table or draw ??? 49 | #define MARKEROBJECT \ 50 | QString("/fo:item/fo:") 51 | 52 | #define TAGNAMEITEM \ 53 | QString("item") 54 | 55 | 56 | class HtmlDocument : public DObject { 57 | public: 58 | HtmlDocument(const QString odtfile); 59 | 60 | bool isValid() { 61 | return (FULLHTMLBODY.size() > 0) ? true : false; 62 | } 63 | QString onfile() { 64 | return lastreturnfile_html; 65 | } 66 | 67 | QString lastError() { 68 | return LASTERRORMSG; 69 | } 70 | 71 | QString Html_UTF8() { 72 | return FULLHTMLBODY; 73 | } 74 | virtual ~HtmlDocument(); 75 | private: 76 | /// QByteArray docitem(const QString archive); 77 | bool findobject( QDomElement rootappend , QDomDocument doc , QString & sxmlbody ); 78 | int insertimage(); 79 | void namenspace_register(); 80 | QDir dir; 81 | /// debug modus false 82 | bool is_insert_pic; 83 | QStringList filelistvalidate; 84 | bool index_html_file_on_disc; 85 | QString lastreturnfile_html; 86 | QString NEWOOXML; /// the ready xmlto convert 87 | /// filled this at end parse... 88 | QString FULLHTMLBODY; /// the full ready htmlcode + embbeded image... 89 | QString LASTERRORMSG; 90 | 91 | }; 92 | 93 | } 94 | 95 | #endif /* ODTZIP_H */ 96 | 97 | -------------------------------------------------------------------------------- /src/SPRMS: -------------------------------------------------------------------------------- 1 | code | sprm | operand 2 | ============================================================================================= 3 | 0x 0836 | sprmCFItalic | 4 | 0x 0839 | sprmCFShadow | 5 | 0x 083c | sprmCFVanish | Specifies whether the text is formatted as hidden. 6 | 0x 0855 | sprmCFSpec | Specifies whether the current text has a special meaning. 7 | 0x 286f | sprmCIdctHint | Hint on which of the language, font, size, bold, and italic properties to use. 8 | 0x 2a3e | sprmCKul | The underlining style of the text. 9 | 0x 2a42 | sprmCIco | Specifies the color of the text. The default text color is cvAuto. 10 | 0x 2a53 | sprmCFDStrike | 11 | 0x 485f | sprmCLidBi | The language of the text when the text is displayed R-t-L or is complex script 12 | 0x 486d | sprmCRgLid0_80 | The language of the text, except for East Asian languages. 13 | 0x 4873 | sprmCRgLid0 | The language of the text, except for East Asian languages. 14 | 0x 4874 | sprmCRgLid1 | The language of the text if it is an East Asian language. 15 | 0x 4888 | sprmCPbiGrf | Specifies whether a picture is used as a bullet character when rendering the bullet. 16 | 0x 4a43 | sprmCHps | An unsigned 2-byte integer that specifies the size of the text. 17 | 0x 4a4f | sprmCRgFtc0 | Index into the font table. 18 | 0x 4a51 | sprmCRgFtc2 | Index into the font table. 19 | 0x 4a5e | sprmCFtcBi | Index into the font table (SttbfFfn). 20 | 0x 4a61 | sprmCHpsBi | An unsigned 2-byte integer that specifies the size of the text (Right-to-Left). 21 | 0x 6815 | sprmCRsidProp | Revision save ID. 22 | 0x 6816 | sprmCRsidText | Revision save ID. 23 | 0x 6870 | sprmCCv | A COLORREF value that specifies the color of the text. 24 | 0x 6877 | sprmCCvUl | A COLORREF value that specifies the color of the text underline. 25 | 0x 6887 | sprmCPbiIBullet | A CP value in Bullet Pictures document that specifies which picture is used as a bullet. 26 | 0x 6a03 | sprmCPicLocation | Specifies either picture position in Data Stream/binary data/name of OLE object storage. 27 | 0x 6a09 | sprmCSymbol | Designates the character as a symbol and specifies it's font and character code. 28 | 29 | ============================================================================================= 30 | 0x 2403 | sprmPJc80 | Physical justification of the paragraph. 31 | 0x 2461 | sprmPJc | Logical justification of the paragraph. 32 | 0x 260a | sprmPIlvl | List level of the paragraph. 33 | 0x 460b | sprmPIlfo | List identificator. 34 | 0x 6424 | sprmPBrcTop80 | Top border of the paragraph. 35 | 0x 6425 | sprmPBrcLeft80 | Left border of the paragraph. 36 | 0x 6426 | sprmPBrcBottom80 | 37 | 0c 6427 | sprmPBrcRight80 | 38 | 0x 6467 | sprmPRsid | Revision save ID. 39 | 0x 840e | sprmPDxaRight80 | Physical right indent of the paragraph [twips] 40 | 0x 840f | sprmPDxaLeft80 | Physical left indent of the P (Paragraph) [twips]. 41 | 0x 8411 | sprmPDxaLeft180 | Logical left indent of the 1st line of the P, relative to the rest of the P [twips]. 42 | 0x 845d | sprmPDxaRight | Logical right indent of the paragraph [twips] 43 | 0x 845e | sprmPDxaLeft | Logical left indent of the P (Paragraph) [twips]. 44 | 0x 8460 | sprmPDxaLeft1 | Logical left indent of the 1st line of the P, relative to the rest of the P [twips]. 45 | 0x a413 | sprmPDyaBefore | Spacing before this paragraph [twips]. 46 | 0x c60d | sprmPChgTabsPapx | Custom tab stops to be added or ignored. 47 | 0x c615 | sprmPChgTabs | Custom tab stops that are added or ignored. 48 | 0x c64e | sprmPBrcTop | Top border of the paragraph. 49 | 0x c64f | sprmPBrcLeft | 50 | 0x c650 | sprmPBrcBottom | 51 | 0x c651 | sprmPBrcRight | 52 | ============================================================================================= 53 | 54 | -------------------------------------------------------------------------------- /tests/ustringtest.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | using namespace wvWare; 24 | 25 | // A small testcase for the UString class 26 | int main( int, char** ) 27 | { 28 | std::cerr << "Testing the UString class..." << std::endl; 29 | 30 | std::cerr << "Test 1: isNull/isEmpty: "; 31 | UString string1; 32 | test( string1.isNull() && string1.isEmpty() ); 33 | 34 | std::cerr << "Test 2: isNull vs. isEmpty: "; 35 | UString string2(""); 36 | test( !string2.isNull() && string2.isEmpty() ); 37 | 38 | std::cerr << "Test 3: isEmpty: "; 39 | UString string3( "test" ); 40 | test( !string3.isNull() && !string3.isEmpty() ); 41 | 42 | std::cerr << "Test 4: Copying a null string: "; 43 | UString string4( string1 ); 44 | test( string4.isNull() && string4.isEmpty() ); 45 | 46 | std::cerr << "Test 5: Copying an empty string: "; 47 | UString string5( string2 ); 48 | test( !string5.isNull() && string5.isEmpty() ); 49 | 50 | std::cerr << "Test 6: Creating and deleting a UConstString on static data: "; 51 | const int length = 12; 52 | { // open a new scope level to let the string go out of scope sooner 53 | // Not 0 terminated! 54 | UChar data[] = { 'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!' }; 55 | UConstString string( data, length ); 56 | test( strcmp( string.string().ascii(), "Hello World!" ) == 0 ); 57 | } 58 | 59 | std::cerr << "Test 7: Checking whether the data gets copied properly: "; 60 | UString testString; 61 | UChar *data = new UChar[ length ]; 62 | data[ 0 ] = 'H'; data[ 1 ] = 'e'; data[ 2 ] = 'l'; data[ 3 ] = 'l'; 63 | data[ 4 ] = 'o'; data[ 5 ] = ' '; data[ 6 ] = 'W'; data[ 7 ] = 'o'; 64 | data[ 8 ] = 'r'; data[ 9 ] = 'l'; data[ 10 ] = 'd'; data[ 11 ] = '!'; 65 | 66 | { // open a new scope level to let the string go out of scope sooner 67 | UConstString str( data, length ); 68 | testString = str.string(); 69 | } 70 | delete [] data; 71 | test( strcmp( testString.ascii(), "Hello World!" ) == 0 ); 72 | 73 | std::cerr << "Test 8: Checking whether modifying a shallow copy works as expected I: "; 74 | data = new UChar[ length ]; 75 | data[ 0 ] = 'H'; data[ 1 ] = 'e'; data[ 2 ] = 'l'; data[ 3 ] = 'l'; 76 | data[ 4 ] = 'o'; data[ 5 ] = ' '; data[ 6 ] = 'W'; data[ 7 ] = 'o'; 77 | data[ 8 ] = 'r'; data[ 9 ] = 'l'; data[ 10 ] = 'd'; data[ 11 ] = '!'; 78 | 79 | { // open a new scope level to let the string go out of scope sooner 80 | UConstString str( data, length ); 81 | testString = str.string(); 82 | testString[ 0 ] = 'C'; 83 | test( strcmp( str.string().ascii(), "Hello World!" ) == 0 ); 84 | } 85 | delete [] data; 86 | std::cerr << "Test 9: Checking whether modifying a shallow copy works as expected II: "; 87 | test( strcmp( testString.ascii(), "Cello World!" ) == 0 ); 88 | 89 | std::cerr << "Done." << std::endl; 90 | return 0; 91 | } 92 | -------------------------------------------------------------------------------- /src/textconverter.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef TEXTCONVERTER_H 20 | #define TEXTCONVERTER_H 21 | 22 | #include "global.h" 23 | #include 24 | #include "wv2_export.h" 25 | 26 | namespace wvWare 27 | { 28 | 29 | class UString; 30 | 31 | /** 32 | * A small tool class to provide a convenient interface to iconv. 33 | */ 34 | class TextConverter 35 | { 36 | public: 37 | /** 38 | * Construct a TextConverter 39 | */ 40 | TextConverter( const std::string& toCode, const std::string& fromCode ); 41 | /** 42 | * Constructs a TextConverter which converts to UCS-2 43 | */ 44 | explicit TextConverter( const std::string& fromCode ); 45 | /** 46 | * Constructs a TextConverter which converts from the proper 47 | * codepage for the given lid to UCS-2. This is probably what 48 | * you want to use. 49 | */ 50 | explicit TextConverter( U16 lid ); 51 | 52 | /** 53 | * Properly cleans up 54 | */ 55 | ~TextConverter(); 56 | 57 | /** 58 | * Is the converter okay? 59 | */ 60 | bool isOk() const; 61 | 62 | /** 63 | * Change the converter to convert to that code 64 | */ 65 | void setToCode( const std::string& toCode ); 66 | std::string toCode() const; 67 | 68 | /** 69 | * Change the converter to convert from that code 70 | */ 71 | void setFromCode( const std::string& fromCode ); 72 | std::string fromCode() const; 73 | 74 | /** 75 | * Convert the string to the specified encoding (most likely UCS-2). 76 | * Note: No other conversions are really supported, as we don't 77 | * need them anyway. 78 | */ 79 | UString convert( const std::string& input ) const; 80 | 81 | /** 82 | * Convert the string to the specified encoding (most likely UCS-2). 83 | * Note: No other conversions are really supported, as we don't 84 | * need them anyway. 85 | */ 86 | UString convert( const char* input, unsigned int length ) const; 87 | 88 | /** 89 | * "stolen" from wvWare, guesses a lid for some locales. 90 | */ 91 | static U16 locale2LID( U8 nLocale ); 92 | 93 | /** 94 | * "stolen" from the wvWare, guesses a lang for some lids. 95 | */ 96 | static const char* LID2lang( U16 lid ); 97 | 98 | /** 99 | * returns the appropriate codepage for the given lid. 100 | */ 101 | static const char* LID2Codepage( U16 lid ); 102 | 103 | private: 104 | /** 105 | * Don't copy us 106 | */ 107 | TextConverter( const TextConverter& rhs ); 108 | /** 109 | * Don't assign us 110 | */ 111 | TextConverter& operator=( const TextConverter& rhs ); 112 | 113 | /** 114 | * Closes the old converter 115 | */ 116 | void close(); 117 | 118 | /** 119 | * Opens a converter 120 | */ 121 | void open(); 122 | 123 | static U16 fixLID( U16 nLocale ); 124 | 125 | // We need this private impl. to hide the iconv_t in the source file. The 126 | // reason is that we can't #include in the header file! 127 | class Private; 128 | Private* d; 129 | }; 130 | 131 | } // namespace wvWare 132 | 133 | #endif // TEXTCONVERTER_H 134 | -------------------------------------------------------------------------------- /src/fonts.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "fonts.h" 20 | #include "olestream.h" 21 | #include "word97_generated.h" 22 | #include "utilities.h" 23 | 24 | #include "wvlog.h" 25 | 26 | using namespace wvWare; 27 | 28 | FontCollection::FontCollection( OLEStreamReader* reader, const Word97::FIB& fib ) 29 | { 30 | m_fallbackFont = new Word97::FFN(); 31 | if (!m_fallbackFont) { 32 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Error: FFN allocation!"; 33 | return; 34 | } 35 | m_fallbackFont->xszFfn = "Helvetica"; 36 | 37 | reader->push(); 38 | reader->seek( fib.fcSttbfffn ); 39 | 40 | if ( fib.nFib < Word8nFib ) { // older than Word97 41 | int bytesLeft = reader->readU16() - 2; 42 | while ( bytesLeft > 0 ) { 43 | Word97::FFN* ffn = new Word97::FFN( reader, Word97::FFN::Word95, false ); 44 | 45 | if (!ffn) { 46 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Error: FFN allocation!"; 47 | reader->pop(); 48 | return; 49 | } 50 | 51 | m_fonts.push_back( ffn ); 52 | bytesLeft -= ffn->cbFfnM1 + 1; 53 | } 54 | } 55 | else { // Word97 or newer 56 | const U16 count = reader->readU16(); 57 | const U16 extraData = reader->readU16(); 58 | if ( extraData != 0 ) { 59 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Huh?? Found STTBF extra data within the STTBF of FFNs" << endl; 60 | } 61 | for ( int i = 0; i < count; ++i ) { 62 | Word97::FFN* ffn = new Word97::FFN( reader, Word97::FFN::Word97, false ); 63 | 64 | if (!ffn) { 65 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Error: FFN allocation!"; 66 | reader->pop(); 67 | return; 68 | } 69 | 70 | m_fonts.push_back( ffn ); 71 | } 72 | } 73 | 74 | if ( reader->tell() - fib.fcSttbfffn != fib.lcbSttbfffn ) { 75 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Warning: Didn't read lcbSttbfffn bytes: read=" << reader->tell() - fib.fcSttbfffn 76 | << " lcbSttbfffn=" << fib.lcbSttbfffn << endl; 77 | } 78 | reader->pop(); 79 | } 80 | 81 | FontCollection::~FontCollection() 82 | { 83 | std::for_each( m_fonts.begin(), m_fonts.end(), Delete() ); 84 | delete m_fallbackFont; 85 | } 86 | 87 | const Word97::FFN& FontCollection::font( S16 ftc ) const 88 | { 89 | if ( ftc >= 0 && static_cast( ftc ) < m_fonts.size() ) { 90 | return *m_fonts[ ftc ]; 91 | } 92 | return *m_fallbackFont; 93 | } 94 | 95 | void FontCollection::dump() const 96 | { 97 | std::vector::const_iterator it = m_fonts.begin(); 98 | std::vector::const_iterator end = m_fonts.end(); 99 | for ( ; it != end; ++it ) { 100 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Font: xszFfn='" << ( *it )->xszFfn.ascii() << "'" << endl; 101 | if ( !( *it )->xszFfnAlt.isEmpty() ) { 102 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<" xszFfnAlt='" << ( *it )->xszFfnAlt.ascii() << "'" << endl; 103 | } 104 | } 105 | } 106 | -------------------------------------------------------------------------------- /wv5qt.pro: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Automatically generated by qmake (3.0) sab dic 14 13:37:33 2013 3 | ###################################################################### 4 | # lib version 2° enable to target qt5 5 | TEMPLATE = lib 6 | TARGET = wv5qt 7 | INCLUDEPATH += . src tests 8 | INCLUDEPATH += /opt/icon/include 9 | CONFIG += staticlib 10 | OBJECTS_DIR = _build 11 | cache() 12 | LANGUAGE = C 13 | 14 | DEFINES += CAT_TEXT_CALLIGRA 15 | DEFINES += ESCHER_DOCSTREAM 16 | DEFINES += HAVE_ICONV_H 17 | 18 | 19 | 20 | 21 | INCLUDEPATH += . src 22 | DEPENDPATH += . src 23 | QT += core xml 24 | LIBS += -lz 25 | LIBS += -L/opt/icon/lib -liconv -I/opt/icon/include 26 | 27 | CONFIG += warn_off silent release 28 | # lib read attribute from mso general file + open zip document odt docx 29 | # update msoscheme (http://gitorious.org/msoscheme) 30 | HEADERS += simpleParser.h leinputstream.h kzip.h CmdDebug.h 31 | SOURCES += simpleParser.cpp kzip.cpp 32 | # kde helper 33 | HEADERS += KoXmlWriter.h fox_xmlsession.h 34 | SOURCES += KoXmlWriter.cpp fox_xmlsession.cpp 35 | # lib wv2 36 | HEADERS += src/annotations.h \ 37 | src/wv2_export.h \ 38 | src/associatedstrings.h \ 39 | src/bookmark.h \ 40 | src/convert.h \ 41 | src/crc32.h \ 42 | src/fields.h \ 43 | src/fonts.h \ 44 | src/footnotes97.h \ 45 | src/functor.h \ 46 | src/functordata.h \ 47 | src/global.h \ 48 | src/graphics.h \ 49 | src/handlers.h \ 50 | src/headers.h \ 51 | src/headers95.h \ 52 | src/headers97.h \ 53 | src/lists.h \ 54 | src/msdoc.h \ 55 | src/pole.h \ 56 | src/olestorage.h \ 57 | src/olestream.h \ 58 | src/paragraphproperties.h \ 59 | src/parser.h \ 60 | src/parser95.h \ 61 | src/parser97.h \ 62 | src/parser9x.h \ 63 | src/parserfactory.h \ 64 | src/properties97.h \ 65 | src/qtwv2.h \ 66 | src/sharedptr.h \ 67 | src/styles.h \ 68 | src/textconverter.h \ 69 | src/ustring.h \ 70 | src/utilities.h \ 71 | src/word95_generated.h \ 72 | src/word95_helper.h \ 73 | src/word97_generated.h \ 74 | src/word97_helper.h \ 75 | src/word_helper.h \ 76 | src/wv2version.h \ 77 | src/wvlog.h 78 | SOURCES += src/annotations.cpp \ 79 | src/associatedstrings.cpp \ 80 | src/bookmark.cpp \ 81 | src/convert.cpp \ 82 | src/crc32.c \ 83 | src/fields.cpp \ 84 | src/fonts.cpp \ 85 | src/footnotes97.cpp \ 86 | src/functor.cpp \ 87 | src/functordata.cpp \ 88 | src/global.cpp \ 89 | src/graphics.cpp \ 90 | src/handlers.cpp \ 91 | src/headers.cpp \ 92 | src/headers95.cpp \ 93 | src/headers97.cpp \ 94 | src/lists.cpp \ 95 | src/pole.cpp \ 96 | src/olestorage.cpp \ 97 | src/olestream.cpp \ 98 | src/paragraphproperties.cpp \ 99 | src/parser.cpp \ 100 | src/parser95.cpp \ 101 | src/parser97.cpp \ 102 | src/parser9x.cpp \ 103 | src/parserfactory.cpp \ 104 | src/properties97.cpp \ 105 | src/qtwv2.cpp \ 106 | src/styles.cpp \ 107 | src/textconverter.cpp \ 108 | src/ustring.cpp \ 109 | src/utilities.cpp \ 110 | src/word95_generated.cpp \ 111 | src/word95_helper.cpp \ 112 | src/word97_generated.cpp \ 113 | src/word97_helper.cpp \ 114 | src/word_helper.cpp \ 115 | src/wv2version.cpp \ 116 | src/wvlog.cpp 117 | 118 | 119 | 120 | header_files.files = $$HEADERS 121 | header_files.path = /opt/icon/include/wv5qt 122 | INSTALLS += header_files 123 | 124 | BINDIR = /opt/icon/lib 125 | target.path = $$BINDIR 126 | INSTALLS += target 127 | -------------------------------------------------------------------------------- /wv2qt.pro: -------------------------------------------------------------------------------- 1 | ###################################################################### 2 | # Automatically generated by qmake (3.0) gio dic 12 09:03:51 2013 3 | ###################################################################### 4 | ## static or shared lib test what is faster 5 | # lib version 1° from 2 6 | TEMPLATE = lib 7 | TARGET = wv2qt 8 | INCLUDEPATH += . src tests 9 | INCLUDEPATH += /opt/icon/include 10 | CONFIG += staticlib 11 | OBJECTS_DIR = _build 12 | 13 | QT += core xml 14 | 15 | cache() 16 | LANGUAGE = C 17 | DEFINES += CAT_TEXT_WORD 18 | 19 | ## INCLUDEPATH += /opt/icon/include 20 | ## DEPENDPATH += /opt/icon/include 21 | ## LIBS += -L/opt/icon/lib -lwv2qt -I/opt/icon/include 22 | 23 | INCLUDEPATH += . src 24 | DEPENDPATH += . src 25 | ## export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib:/opt/local/lib/pkgconfig:$PKG_CONFIG_PATH 26 | LIBS += -lz 27 | LIBS += -L/opt/icon/lib -liconv -I/opt/icon/include 28 | 29 | CONFIG += warn_off silent release 30 | 31 | # Input 32 | HEADERS += config.h \ 33 | src/associatedstrings.h \ 34 | src/convert.h \ 35 | src/crc32.h \ 36 | src/dllmagic.h \ 37 | src/fields.h \ 38 | src/fonts.h \ 39 | src/footnotes97.h \ 40 | src/functor.h \ 41 | src/functordata.h \ 42 | src/global.h \ 43 | src/graphics.h \ 44 | src/handlers.h \ 45 | src/headers.h \ 46 | src/headers95.h \ 47 | src/headers97.h \ 48 | src/lists.h \ 49 | src/olestorage.h \ 50 | src/olestream.h \ 51 | src/paragraphproperties.h \ 52 | src/parser.h \ 53 | src/parser95.h \ 54 | src/parser97.h \ 55 | src/parser9x.h \ 56 | src/parserfactory.h \ 57 | src/pole.h \ 58 | src/properties97.h \ 59 | src/sharedptr.h \ 60 | src/styles.h \ 61 | src/textconverter.h \ 62 | src/ustring.h \ 63 | src/utilities.h \ 64 | src/word95_generated.h \ 65 | src/word95_helper.h \ 66 | src/word97_generated.h \ 67 | src/word97_helper.h \ 68 | src/word_helper.h \ 69 | src/wv2version.h \ 70 | src/wvlog.h \ 71 | src/zcodec.hxx 72 | SOURCES += src/associatedstrings.cpp \ 73 | src/convert.cpp \ 74 | src/crc32.c \ 75 | src/fields.cpp \ 76 | src/fonts.cpp \ 77 | src/footnotes97.cpp \ 78 | src/functor.cpp \ 79 | src/functordata.cpp \ 80 | src/global.cpp \ 81 | src/graphics.cpp \ 82 | src/handlers.cpp \ 83 | src/headers.cpp \ 84 | src/headers95.cpp \ 85 | src/headers97.cpp \ 86 | src/lists.cpp \ 87 | src/olestorage.cpp \ 88 | src/olestream.cpp \ 89 | src/paragraphproperties.cpp \ 90 | src/parser.cpp \ 91 | src/parser95.cpp \ 92 | src/parser97.cpp \ 93 | src/parser9x.cpp \ 94 | src/parserfactory.cpp \ 95 | src/pole.cpp \ 96 | src/properties97.cpp \ 97 | src/styles.cpp \ 98 | src/textconverter.cpp \ 99 | src/ustring.cpp \ 100 | src/utilities.cpp \ 101 | src/word95_generated.cpp \ 102 | src/word95_helper.cpp \ 103 | src/word97_generated.cpp \ 104 | src/word97_helper.cpp \ 105 | src/word_helper.cpp \ 106 | src/wv2version.cpp \ 107 | src/zcodec.cxx \ 108 | src/wvlog.cpp 109 | 110 | 111 | 112 | 113 | 114 | header_files.files = $$HEADERS 115 | header_files.path = /opt/icon/include/wv2qt 116 | INSTALLS += header_files 117 | 118 | BINDIR = /opt/icon/lib 119 | target.path = $$BINDIR 120 | INSTALLS += target 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | -------------------------------------------------------------------------------- /src/olestorage.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef OLESTORAGE_H 20 | #define OLESTORAGE_H 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | #include "wv2_export.h" 27 | 28 | // Forward declarations 29 | namespace POLE { 30 | class Storage; 31 | } 32 | 33 | // We have removed libgsf, and require a replacement for WV2SeekType 34 | typedef enum 35 | { 36 | WV2_SEEK_CUR, //< From current position 37 | WV2_SEEK_SET, //< Absolute position 38 | } WV2SeekType; 39 | 40 | 41 | namespace wvWare 42 | { 43 | 44 | class OLEStream; 45 | class OLEStreamReader; 46 | class OLEStreamWriter; 47 | 48 | class WV2_EXPORT OLEStorage 49 | { 50 | public: 51 | /** 52 | * The mode of the storage. libgsf doesn't support storages opened 53 | * for reading and writing like libole2 did. 54 | */ 55 | enum Mode { ReadOnly, WriteOnly }; 56 | 57 | /** 58 | * Create an "empty" storage 59 | */ 60 | OLEStorage(); 61 | /** 62 | * Specify a name for the storage. Note: It will *not* be opened 63 | * right now, call @see open() to do that 64 | */ 65 | OLEStorage( const std::string& fileName ); 66 | 67 | /** 68 | * Destroy the current storage. Open streams on it will 69 | * be synced and written back. 70 | */ 71 | ~OLEStorage(); 72 | 73 | /** 74 | * Open the specified storage for reading or writing. 75 | * Opening a storage twice won't do any harm. 76 | * @return true if opening was successful 77 | */ 78 | bool open( Mode mode ); 79 | 80 | /** 81 | * Closes the current storage (no-op if we don't have one ;) 82 | * This method also tries to close/sync all the open streams. 83 | * Closing a storage twice won't do any harm. 84 | */ 85 | void close(); 86 | 87 | /** 88 | * Any problems with the current storage? 89 | */ 90 | bool isValid() const; 91 | 92 | /** 93 | * Opens the specified stream for reading and passes the 94 | * opened stream reader back. Returns 0 if it didn't work, 95 | * e.g. if the storage is opened in WriteOnly mode. 96 | * Note: The ownership is transferred to you! 97 | */ 98 | OLEStreamReader* createStreamReader( const std::string& stream ); 99 | 100 | /** TODO reimplement this 101 | * Opens a stream for writing (you get 0 if it failed, e.g. if 102 | * the storage is in ReadOnly mode). 103 | * Note: The ownership is transferred to you! 104 | * Note2: Don't try to pass names with a '/' in it :) 105 | */ 106 | OLEStreamWriter* createStreamWriter( const std::string& stream ); 107 | 108 | private: 109 | /** 110 | * we don't want to allow copying 111 | */ 112 | OLEStorage( const OLEStorage& rhs ); 113 | /** 114 | * we don't want to allow assigning 115 | */ 116 | OLEStorage& operator=( const OLEStorage& rhs ); 117 | 118 | /** 119 | * Pointer to a Storage object which we are providing a Facade for. 120 | */ 121 | POLE::Storage* m_storage; 122 | 123 | std::string m_fileName; 124 | 125 | /** 126 | * We're not the owner, but we still keep track of all 127 | * the streams for bookkeeping issues. If the user forgets 128 | * to delete the OLEStreams we do it on closing. 129 | */ 130 | std::list m_streams; 131 | }; 132 | 133 | } // namespace wvWare 134 | 135 | #endif // OLESTORAGE_H 136 | -------------------------------------------------------------------------------- /src/properties97.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef PROPERTIES97_H 20 | #define PROPERTIES97_H 21 | 22 | #include "sharedptr.h" 23 | #include "word_helper.h" 24 | #include "word97_generated.h" 25 | #include "wv2_export.h" 26 | 27 | namespace wvWare 28 | { 29 | class ParagraphProperties; 30 | namespace Word95 31 | { 32 | struct PHE; 33 | } 34 | 35 | class Properties97 36 | { 37 | public: 38 | Properties97( OLEStreamReader* wordDocument, OLEStreamReader* table, const Word97::FIB &fib ); 39 | ~Properties97(); 40 | 41 | // StyleSheet --------- 42 | const Style* styleByIndex( U16 istd ) const; 43 | StyleSheet& styleSheet() const; 44 | 45 | // Document properties --------- 46 | const Word97::DOP& dop() const; 47 | 48 | // Section properties --------- 49 | SharedPtr sepForCP( U32 cp ) const; 50 | 51 | // Paragraph properties --------- 52 | // Determines the PAP state from the last full-save (ownership is transferred) 53 | ParagraphProperties* fullSavedPap( U32 fc, OLEStreamReader* dataStream ); 54 | // Apply the latest changes recorded in the clxGrppl section of the piece table 55 | void applyClxGrpprl( const Word97::PCD* pcd, U32 fcClx, ParagraphProperties* properties ); 56 | 57 | // Table properties --------- 58 | // Determines the TAP state from the last full-save (ownership is transferred) 59 | Word97::TAP* fullSavedTap( U32 fc, OLEStreamReader* dataStream ); 60 | void applyClxGrpprl( const Word97::PCD* pcd, U32 fcClx, Word97::TAP* tap, const Style* style ); 61 | 62 | // Character properties --------- 63 | // Determines the CHP state from the last full-save (ownership is transferred) 64 | U32 fullSavedChp( const U32 fc, Word97::CHP* chp, const Style* paragraphStyle ); 65 | // Apply the latest changes recorded in the clxGrppl section of the piece table 66 | void applyClxGrpprl( const Word97::PCD* pcd, U32 fcClx, Word97::CHP* chp, const Style* style ); 67 | 68 | private: 69 | Properties97( const Properties97& rhs ); 70 | Properties97& operator=( const Properties97& rhs ); 71 | 72 | // This should have been called "applyClxGrpprl" too, but VC7 doesn't like that 73 | template void applyClxGrpprlImpl( const Word97::PCD* pcd, U32 fcClx, P* properties, const Style* style ); 74 | 75 | void fillBinTable( PLCF* bte, U16 cpnBte ); 76 | 77 | const WordVersion m_version; 78 | OLEStreamReader* m_wordDocument; // doesn't belong to us, be careful 79 | OLEStreamReader* m_table; // doesn't belong to us, be careful 80 | 81 | StyleSheet* m_stylesheet; 82 | Word97::DOP m_dop; 83 | PLCF* m_plcfsed; // section descr. table 84 | PLCF* m_plcfbtePapx; // PAPX FKP page numbers 85 | PLCF* m_plcfbteChpx; // CHPX FKP page numbers 86 | 87 | typedef FKP< BX > PAPXFKP_t; 88 | typedef FKP< BX > PAPXFKP95_t; 89 | typedef FKPIterator< BX > PAPXFKPIterator; 90 | PAPXFKP_t* m_papxFkp; // Currently cached PAPX FKP 91 | 92 | typedef FKP CHPXFKP_t; 93 | typedef FKPIterator CHPXFKPIterator; 94 | CHPXFKP_t* m_chpxFkp; // Currently cached CHPX FKP 95 | }; 96 | 97 | } // namespace wvWare 98 | 99 | #endif // PROPERTIES97_H 100 | -------------------------------------------------------------------------------- /src/functordata.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef FUNCTORDATA_H 20 | #define FUNCTORDATA_H 21 | 22 | #include "sharedptr.h" 23 | #include "wvlog.h" 24 | #include "wv2_export.h" 25 | #include "ustring.h" 26 | #include "word97_generated.h" 27 | 28 | namespace wvWare 29 | { 30 | /** 31 | * @internal 32 | * Holds all the necessary information for asynchronous header/footer parsing. 33 | * The sectionNumber is a 0-based index, the headerMask holds bits of 34 | * the Type enum ORed together. 35 | */ 36 | struct WV2_EXPORT HeaderData 37 | { 38 | enum Type { HeaderEven = 0x01, HeaderOdd = 0x02, FooterEven = 0x04, 39 | FooterOdd = 0x08, HeaderFirst = 0x10, FooterFirst = 0x20 }; 40 | 41 | enum Empty { NoHeaderEven = 0xfe, NoFooterEven = 0xfb, 42 | NoHeaderFirst = 0x2f, NoFooterFirst = 0x1f}; 43 | 44 | HeaderData( int sectionNum ) : 45 | sectionNumber( sectionNum ), headerMask( HeaderOdd | FooterOdd ) {} 46 | 47 | int sectionNumber; 48 | unsigned char headerMask; 49 | }; 50 | 51 | /** 52 | * @internal 53 | * Holds all necessary information for delayed footnote/endnote parsing. 54 | */ 55 | struct WV2_EXPORT FootnoteData 56 | { 57 | enum Type { Footnote, Endnote }; 58 | 59 | FootnoteData( Type t, bool autoNum, unsigned int start, unsigned int lim ) : 60 | type( t ), autoNumbered( autoNum ), startCP( start ), limCP( lim ) {} 61 | 62 | Type type; 63 | bool autoNumbered; 64 | unsigned int startCP; 65 | unsigned int limCP; 66 | }; 67 | 68 | /** 69 | * @internal 70 | * Holds all necessary information for delayed bookmark parsing. 71 | */ 72 | struct WV2_EXPORT BookmarkData 73 | { 74 | BookmarkData( unsigned int start, unsigned int lim, UString nameRef ) : 75 | startCP( start ), limCP( lim ), name(nameRef) {} 76 | 77 | unsigned int startCP; 78 | unsigned int limCP; 79 | UString name; 80 | }; 81 | 82 | /** 83 | * @internal 84 | * Holds all necessary information for delayed annotation parsing. 85 | */ 86 | struct WV2_EXPORT AnnotationData 87 | { 88 | AnnotationData( unsigned int start, unsigned int lim ) : 89 | startCP( start ), limCP( lim ) 90 | { 91 | } 92 | 93 | unsigned int startCP; 94 | unsigned int limCP; 95 | }; 96 | 97 | /** 98 | * @internal 99 | * Keeps track of the table (row) information. Tables are parsed 100 | * row by row. 101 | */ 102 | struct WV2_EXPORT TableRowData 103 | { 104 | TableRowData( unsigned int sp, unsigned int so, unsigned int len, 105 | int subDoc, SharedPtr sharedTap ); 106 | ~TableRowData(); 107 | 108 | unsigned int startPiece; 109 | unsigned int startOffset; 110 | unsigned int length; 111 | int subDocument; // int to avoid #including here 112 | SharedPtr tap; 113 | }; 114 | 115 | 116 | /** 117 | * @internal 118 | * Holds the information about pictures inside the functor. 119 | */ 120 | struct WV2_EXPORT PictureData 121 | { 122 | PictureData( unsigned int fc, SharedPtr sharedPicf ); 123 | ~PictureData(); 124 | 125 | unsigned int fcPic; 126 | SharedPtr picf; 127 | }; 128 | 129 | } // namespace wvWare 130 | 131 | #endif // FUNCTORDATA_H 132 | -------------------------------------------------------------------------------- /src/bookmark.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 KO GmbH 3 | Copyright (C) 2010, 2011 Matus Uzak 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License version 2 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | 21 | #ifndef BOOKMARK_H 22 | #define BOOKMARK_H 23 | 24 | #include "global.h" 25 | #include "functordata.h" 26 | #include "wv2_export.h" 27 | 28 | #include 29 | #include 30 | 31 | namespace wvWare 32 | { 33 | namespace Word97 34 | { 35 | struct FIB; 36 | struct BKF; 37 | struct BKL; 38 | } 39 | template class PLCF; 40 | template class PLCFIterator; 41 | class OLEStreamReader; 42 | struct BookmarkData; 43 | 44 | /** 45 | * @internal 46 | */ 47 | class Bookmarks 48 | { 49 | public: 50 | Bookmarks( OLEStreamReader* tableStream, const Word97::FIB& fib ); 51 | ~Bookmarks(); 52 | 53 | /** 54 | * Get the BookmarkData for the Bookmark-Start/End at @param 55 | * globalCP. The @param ok flag is true if a bookmark has been 56 | * found. If @param ok is false no valid bookmark has been found 57 | * and the returned BookmarkData structure is invalid. 58 | */ 59 | BookmarkData bookmark( const U32 globalCP, bool& ok ); 60 | 61 | /** 62 | * Get the BookmarkData for the Bookmark of @param name. The 63 | * @param ok flag is true if a bookmark has been found. If @param 64 | * ok is false no valid bookmark has been found and the returned 65 | * BookmarkData structure is invalid. 66 | */ 67 | BookmarkData bookmark( const UString& name, bool& ok ) const; 68 | 69 | /** 70 | * Returns the global CP of the next bookmark start, 71 | * 0xffffffff if none exists or invalid. 72 | */ 73 | U32 nextBookmarkStart(); 74 | /** 75 | * Returns the global CP of the next bookmark end, 76 | * 0xffffffff if none exists or invalid. 77 | */ 78 | U32 nextBookmarkEnd() const; 79 | 80 | /** 81 | * Check for unprocessed bookmars located before @param globalCP. 82 | * This might be the result of a skipped chunk or overlapping. 83 | * Any unprocessed bookmarks are skipped. 84 | */ 85 | void check( U32 globalCP ); 86 | 87 | private: 88 | Bookmarks( const Bookmarks& rhs ); 89 | Bookmarks& operator=( const Bookmarks& rhs ); 90 | 91 | /** 92 | * Validate bookmarks. 93 | * @param num. of invalid bookmarks detected 94 | */ 95 | bool valid(U16 &num, const U32 ccpText); 96 | 97 | PLCF* m_start; 98 | PLCFIterator* m_startIt; 99 | 100 | std::vector m_name; 101 | std::vector::const_iterator m_nameIt; 102 | 103 | //Used for MS Word Version 6,7 documents. 104 | PLCF* m_end; 105 | PLCFIterator* m_endIt; 106 | 107 | //Used instead of m_end for MS Word 97 (aka Version 8) 108 | //documents. 109 | std::vector m_endCP; 110 | 111 | //A copy of fib.nFib to identify the document type durig 112 | //processing of bookmarks. 113 | U16 m_nFib; 114 | 115 | //A list providing the info if bookmarks are valid. 116 | QList m_valid; 117 | }; 118 | 119 | } // namespace wvWare 120 | 121 | #endif // BOOKMARK_H 122 | -------------------------------------------------------------------------------- /src/global.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef GLOBAL_H 20 | #define GLOBAL_H 21 | 22 | #include "wv2_export.h" 23 | //#include "wv2version.h" // ###### WV2 0.3: Remove this #include 24 | 25 | /** 26 | * @file We use this typedefs to be compatible with the types from the MS HTML 27 | * specifications. 28 | */ 29 | 30 | // A few defines used for "inline" debugging 31 | #define WV2_DUMP_PIECE_TABLE 0 // has to be defined as we just #if it 32 | //#define WV2_DUMP_FIB 1 33 | 34 | //#define WV2_DEBUG_FIB 1 35 | //#define WV2_DEBUG_STYLESHEET 1 36 | //#define WV2_DEBUG_SPRMS 1 37 | //#define WV2_DEBUG_LIST_READING 1 38 | //#define WV2_DEBUG_LIST_PROCESSING 1 39 | //#define WV2_DEBUG_FIELDS 1 40 | //#define WV2_DEBUG_FOOTNOTES 1 41 | //#define WV2_DEBUG_HEADERS 1 42 | //#define WV2_DEBUG_TABLES 1 43 | //#define WV2_DEBUG_PARAGRAPHS 1 44 | //#define WV2_DEBUG_PICTURES 1 45 | //#define WV2_DEBUG_ANNOTATIONS 1 46 | //#define WV2_DEBUG_BOOKMARK 1 47 | //#define WV2_DEBUG_SECTIONS 1 48 | //#define WV2_DEBUG_SHD 49 | 50 | // This define should only be commented out for releases (if at all) 51 | #define WV2_CHECKING 1 52 | 53 | namespace wvWare 54 | { 55 | 56 | typedef signed char S8; 57 | typedef unsigned char U8; 58 | typedef signed short S16; 59 | typedef unsigned short U16; 60 | typedef signed int S32; 61 | typedef unsigned int U32; 62 | typedef U16 XCHAR; 63 | typedef U32 FC; 64 | 65 | /** 66 | * This enum tells the apply* methods in the PAP/CHP/... structs what grpprls to 67 | * expect. Unfortunately the size of the SPRMs changed for Word 8. 68 | */ 69 | enum WordVersion { Word67, Word8 }; 70 | const int Word8nFib = 193; 71 | 72 | inline U8 readU8( const U8* in ) 73 | { 74 | return *in; 75 | } 76 | 77 | inline S8 readS8( const U8* in ) 78 | { 79 | return static_cast( *in ); 80 | } 81 | 82 | // reads a U16/S16 or U32/S32 from a little-endian byte 83 | // "array" in an endian-correct way 84 | inline U16 readU16( const U8* in ) 85 | { 86 | return static_cast( in[0] ) | ( static_cast( in[1] ) << 8 ); 87 | } 88 | 89 | inline S16 readS16( const U8* in ) 90 | { 91 | return static_cast( readU16( in ) ); 92 | } 93 | 94 | // writes a U16 to a little-endian byte "array" in an endian-correct way 95 | inline void write( U8* out, U16 data ) 96 | { 97 | out[ 0 ] = data & 0x00ff; 98 | out[ 1 ] = data >> 8; 99 | } 100 | 101 | inline U32 readU32( const U8* in ) 102 | { 103 | return static_cast( in[0] ) | ( static_cast( in[1] ) << 8 ) | 104 | ( static_cast( in[2] ) << 16 ) | ( static_cast( in[3] ) << 24 ); 105 | } 106 | 107 | inline S32 readS32(const U8* in) 108 | { 109 | return static_cast( readU32( in ) ); 110 | } 111 | 112 | // Endianness fun 113 | U16 toLittleEndian( U16 data ); 114 | 115 | inline S16 toLittleEndian( S16 data ) 116 | { 117 | return static_cast( toLittleEndian( static_cast( data ) ) ); 118 | } 119 | 120 | U16 toBigEndian( U16 data ); 121 | 122 | inline S16 toBigEndian( S16 data ) 123 | { 124 | return static_cast( toBigEndian( static_cast( data ) ) ); 125 | } 126 | 127 | inline U16 swapEndianness( U16 data ) 128 | { 129 | return ( ( data & 0x00ffU ) << 8 ) | ( ( data & 0xff00U ) >> 8 ); 130 | } 131 | 132 | inline S16 swapEndianness( S16 data ) 133 | { 134 | return ( ( data & 0x00ffU ) << 8 ) | ( ( data & 0xff00U ) >> 8 ); 135 | } 136 | 137 | U32 toLittleEndian( U32 data ); 138 | 139 | inline S32 toLittleEndian( S32 data ) 140 | { 141 | return static_cast( toLittleEndian( static_cast( data ) ) ); 142 | } 143 | 144 | U32 toBigEndian( U32 data ); 145 | 146 | inline S32 toBigEndian( S32 data ) 147 | { 148 | return static_cast( toBigEndian( static_cast( data ) ) ); 149 | } 150 | 151 | inline U32 swapEndianness( U32 data ) 152 | { 153 | return ( ( data & 0x000000ffU ) << 24 ) | ( ( data & 0x0000ff00U ) << 8 ) | 154 | ( ( data & 0x00ff0000U ) >> 8 ) | ( ( data & 0xff000000U ) >> 24 ); 155 | } 156 | 157 | inline S32 swapEndianness( S32 data ) 158 | { 159 | return ( ( data & 0x000000ffU ) << 24 ) | ( ( data & 0x0000ff00U ) << 8 ) | 160 | ( ( data & 0x00ff0000U ) >> 8 ) | ( ( data & 0xff000000U ) >> 24 ); 161 | } 162 | 163 | } // namespace wvWare 164 | 165 | #endif // GLOBAL_H 166 | -------------------------------------------------------------------------------- /src/sharedptr.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the KDE libraries 2 | Copyright (c) 1999 Waldo Bastian 3 | Copyright (c) 2001-2003 Werner Trobin 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License version 2 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02111-1307, USA. 18 | */ 19 | #ifndef SharedPTR_H 20 | #define SharedPTR_H 21 | 22 | #include "wv2_export.h" 23 | 24 | namespace wvWare { 25 | 26 | /** 27 | * Reference counting for shared objects. If you derive your object 28 | * from this class, then you may use it in conjunction with 29 | * @ref SharedPtr to control the lifetime of your object. 30 | * 31 | * Specifically, all classes that derive from Shared have an internal 32 | * counter keeping track of how many other objects have a reference to 33 | * their object. If used with @ref SharedPtr, then your object will 34 | * not be deleted until all references to the object have been 35 | * released. 36 | * 37 | * You should probably not ever use any of the methods in this class 38 | * directly -- let the @ref SharedPtr take care of that. Just derive 39 | * your class from Shared and forget about it. 40 | * 41 | * @author Waldo Bastian 42 | */ 43 | class WV2_EXPORT Shared { 44 | public: 45 | /** 46 | * Standard constructor. This will initialize the reference count 47 | * on this object to 0 48 | */ 49 | Shared() : count( 0 ) { } 50 | 51 | /** 52 | * Copy constructor. This will @em not actually copy the objects 53 | * but it will initialize the reference count on this object to 0 54 | */ 55 | Shared( const Shared & ) : count( 0 ) { } 56 | 57 | /** 58 | * Overloaded assignment operator 59 | */ 60 | Shared &operator=( const Shared & ) { return *this; } 61 | 62 | /** 63 | * Increases the reference count by one 64 | */ 65 | void _Shared_ref() const { count++; } 66 | 67 | /** 68 | * Releases a reference (decreases the reference count by one). If 69 | * the count goes to 0, this object will delete itself 70 | */ 71 | void _Shared_deref() const { if (!--count) delete this; } 72 | 73 | /** 74 | * Return the current number of references held 75 | * 76 | * @return Number of references 77 | */ 78 | int _Shared_count() const { return count; } 79 | 80 | protected: 81 | virtual ~Shared() { } 82 | private: 83 | mutable int count; 84 | }; 85 | 86 | /** 87 | * Can be used to control the lifetime of an object that has derived 88 | * @ref Shared. As long a someone holds a SharedPtr on some Shared 89 | * object it won't become deleted but is deleted once its reference 90 | * count is 0. This struct emulates C++ pointers perfectly. So just 91 | * use it like a simple C++ pointer. 92 | * 93 | * @author Waldo Bastian 94 | */ 95 | template< class T > 96 | struct SharedPtr 97 | { 98 | public: 99 | SharedPtr() 100 | : ptr(0) { } 101 | SharedPtr( T* t ) 102 | : ptr(t) { if ( ptr ) ptr->_Shared_ref(); } 103 | SharedPtr( const SharedPtr& p ) 104 | : ptr(p.ptr) { if ( ptr ) ptr->_Shared_ref(); } 105 | 106 | ~SharedPtr() { if ( ptr ) ptr->_Shared_deref(); } 107 | 108 | SharedPtr& operator= ( const SharedPtr& p ) { 109 | if ( ptr == p.ptr ) return *this; 110 | if ( ptr ) ptr->_Shared_deref(); 111 | ptr = p.ptr; 112 | if ( ptr ) ptr->_Shared_ref(); 113 | return *this; 114 | } 115 | SharedPtr& operator= ( T* p ) { 116 | if ( ptr == p ) return *this; 117 | if ( ptr ) ptr->_Shared_deref(); 118 | ptr = p; 119 | if ( ptr ) ptr->_Shared_ref(); 120 | return *this; 121 | } 122 | bool operator== ( const SharedPtr& p ) const { return ( ptr == p.ptr ); } 123 | bool operator!= ( const SharedPtr& p ) const { return ( ptr != p.ptr ); } 124 | bool operator== ( const T* p ) const { return ( ptr == p ); } 125 | bool operator!= ( const T* p ) const { return ( ptr != p ); } 126 | bool operator!() const { return ( ptr == 0 ); } 127 | operator T*() const { return ptr; } 128 | 129 | T* data() { return ptr; } 130 | const T* data() const { return ptr; } 131 | 132 | const T& operator*() const { return *ptr; } 133 | T& operator*() { return *ptr; } 134 | const T* operator->() const { return ptr; } 135 | T* operator->() { return ptr; } 136 | 137 | int count() const { return ptr->_Shared_count(); } // for debugging purposes 138 | private: 139 | T* ptr; 140 | }; 141 | 142 | } // namespace wvWare 143 | 144 | #endif 145 | -------------------------------------------------------------------------------- /src/pole.h: -------------------------------------------------------------------------------- 1 | /* POLE - Portable C++ library to access OLE Storage 2 | Copyright (C) 2002-2005 Ariya Hidayat 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions 6 | are met: 7 | * Redistributions of source code must retain the above copyright notice, 8 | this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | * Neither the name of the authors nor the names of its contributors may be 13 | used to endorse or promote products derived from this software without 14 | specific prior written permission. 15 | 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 17 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 20 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 23 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 24 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 25 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 26 | THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef POLE_H 30 | #define POLE_H 31 | 32 | #include 33 | #include 34 | 35 | enum GSeekType 36 | { 37 | G_SEEK_CUR, 38 | G_SEEK_SET, 39 | G_SEEK_END 40 | }; 41 | 42 | 43 | namespace POLE 44 | { 45 | 46 | class StorageIO; 47 | class Stream; 48 | class StreamIO; 49 | 50 | class Storage 51 | { 52 | friend class Stream; 53 | friend class StreamOut; 54 | 55 | public: 56 | 57 | // for Storage::result() 58 | enum { Ok, OpenFailed, NotOLE, BadOLE, UnknownError }; 59 | 60 | /** 61 | * Constructs a storage with name filename. 62 | **/ 63 | Storage( const char* filename ); 64 | 65 | /** 66 | * Destroys the storage. 67 | **/ 68 | ~Storage(); 69 | 70 | /** 71 | * Opens the storage. Returns true if no error occurs. 72 | **/ 73 | bool open(); 74 | 75 | /** 76 | * Closes the storage. 77 | **/ 78 | void close(); 79 | 80 | /** 81 | * Returns the error code of last operation. 82 | **/ 83 | int result(); 84 | 85 | /** 86 | * Finds all stream and directories in given path. 87 | **/ 88 | std::list entries( const std::string& path = "/" ); 89 | 90 | /** 91 | * Returns true if specified entry name is a directory. 92 | */ 93 | bool isDirectory( const std::string& name ); 94 | 95 | /** 96 | * Finds and returns a stream with the specified name. 97 | * If reuse is true, this function returns the already created stream 98 | * (if any). Otherwise it will create the stream. 99 | * 100 | * When errors occur, this function returns NULL. 101 | * 102 | * You do not need to delete the created stream, it will be handled 103 | * automatically. 104 | **/ 105 | Stream* stream( const std::string& name, bool reuse = true ); 106 | //Stream* stream( const std::string& name, int mode = Stream::ReadOnly, bool reuse = true ); 107 | 108 | private: 109 | StorageIO* io; 110 | 111 | // no copy or assign 112 | Storage( const Storage& ); 113 | Storage& operator=( const Storage& ); 114 | 115 | }; 116 | 117 | class Stream 118 | { 119 | friend class Storage; 120 | friend class StorageIO; 121 | 122 | public: 123 | 124 | /** 125 | * Creates a new stream. 126 | */ 127 | // name must be absolute, e.g "/Workbook" 128 | Stream( Storage* storage, const std::string& name ); 129 | 130 | /** 131 | * Destroys the stream. 132 | */ 133 | ~Stream(); 134 | 135 | /** 136 | * Returns the full stream name. 137 | */ 138 | std::string fullName(); 139 | 140 | /** 141 | * Returns the stream size. 142 | **/ 143 | unsigned long size(); 144 | 145 | /** 146 | * Returns the current read/write position. 147 | **/ 148 | unsigned long tell(); 149 | 150 | /** 151 | * Sets the read/write position. 152 | **/ 153 | void seek( unsigned long pos ); 154 | 155 | /** 156 | * Reads a byte. 157 | **/ 158 | int getch(); 159 | 160 | /** 161 | * Reads a block of data. 162 | **/ 163 | unsigned long read( unsigned char* data, unsigned long maxlen ); 164 | 165 | /** 166 | * Returns true if the read/write position is past the file. 167 | **/ 168 | bool eof(); 169 | 170 | /** 171 | * Returns true whenever error occurs. 172 | **/ 173 | bool fail(); 174 | 175 | private: 176 | StreamIO* io; 177 | 178 | // no copy or assign 179 | Stream( const Stream& ); 180 | Stream& operator=( const Stream& ); 181 | }; 182 | 183 | } 184 | 185 | #endif // POLE_H 186 | -------------------------------------------------------------------------------- /src/zcodec.hxx: -------------------------------------------------------------------------------- 1 | /************************************************************************* 2 | * 3 | * OpenOffice.org - a multi-platform office productivity suite 4 | * 5 | * $RCSfile: zcodec.hxx,v $ 6 | * 7 | * $Revision: 1.4 $ 8 | * 9 | * last change: $Author: tuubaaku $ $Date: 2009/02/14 02:51:13 $ 10 | * 11 | * The Contents of this file are made available subject to 12 | * the terms of GNU Lesser General Public License Version 2.1. 13 | * 14 | * 15 | * GNU Lesser General Public License Version 2.1 16 | * ============================================= 17 | * Copyright 2005 by Sun Microsystems, Inc. 18 | * 901 San Antonio Road, Palo Alto, CA 94303, USA 19 | * 20 | * This library is free software; you can redistribute it and/or 21 | * modify it under the terms of the GNU Lesser General Public 22 | * License version 2.1, as published by the Free Software Foundation. 23 | * 24 | * This library is distributed in the hope that it will be useful, 25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 27 | * Lesser General Public License for more details. 28 | * 29 | * You should have received a copy of the GNU Lesser General Public 30 | * License along with this library; if not, write to the Free Software 31 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 32 | * MA 02111-1307 USA 33 | * 34 | ************************************************************************/ 35 | 36 | #ifndef _ZCODEC_HXX 37 | #define _ZCODEC_HXX 38 | 39 | //#ifndef INCLUDED_TOOLSDLLAPI_H 40 | //#include "tools/toolsdllapi.h" 41 | //#endif 42 | 43 | //#ifndef _SOLAR_H 44 | //#include 45 | //#endif 46 | 47 | #include "global.h" //for U8 48 | #include //for std::vector 49 | 50 | // ----------- 51 | // - Defines - 52 | // ----------- 53 | 54 | #define DEFAULT_IN_BUFSIZE (0x00008000UL) 55 | #define DEFAULT_OUT_BUFSIZE (0x00008000UL) 56 | 57 | #define MAX_MEM_USAGE 8 58 | 59 | // 60 | // memory requirement using compress: 61 | // [ INBUFFER ] + [ OUTBUFFER ] + 128KB + 1 << (MEM_USAGE+9) 62 | // 63 | // memory requirement using decompress: 64 | // [ INBUFFER ] + [ OUTBUFFER ] + 32KB 65 | // 66 | 67 | #define ZCODEC_NO_COMPRESSION (0x00000000UL) 68 | #define ZCODEC_BEST_SPEED (0x00000001UL) 69 | #define ZCODEC_DEFAULT_COMPRESSION (0x00000006UL) 70 | #define ZCODEC_BEST_COMPRESSION (0x00000009UL) 71 | 72 | #define ZCODEC_DEFAULT_STRATEGY (0x00000000UL) 73 | #define ZCODEC_ZFILTERED (0x00000100UL) 74 | #define ZCODEC_ZHUFFMAN_ONLY (0x00000200UL) 75 | 76 | #define ZCODEC_UPDATE_CRC (0x00010000UL) 77 | #define ZCODEC_GZ_LIB (0x00020000UL) 78 | 79 | #define ZCODEC_PNG_DEFAULT ( ZCODEC_NO_COMPRESSION | ZCODEC_DEFAULT_STRATEGY | ZCODEC_UPDATE_CRC ) 80 | #define ZCODEC_DEFAULT ( ZCODEC_DEFAULT_COMPRESSION | ZCODEC_DEFAULT_STRATEGY ) 81 | 82 | // ---------- 83 | // - ZCodec - 84 | // ---------- 85 | 86 | //class OLEStreamReader; 87 | //class OLEStreamWriter; 88 | 89 | using namespace wvWare; 90 | 91 | typedef unsigned long ULONG; 92 | typedef bool BOOL; 93 | typedef U8 BYTE; 94 | #define FALSE false 95 | #define TRUE true 96 | 97 | class ZCodec 98 | { 99 | private: 100 | 101 | ULONG mbInit; 102 | BOOL mbStatus; //status good or bad 103 | BOOL mbFinish; //are we finished yet? 104 | ULONG mnMemUsage; //total memory we can use? 105 | OLEStreamReader* mpIStm; //in-stream 106 | BYTE* mpInBuf; //in-buffer 107 | ULONG mnInBufSize; //size of the in-buffer 108 | ULONG mnInToRead; //how many bytes overall we still want to read 109 | OLEStreamWriter* mpOStm; //out-stream 110 | BYTE* mpOutBuf; //out-buffer 111 | ULONG mnOutBufSize; //size of the out-buffer 112 | 113 | ULONG mnCRC; 114 | ULONG mnCompressMethod; 115 | void* mpsC_Stream; 116 | 117 | void ImplInitBuf( BOOL nIOFlag ); 118 | void ImplWriteBack( std::vector* outBuffer ); 119 | 120 | public: 121 | ZCodec( ULONG nInBuf, ULONG nOutBuf, ULONG nMemUsage = MAX_MEM_USAGE ); 122 | ZCodec( void ); 123 | virtual ~ZCodec(); 124 | 125 | virtual void BeginCompression( ULONG nCompressMethod = ZCODEC_DEFAULT ); 126 | virtual long EndCompression(std::vector* outBuffer); 127 | BOOL IsFinished () const { return mbFinish; } 128 | 129 | long Compress( OLEStreamReader& rIStm, OLEStreamWriter& rOStm ); 130 | long Decompress( OLEStreamReader& rIStm, std::vector* outBuffer ); 131 | 132 | //long Write( OLEStreamWriter& rOStm, const BYTE* pData, ULONG nSize ); 133 | //long Read( OLEStreamReader& rIStm, BYTE* pData, ULONG nSize ); 134 | //long ReadAsynchron( OLEStreamReader& rIStm, BYTE* pData, ULONG nSize ); 135 | 136 | void SetBreak( ULONG ); 137 | //ULONG GetBreak( void ); 138 | //void SetCRC( ULONG nCurrentCRC ); 139 | //ULONG UpdateCRC( ULONG nLatestCRC, ULONG nSource ); 140 | //ULONG UpdateCRC( ULONG nLatestCRC, BYTE* pSource, long nDatSize ); 141 | //ULONG GetCRC(); 142 | }; 143 | 144 | class GZCodec : public ZCodec 145 | { 146 | 147 | public: 148 | GZCodec(){}; 149 | ~GZCodec(){}; 150 | virtual void BeginCompression( ULONG nCompressMethod = ZCODEC_DEFAULT ); 151 | }; 152 | 153 | #endif // _ZCODEC_HXX 154 | -------------------------------------------------------------------------------- /src/annotations.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2002-2003 Werner Trobin 3 | Copyright (C) 2010, 2011 Matus Uzak 4 | 5 | This library is free software; you can redistribute it and/or 6 | modify it under the terms of the GNU Library General Public 7 | License version 2 as published by the Free Software Foundation. 8 | 9 | This library is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 | Library General Public License for more details. 13 | 14 | You should have received a copy of the GNU Library General Public License 15 | along with this library; see the file COPYING.LIB. If not, write to 16 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 | Boston, MA 02111-1307, USA. 18 | */ 19 | 20 | #include "annotations.h" 21 | #include "word_helper.h" 22 | #include "word97_generated.h" 23 | #include "olestream.h" 24 | 25 | #include "wvlog.h" 26 | 27 | using namespace wvWare; 28 | 29 | Annotations::Annotations( OLEStreamReader* tableStream, const Word97::FIB& fib ) : 30 | m_annotationRef( 0 ), m_annotationRefIt( 0 ) 31 | { 32 | #ifdef WV2_DEBUG_ANNOTATIONS 33 | wvlog << __FILE__ << ":" << __LINE__ << " - " <current() ? m_annotationRefIt->currentStart() : 0xffffffff; 88 | } 89 | 90 | void Annotations::init( U32 fcRef, U32 lcbRef, U32 fcTxt, U32 lcbTxt, OLEStreamReader* tableStream, 91 | PLCF** ref, PLCFIterator** refIt, 92 | std::vector& txt, std::vector::const_iterator& txtIt ) 93 | { 94 | if ( lcbRef == 0 ) { 95 | return; 96 | } 97 | 98 | tableStream->seek( fcRef, WV2_SEEK_SET ); 99 | *ref = new PLCF( lcbRef, tableStream ); 100 | *refIt = new PLCFIterator( **ref ); 101 | 102 | #ifdef WV2_DEBUG_ANNOTATIONS 103 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"[ PlcfandRef ]" << endl; 104 | ( *ref )->dumpCPs(); 105 | #endif 106 | 107 | if ( lcbTxt == 0 ) { 108 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Bug: lcbTxt == 0 but lcbRef != 0" << endl; 109 | } else { 110 | if ( static_cast( tableStream->tell() ) != fcTxt ) { 111 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Warning: Found a hole in the table stream" << endl; 112 | tableStream->seek( fcTxt, WV2_SEEK_SET ); 113 | } 114 | #ifdef WV2_DEBUG_ANNOTATIONS 115 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"[ PlcfandTxt ]" << endl; 116 | #endif 117 | for ( U32 i = 0; i < lcbTxt; i += sizeof( U32 ) ) { 118 | txt.push_back( tableStream->readU32() ); 119 | #ifdef WV2_DEBUG_ANNOTATIONS 120 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"CP: " << txt.back() << endl; 121 | #endif 122 | } 123 | txtIt = txt.begin(); 124 | } 125 | 126 | //TODO: ATRDPost10, ATRDPre10, XSTs at position fcGrpXstAtnOwners 127 | 128 | #ifdef WV2_DEBUG_ANNOTATIONS 129 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Annotation init done" << endl; 130 | #endif 131 | } 132 | -------------------------------------------------------------------------------- /Sandcastle5/fox_office/foxdoc_handler.h: -------------------------------------------------------------------------------- 1 | // 2 | // Transform a doc word document to xml 3 | // to get only target propriety no image or other 4 | // Author: Peter Hohl , 24.10.2013 5 | // http://www.freeroad.ch/ 6 | // Copyright: See COPYING file that comes with this distribution 7 | 8 | 9 | #ifndef DOCUMENT_DOC_HANDLER_H 10 | #define DOCUMENT_DOC_HANDLER_H 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | #include "wv5qt/qtwv2.h" 17 | #include "foxdoc_texthandler.h" 18 | 19 | #include "fox_base.h" 20 | #include "wv5qt/kzip.h" 21 | #include 22 | 23 | #if 0 //// 1 or 0 24 | #define WBEEP qDebug 25 | #else 26 | #define WBEEP if (0) qDebug 27 | #endif 28 | 29 | 30 | #if 0 //// 1 or 0 31 | #define HBEEP qDebug 32 | #else 33 | #define HBEEP if (0) qDebug 34 | #endif 35 | 36 | 37 | #if 0 //// 1 or 0 38 | #define XMLBEEP qDebug 39 | #else 40 | #define XMLBEEP if (0) qDebug 41 | #endif 42 | 43 | #if 0 //// 1 or 0 44 | #define DSTYLE qDebug 45 | #else 46 | #define DSTYLE if (0) qDebug 47 | #endif 48 | 49 | #if 0 //// 1 or 0 50 | #define CERRORDOC qCritical 51 | #else 52 | #define CERRORDOC if (0) qCritical 53 | #endif 54 | 55 | 56 | #if 0 //// 1 or 0 57 | #define DGRAPHICS qDebug() 58 | #else 59 | #define DGRAPHICS if (0) qDebug() 60 | #endif 61 | 62 | /** 63 | * The PropertyIdentifier data type represents the property identifier 64 | * of a property in a property set. 65 | * 66 | * 0x00000002 — 0x7FFFFFFF - Used to identify normal properties. 67 | */ 68 | enum PropertyType { 69 | PIDSI_CODEPAGE = 0x00000001, 70 | PIDSI_TITLE = 0x00000002, 71 | PIDSI_SUBJECT = 0x00000003, 72 | PIDSI_AUTHOR = 0x00000004, 73 | PIDSI_KEYWORDS = 0x00000005, 74 | PIDSI_COMMENTS = 0x00000006, 75 | PIDSI_TEMPLATE = 0x00000007, 76 | PIDSI_LASTAUTHOR = 0x00000008, 77 | PIDSI_REVNUMBER = 0x00000009, 78 | PIDSI_EDITTIME = 0x00000010, 79 | PIDSI_LASTPRINTED, 80 | PIDSI_CREATE_DTM, 81 | PIDSI_LASTSAVE_DTM, 82 | PIDSI_PAGECOUNT, 83 | PIDSI_WORDCOUNT, 84 | PIDSI_CHARCOUNT, 85 | PIDSI_APPNAME = 0x00000012, 86 | PIDSI_DOC_SECURITY = 0x00000013 87 | }; 88 | 89 | using namespace wvWare; 90 | 91 | struct ImageBox { 92 | QString name; 93 | QString typedisplay; 94 | QString mimetype; /// priority 2 95 | QByteArray uid; /// priority 1 96 | }; 97 | 98 | class MyInlineReplacementHandler : public InlineReplacementHandler { 99 | public: 100 | virtual U8 tab(); 101 | virtual U8 hardLineBreak(); 102 | virtual U8 columnBreak(); 103 | virtual U8 nonBreakingHyphen(); 104 | virtual U8 nonRequiredHyphen(); 105 | virtual U8 nonBreakingSpace(); 106 | 107 | void setParser(SharedPtr parser) { 108 | e_parser = parser; 109 | } 110 | SharedPtr e_parser; 111 | }; 112 | 113 | class MySubDocumentHandler : public SubDocumentHandler { 114 | public: 115 | virtual void bodyStart(); 116 | virtual void bodyEnd(); 117 | 118 | virtual void footnoteStart(); 119 | virtual void footnoteEnd(); 120 | 121 | virtual void headersStart(); 122 | virtual void headersEnd(); 123 | virtual void headerStart(HeaderData::Type type); 124 | virtual void headerEnd(); 125 | 126 | void setParser(SharedPtr parser) { 127 | e_parser = parser; 128 | } 129 | SharedPtr e_parser; 130 | }; 131 | 132 | class MyTableHandler : public TableHandler { 133 | public: 134 | virtual void tableRowStart(SharedPtr tap); 135 | virtual void tableRowEnd(); 136 | virtual void tableCellStart(); 137 | virtual void tableCellEnd(); 138 | 139 | void setParser(SharedPtr parser) { 140 | e_parser = parser; 141 | } 142 | SharedPtr e_parser; 143 | }; 144 | 145 | class MyGraphicHandler : public GraphicsHandler { 146 | public: 147 | 148 | /** 149 | * This method gets called when a floating object is found. 150 | * @param globalCP (character position) 151 | */ 152 | virtual void handleFloatingObject(unsigned int globalCP); 153 | /// void MyGraphicHandler::handleFloatingObject(unsigned int globalCP) 154 | 155 | /** 156 | * This method gets called when an inline object is found. @param data 157 | * the picture properties and offset into data stream. 158 | */ 159 | virtual QString handleInlineObject(const PictureData& data, const bool isBulletPicture = false); 160 | /// QString MyGraphicHandler::handleInlineObject(const PictureData& data, const bool isBulletPicture = false); 161 | 162 | void setParser(SharedPtr parser) { 163 | e_parser = parser; 164 | } 165 | SharedPtr e_parser; 166 | }; 167 | 168 | class DocModelRead { 169 | public: 170 | DocModelRead(const QString chartset = "utf-8"); 171 | void renderStyle(const StyleSheet& styles); 172 | ~DocModelRead(); 173 | bool readDocument(const QString fileName); 174 | QString xmlstream(); 175 | 176 | void setParser(SharedPtr parser) { 177 | e_parser = parser; 178 | } 179 | SharedPtr e_parser; 180 | LEInputStream *sis_baseSummaryInformation; 181 | LEInputStream *sis_baseDataInformation; 182 | private: 183 | int myImageIndex; 184 | int myFootnoteIndex; 185 | QString wordfile; 186 | QString xml_LONG; // embeded_object 187 | QString filenameoriginal; 188 | 189 | }; 190 | 191 | 192 | #endif /* DOCUMENT_DOC_HANDLER_H */ 193 | 194 | -------------------------------------------------------------------------------- /src/generator/template-Word97.cpp: -------------------------------------------------------------------------------- 1 | ### As you recognized already, "###" at the begin of a line 2 | ### marks a comment. 3 | 4 | ### Everything between start and end will be put into the file 5 | @@license-start@@ 6 | /* This file is part of the wvWare 2 project 7 | Copyright (C) 2001 Werner Trobin 8 | 9 | This library is free software; you can redistribute it and/or 10 | modify it under the terms of the GNU Library General Public 11 | License version 2 as published by the Free Software Foundation. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Library General Public License for more details. 17 | 18 | You should have received a copy of the GNU Library General Public License 19 | along with this library; see the file COPYING.LIB. If not, write to 20 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 21 | Boston, MA 02111-1307, USA. 22 | */ 23 | 24 | // This code is generated from the Microsoft HTML specification of the 25 | // WinWord format. Do NOT edit this code, but fix the spec or the script 26 | // generating the sources. If you want to add some additional code, some 27 | // includes or any other stuff, please add it to the template file! 28 | // For information about the script and the "hidden features" please read 29 | // the comments at the begin of the script. 30 | 31 | // If you find bugs or strange behavior please contact Werner Trobin 32 | // 33 | @@license-end@@ 34 | 35 | ### Everything between @@includes-start@@ and -end will be added to 36 | ### the generated includes (e.g. "#include ") 37 | @@includes-start@@ 38 | ####include // test 39 | @@includes-end@@ 40 | 41 | ### These are the "borders" of the namespace (e.g. namespace Word97 { .. }) 42 | ### Everything you add in here will be added to the generated code 43 | @@namespace-start@@ 44 | // FFN implementation, located in template-Word97.cpp 45 | FFN::FFN() { 46 | clearInternal(); 47 | } 48 | 49 | FFN::FFN(OLEStreamReader *stream, Version version, bool preservePos) { 50 | clearInternal(); 51 | read(stream, version, preservePos); 52 | } 53 | 54 | bool FFN::read(OLEStreamReader *stream, Version version, bool preservePos) { 55 | 56 | U8 shifterU8; 57 | 58 | if(preservePos) 59 | stream->push(); 60 | 61 | cbFfnM1=stream->readU8(); 62 | shifterU8=stream->readU8(); 63 | prq=shifterU8; 64 | shifterU8>>=2; 65 | fTrueType=shifterU8; 66 | shifterU8>>=1; 67 | unused1_3=shifterU8; 68 | shifterU8>>=1; 69 | ff=shifterU8; 70 | shifterU8>>=3; 71 | unused1_7=shifterU8; 72 | wWeight=stream->readS16(); 73 | chs=stream->readU8(); 74 | ixchSzAlt=stream->readU8(); 75 | 76 | U8 remainingSize = cbFfnM1 - 5; 77 | 78 | if ( version == Word97 ) { 79 | for(int _i=0; _i<(10); ++_i) 80 | panose[_i]=stream->readU8(); 81 | for(int _i=0; _i<(24); ++_i) 82 | fs[_i]=stream->readU8(); 83 | remainingSize -= 34; 84 | 85 | // Remaining size in bytes -> shorts 86 | remainingSize /= 2; 87 | XCHAR* string = new XCHAR[ remainingSize ]; 88 | for ( int i = 0; i < remainingSize; ++i ) 89 | string[ i ] = stream->readU16(); 90 | if ( ixchSzAlt == 0 ) 91 | xszFfn = UString( reinterpret_cast( string ), remainingSize - 1 ); 92 | else { 93 | xszFfn = UString( reinterpret_cast( string ), ixchSzAlt - 1 ); 94 | xszFfnAlt = UString( reinterpret_cast( &string[ ixchSzAlt ] ), remainingSize - 1 - ixchSzAlt ); 95 | } 96 | delete [] string; 97 | } 98 | else { 99 | U8* string = new U8[ remainingSize ]; 100 | stream->read( string, remainingSize ); 101 | // ###### Assume plain latin1 strings, maybe we'll have to use a textconverter here... 102 | if ( ixchSzAlt == 0 ) 103 | xszFfn = UString( reinterpret_cast( string ) ); 104 | else { 105 | xszFfn = UString( reinterpret_cast( string ) ); // The strings are 0-terminated, according to the SPEC 106 | xszFfnAlt = UString( reinterpret_cast( &string[ ixchSzAlt ] ) ); 107 | } 108 | delete [] string; 109 | } 110 | 111 | if(preservePos) 112 | stream->pop(); 113 | return true; 114 | } 115 | 116 | void FFN::clear() { 117 | clearInternal(); 118 | } 119 | 120 | void FFN::clearInternal() { 121 | cbFfnM1=0; 122 | prq=0; 123 | fTrueType=0; 124 | unused1_3=0; 125 | ff=0; 126 | unused1_7=0; 127 | wWeight=0; 128 | chs=0; 129 | ixchSzAlt=0; 130 | for(int _i=0; _i<(10); ++_i) 131 | panose[_i]=0; 132 | for(int _i=0; _i<(24); ++_i) 133 | fs[_i]=0; 134 | xszFfn = UString::null; 135 | xszFfnAlt = UString::null; 136 | } 137 | 138 | // There can be only one tab at a given position, no matter what the other options are 139 | bool operator==( const TabDescriptor& lhs, const TabDescriptor& rhs ) { return lhs.dxaTab == rhs.dxaTab; } 140 | bool operator!=( const TabDescriptor& lhs, const TabDescriptor& rhs ) { return lhs.dxaTab != rhs.dxaTab; } 141 | bool operator<( const TabDescriptor& lhs, const TabDescriptor& rhs ) { return lhs.dxaTab < rhs.dxaTab; } 142 | bool operator>( const TabDescriptor& lhs, const TabDescriptor& rhs ) { return lhs.dxaTab > rhs.dxaTab; } 143 | 144 | ### This tag "expands" to all the structs :) 145 | @@generated-code@@ 146 | ### nothing 147 | @@namespace-end@@ 148 | -------------------------------------------------------------------------------- /src/olestream.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "olestream.h" 20 | #include "wvlog.h" 21 | #include "pole.h" 22 | 23 | #include // FILE,... 24 | 25 | 26 | 27 | #ifdef HAVE_CONFIG_H 28 | #include 29 | #endif 30 | 31 | using namespace wvWare; 32 | 33 | OLEStream::OLEStream( OLEStorage* storage ) : m_storage( storage ) 34 | { 35 | } 36 | 37 | OLEStream::~OLEStream() 38 | { 39 | } 40 | 41 | void OLEStream::push() 42 | { 43 | m_positions.push( tell() ); 44 | } 45 | 46 | bool OLEStream::pop() 47 | { 48 | if ( m_positions.empty() ) 49 | return false; 50 | seek( m_positions.top(), WV2_SEEK_SET ); 51 | m_positions.pop(); 52 | return true; 53 | } 54 | 55 | 56 | OLEStreamReader::OLEStreamReader( POLE::Stream *stream, OLEStorage *storage ) : 57 | OLEStream( storage ), m_stream( stream ), m_pos(0) 58 | { 59 | } 60 | 61 | OLEStreamReader::~OLEStreamReader() 62 | { 63 | delete m_stream; 64 | } 65 | 66 | bool OLEStreamReader::isValid() const 67 | { 68 | return m_stream; 69 | } 70 | 71 | bool OLEStreamReader::seek( int offset, WV2SeekType whence ) 72 | { 73 | unsigned long tempPos = m_pos; 74 | 75 | switch(whence) { 76 | case WV2_SEEK_CUR: 77 | tempPos += offset; 78 | break; 79 | case WV2_SEEK_SET: 80 | tempPos = offset; 81 | break; 82 | } 83 | 84 | if (tempPos > m_stream->size()) 85 | { 86 | return false; 87 | } 88 | 89 | m_pos = tempPos; 90 | m_stream->seek(m_pos); 91 | 92 | return true; 93 | } 94 | 95 | int OLEStreamReader::tell() const 96 | { 97 | if (!m_stream) { 98 | return -1; 99 | } 100 | 101 | return m_pos; 102 | } 103 | 104 | size_t OLEStreamReader::size() const 105 | { 106 | if (!m_stream) { 107 | return 0; 108 | } 109 | 110 | return m_stream->size(); 111 | } 112 | 113 | U8 OLEStreamReader::readU8() 114 | { 115 | #ifdef WV2_CHECKING 116 | if ( !m_stream ) 117 | return 0; 118 | #endif 119 | 120 | U8 ret; 121 | m_pos += m_stream->read( static_cast(&ret), sizeof(U8) ); 122 | 123 | return ret; 124 | } 125 | 126 | S8 OLEStreamReader::readS8() 127 | { 128 | return static_cast( readU8() ); 129 | } 130 | 131 | U16 OLEStreamReader::readU16() 132 | { 133 | #ifdef WV2_CHECKING 134 | if ( !m_stream ) 135 | return 0; 136 | #endif 137 | 138 | #if defined(WORDS_BIGENDIAN) 139 | // Please take care when "optimizing" that and read 140 | // http://gcc.gnu.org/ml/gcc-bugs/2000-12/msg00429.html 141 | // and http://www.eskimo.com/~scs/C-faq/q3.8.html 142 | U16 tmp1 = readU8(); 143 | U16 tmp2 = readU8(); 144 | return ( tmp2 << 8 ) | tmp1; 145 | #else 146 | U16 ret; 147 | m_pos += m_stream->read( reinterpret_cast(&ret), sizeof(U16) ); 148 | return ret; 149 | #endif 150 | } 151 | 152 | S16 OLEStreamReader::readS16() 153 | { 154 | return static_cast( readU16() ); 155 | } 156 | 157 | U32 OLEStreamReader::readU32() 158 | { 159 | #ifdef WV2_CHECKING 160 | if ( !m_stream ) 161 | return 0; 162 | #endif 163 | 164 | #if defined(WORDS_BIGENDIAN) 165 | // Please take care when "optimizing" that and read 166 | // http://gcc.gnu.org/ml/gcc-bugs/2000-12/msg00429.html 167 | // and http://www.eskimo.com/~scs/C-faq/q3.8.html 168 | U32 tmp1 = readU16(); 169 | U32 tmp2 = readU16(); 170 | return ( tmp2 << 16 ) | tmp1; 171 | #else 172 | U32 ret; 173 | m_pos += m_stream->read( reinterpret_cast(&ret), sizeof(U32) ); 174 | return ret; 175 | #endif 176 | } 177 | 178 | S32 OLEStreamReader::readS32() 179 | { 180 | return static_cast( readU32() ); 181 | } 182 | 183 | bool OLEStreamReader::read( U8 *buffer, size_t length ) 184 | { 185 | #ifdef WV2_CHECKING 186 | if ( !m_stream ) 187 | return false; 188 | #endif 189 | m_pos += m_stream->read( static_cast(buffer), length ); 190 | return true; 191 | } 192 | 193 | 194 | OLEStreamWriter::OLEStreamWriter( OLEStorage* storage ) : 195 | OLEStream( storage ) 196 | { 197 | } 198 | 199 | OLEStreamWriter::~OLEStreamWriter() 200 | { 201 | } 202 | 203 | bool OLEStreamWriter::isValid() const 204 | { 205 | return false; 206 | } 207 | 208 | bool OLEStreamWriter::seek( int offset, WV2SeekType whence ) 209 | { 210 | return false; 211 | } 212 | 213 | int OLEStreamWriter::tell() const 214 | { 215 | return 0; 216 | } 217 | 218 | size_t OLEStreamWriter::size() const 219 | { 220 | return 0; 221 | } 222 | 223 | void OLEStreamWriter::write( U8 data ) 224 | { 225 | } 226 | 227 | void OLEStreamWriter::write( S8 data ) 228 | { 229 | } 230 | 231 | void OLEStreamWriter::write( U16 data ) 232 | { 233 | } 234 | 235 | void OLEStreamWriter::write( S16 data ) 236 | { 237 | } 238 | 239 | void OLEStreamWriter::write( U32 data ) 240 | { 241 | } 242 | 243 | void OLEStreamWriter::write( S32 data ) 244 | { 245 | } 246 | 247 | void OLEStreamWriter::write( U8* data, size_t length ) 248 | { 249 | } 250 | -------------------------------------------------------------------------------- /src/wvlog.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef WVLOG_H 20 | #define WVLOG_H 21 | 22 | #include 23 | #include 24 | #include // Make gcc 2.95.x happy 25 | #include "CmdDebug.h" 26 | #include 27 | 28 | namespace wvWare 29 | { 30 | 31 | class wvdebugstream 32 | { 33 | public: 34 | #ifdef WV2_OLD_STL_WORKAROUND 35 | const wvdebugstream& operator<<( ostream& (*__pf)( ostream& ) ) const { std::cerr << __pf; return *this; } 36 | const wvdebugstream& operator<<( ios (*__pf)( ios& ) ) const { std::cerr << __pf; return *this; } 37 | #else 38 | const wvdebugstream& operator<<( std::basic_ostream& (*__pf)( std::basic_ostream& ) ) const { std::cerr << __pf; return *this; } 39 | const wvdebugstream& operator<<( std::ios (*__pf)( std::ios& ) ) const { std::cerr << __pf; return *this; } 40 | const wvdebugstream& operator<<( std::ios_base& (*__pf) ( std::ios_base& ) ) const { std::cerr << __pf; return *this; } 41 | #endif 42 | const wvdebugstream& operator<<( long l ) const { std::cerr << l; return *this; } 43 | const wvdebugstream& operator<<( unsigned long l ) const { std::cerr << l; return *this; } 44 | const wvdebugstream& operator<<( bool b ) const { std::cerr << b; return *this; } 45 | const wvdebugstream& operator<<( short s ) const { std::cerr << s; return *this; } 46 | const wvdebugstream& operator<<( unsigned short s ) const { std::cerr << s; return *this; } 47 | const wvdebugstream& operator<<( int i ) const { std::cerr << i; return *this; } 48 | const wvdebugstream& operator<<( unsigned int i ) const { std::cerr << i; return *this; } 49 | const wvdebugstream& operator<<( double d ) const { std::cerr << d; return *this; } 50 | const wvdebugstream& operator<<( float f ) const { std::cerr << f; return *this; } 51 | const wvdebugstream& operator<<( long double d ) const { std::cerr << d; return *this; } 52 | const wvdebugstream& operator<<( const void* cv ) const { std::cerr << cv; return *this; } 53 | #ifdef WV2_OLD_STL_WORKAROUND 54 | const wvdebugstream& operator<<( streambuf* s ) const { std::cerr << s; return *this; } 55 | #else 56 | const wvdebugstream& operator<<( std::basic_streambuf* s ) const { std::cerr << s; return *this; } 57 | #endif 58 | const wvdebugstream& operator<<( signed char c ) const { std::cerr << c; return *this; } 59 | const wvdebugstream& operator<<( unsigned char c ) const { std::cerr << c; return *this; } 60 | const wvdebugstream& operator<<( const char* s ) const { std::cerr << s; return *this; } 61 | const wvdebugstream& operator<<( const std::string& s ) const { std::cerr << s; return *this; } 62 | }; 63 | 64 | 65 | class wvnodebugstream 66 | { 67 | public: 68 | #ifdef WV2_OLD_STL_WORKAROUND 69 | const wvnodebugstream& operator<<( ostream& (*__pf)( ostream& ) ) const { std::cerr << __pf; return *this; } 70 | const wvnodebugstream& operator<<( ios (*__pf)( ios& ) ) const { std::cerr << __pf; return *this; } 71 | #else 72 | const wvnodebugstream& operator<<( std::basic_ostream& (*__pf)( std::basic_ostream& ) ) const { return *this; } 73 | const wvnodebugstream& operator<<( std::ios (*__pf)( std::ios& ) ) const { return *this; } 74 | const wvnodebugstream& operator<<( std::ios_base& (*__pf) ( std::ios_base& ) ) const { return *this; } 75 | #endif 76 | const wvnodebugstream& operator<<( long ) const { return *this; } 77 | const wvnodebugstream& operator<<( unsigned long ) const { return *this; } 78 | const wvnodebugstream& operator<<( bool ) const { return *this; } 79 | const wvnodebugstream& operator<<( short ) const { return *this; } 80 | const wvnodebugstream& operator<<( unsigned short ) const { return *this; } 81 | const wvnodebugstream& operator<<( int ) const { return *this; } 82 | const wvnodebugstream& operator<<( unsigned int ) const { return *this; } 83 | const wvnodebugstream& operator<<( double ) const { return *this; } 84 | const wvnodebugstream& operator<<( float ) const { return *this; } 85 | const wvnodebugstream& operator<<( long double ) const { return *this; } 86 | const wvnodebugstream& operator<<( const void* ) const { return *this; } 87 | #ifdef WV2_OLD_STL_WORKAROUND 88 | const wvnodebugstream& operator<<( streambuf* ) const { return *this; } 89 | #else 90 | const wvnodebugstream& operator<<( std::basic_streambuf* ) const { return *this; } 91 | #endif 92 | const wvnodebugstream& operator<<( signed char ) const { return *this; } 93 | const wvnodebugstream& operator<<( unsigned char ) const { return *this; } 94 | const wvnodebugstream& operator<<( const char* ) const { return *this; } 95 | const wvnodebugstream& operator<<( const std::string& ) const { return *this; } 96 | }; 97 | 98 | #ifdef NDEBUG 99 | typedef wvnodebugstream wvlogstream; 100 | #else 101 | typedef wvdebugstream wvlogstream; 102 | #endif 103 | 104 | extern const wvlogstream wvlog; 105 | 106 | } // wvWare 107 | 108 | 109 | 110 | 111 | #endif // WVLOG_H 112 | -------------------------------------------------------------------------------- /src/parserfactory.cpp: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #include "parserfactory.h" 20 | #include "parser95.h" 21 | #include "parser97.h" 22 | #include "olestream.h" 23 | #include 24 | #include "wvlog.h" 25 | #include 26 | 27 | using namespace wvWare; 28 | 29 | namespace 30 | { 31 | void diagnose( const unsigned char* const buffer ) 32 | { 33 | // Check if it's a Word 3, 4, or 5 file 34 | if ( buffer[0] == 0x31 && buffer[1] == 0xbe && 35 | buffer[2] == 0x00 && buffer[3] == 0x00 ) 36 | { 37 | std::cerr << "This is a Word 3, 4, or 5 file. Right now we don't handle these versions.\n" 38 | << "Please send us the file, maybe we will implement it later on." << std::endl; 39 | } 40 | else if ( buffer[0] == 0xdb && buffer[1] == 0xa5 && 41 | buffer[2] == 0x2d && buffer[3] == 0x00 ) 42 | { 43 | std::cerr << "This is a Word 2 document. Right now we don't handle this version." << std::endl 44 | << "Please send us the file, maybe we will implement it later on." << std::endl; 45 | } else { 46 | std::cerr << "That doesn't seem to be a Word document." << std::endl; 47 | } 48 | } 49 | 50 | SharedPtr setupParser( OLEStorage* storage ) 51 | { 52 | // Is it called WordDocument in all versions? 53 | OLEStreamReader* wordDocument = storage->createStreamReader( "WordDocument" ); 54 | if ( !wordDocument || !wordDocument->isValid() ) { 55 | std::cerr << "Error: No 'WordDocument' stream found. Are you sure this is a Word document?" << std::endl; 56 | delete wordDocument; 57 | delete storage; 58 | return 0; 59 | } 60 | 61 | U16 magic = wordDocument->readU16(); 62 | if ( magic != 0xa5ec && magic != 0xa5dc ) 63 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"+++ Attention: Strange magic number: " << magic << endl; 64 | 65 | U16 nFib = wordDocument->readU16(); 66 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"nFib = 0x" << hex << nFib << dec << "(" << nFib << ")" << endl; 67 | wordDocument->seek( 0 ); // rewind the stream 68 | 69 | if ( nFib < 101 ) { 70 | std::cerr << "+++ Don't know how to handle nFib=" << nFib << std::endl; 71 | delete wordDocument; 72 | delete storage; 73 | return 0; 74 | } 75 | // (0x0065) 76 | else if ( nFib == 101 ) { 77 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Word-6 document found" << endl; 78 | return new Parser95( storage, wordDocument ); 79 | } 80 | // (0x0067, 0x0068) 81 | else if ( nFib == 103 || nFib == 104 ) { 82 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Word-7 (aka Word 95) document found" << endl; 83 | return new Parser95( storage, wordDocument ); 84 | } 85 | // (0x00c1) 86 | else if ( (nFib == Word8nFib) || (nFib == 0x00c0) || (nFib == 0x00c2) ) 87 | { 88 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Word-8 (aka Word 97) document found" << endl; 89 | return new Parser97( storage, wordDocument ); 90 | } 91 | else { 92 | // (0x00d9) 93 | if ( nFib == 217 ) { 94 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Looks like a document created by Word-9/Office 2000," 95 | << "trying with the Word-8 parser." << endl; 96 | } 97 | // (0x0101) 98 | else if ( nFib == 257 ) { 99 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Looks like a document created by Word-10/Office XP," 100 | << "trying with the Word-8 parser." << endl; 101 | } 102 | // (0x010c) 103 | else if ( nFib == 268 ) { 104 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"Looks like a document created by Word-11/Office 2003," 105 | << "trying with the Word-8 parser." << endl; 106 | } 107 | // (0x0112), ... 108 | else { 109 | wvlog << __FILE__ << ":" << __LINE__ << " - " <<"A document > Word-8 found," 110 | << "trying with the Word-8 parser." << endl; 111 | } 112 | return new Parser97( storage, wordDocument ); 113 | } 114 | } 115 | } 116 | 117 | SharedPtr ParserFactory::createParser( const std::string& fileName ) 118 | { 119 | OLEStorage* storage( new OLEStorage( fileName ) ); 120 | if ( !storage->open( OLEStorage::ReadOnly ) || !storage->isValid() ) { 121 | delete storage; 122 | 123 | FILE* file = fopen( fileName.c_str(), "r" ); 124 | if ( !file ) { 125 | std::cerr << "Couldn't open " << fileName.c_str() << " for reading." << std::endl; 126 | return 0; 127 | } 128 | unsigned char buffer[4]; 129 | fread( buffer, 1, 4, file ); 130 | diagnose( buffer ); 131 | fclose( file ); 132 | return 0; 133 | } 134 | 135 | return setupParser( storage ); 136 | } 137 | -------------------------------------------------------------------------------- /src/olestream.h: -------------------------------------------------------------------------------- 1 | /* This file is part of the wvWare 2 project 2 | Copyright (C) 2001-2003 Werner Trobin 3 | 4 | This library is free software; you can redistribute it and/or 5 | modify it under the terms of the GNU Library General Public 6 | License version 2 as published by the Free Software Foundation. 7 | 8 | This library is distributed in the hope that it will be useful, 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 | Library General Public License for more details. 12 | 13 | You should have received a copy of the GNU Library General Public License 14 | along with this library; see the file COPYING.LIB. If not, write to 15 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 16 | Boston, MA 02111-1307, USA. 17 | */ 18 | 19 | #ifndef OLESTREAM_H 20 | #define OLESTREAM_H 21 | 22 | #include "olestorage.h" 23 | #include "global.h" // U8,... typedefs 24 | #include 25 | 26 | #include "wv2_export.h" 27 | 28 | 29 | // Forward declarations 30 | namespace POLE { 31 | class Stream; 32 | } 33 | 34 | namespace wvWare { 35 | 36 | class WV2_EXPORT OLEStream 37 | { 38 | public: 39 | /** 40 | * Create an OLE stream 41 | */ 42 | explicit OLEStream( OLEStorage* storage ); 43 | virtual ~OLEStream(); 44 | 45 | /** 46 | * Is this still a valid stream? 47 | */ 48 | virtual bool isValid() const = 0; 49 | 50 | /** 51 | * works like plain fseek 52 | */ 53 | virtual bool seek( int offset, WV2SeekType whence = WV2_SEEK_SET ) = 0; 54 | /** 55 | * works like plain ftell 56 | */ 57 | virtual int tell() const = 0; 58 | /** 59 | * The size of the stream 60 | */ 61 | virtual size_t size() const = 0; 62 | 63 | /** 64 | * Push the current offset on the stack 65 | */ 66 | void push(); 67 | /** 68 | * Pop the topmost position (false if the stack was empty) 69 | */ 70 | bool pop(); 71 | 72 | private: 73 | /** 74 | * we don't want to allow copying and assigning streams 75 | */ 76 | OLEStream( const OLEStream& rhs ); 77 | /** 78 | * we don't want to allow copying and assigning streams 79 | */ 80 | OLEStream& operator=( const OLEStream& rhs ); 81 | 82 | std::stack m_positions; 83 | /** 84 | * for bookkeeping :} 85 | */ 86 | OLEStorage *m_storage; 87 | }; 88 | 89 | 90 | class WV2_EXPORT OLEStreamReader : public OLEStream 91 | { 92 | public: 93 | OLEStreamReader( POLE::Stream *stream, OLEStorage *storage ); 94 | virtual ~OLEStreamReader(); 95 | 96 | /** 97 | * Is this still a valid stream? 98 | */ 99 | virtual bool isValid() const; 100 | 101 | /** 102 | * works like plain fseek 103 | */ 104 | virtual bool seek( int offset, WV2SeekType whence = WV2_SEEK_SET ); 105 | /** 106 | * works like plain ftell 107 | */ 108 | virtual int tell() const; 109 | /** 110 | * The size of the stream 111 | */ 112 | virtual size_t size() const; 113 | 114 | /** 115 | * Reading from the current position 116 | * Note: Modifies the current position! 117 | * All the read methods are endian-aware and convert 118 | * the contents from the file if necessary 119 | */ 120 | U8 readU8(); 121 | /** 122 | * @see readU8() 123 | */ 124 | S8 readS8(); 125 | /** 126 | * @see readU8() 127 | */ 128 | U16 readU16(); 129 | /** 130 | * @see readU8() 131 | */ 132 | S16 readS16(); 133 | /** 134 | * @see readU8() 135 | */ 136 | U32 readU32(); 137 | /** 138 | * @see readU8() 139 | */ 140 | S32 readS32(); 141 | 142 | /** 143 | * Reads a bunch of bytes w/o endian conversion to the 144 | * given buffer, at most length bytes. 145 | * Returns true on success 146 | */ 147 | bool read( U8 *buffer, size_t length ); 148 | 149 | private: 150 | // we don't want to allow copying and assigning streams 151 | OLEStreamReader( const OLEStreamReader& rhs ); 152 | OLEStreamReader& operator=( const OLEStreamReader& rhs ); 153 | 154 | POLE::Stream *m_stream; 155 | unsigned long m_pos; 156 | }; 157 | 158 | 159 | class WV2_EXPORT OLEStreamWriter : public OLEStream 160 | { 161 | public: 162 | OLEStreamWriter( OLEStorage* storage ); 163 | virtual ~OLEStreamWriter(); 164 | 165 | /** 166 | * Is this still a valid stream? 167 | */ 168 | virtual bool isValid() const; 169 | 170 | /** 171 | * works like plain fseek 172 | */ 173 | virtual bool seek( int offset, WV2SeekType whence = WV2_SEEK_SET ); 174 | /** 175 | * works like plain ftell 176 | */ 177 | virtual int tell() const; 178 | /** 179 | * The size of the stream 180 | */ 181 | virtual size_t size() const; 182 | 183 | /** 184 | * Writing to the current position 185 | * Note: Modifies the current position! 186 | * These write methods are endian-aware 187 | * and convert the contents to be LE in the file 188 | */ 189 | void write( U8 data ); 190 | /** 191 | * @see write(U8 data) 192 | */ 193 | void write( S8 data ); 194 | /** 195 | * @see write(U8 data) 196 | */ 197 | void write( U16 data ); 198 | /** 199 | * @see write(U8 data) 200 | */ 201 | void write( S16 data ); 202 | /** 203 | * @see write(U8 data) 204 | */ 205 | void write( U32 data ); 206 | /** 207 | * @see write(U8 data) 208 | */ 209 | void write( S32 data ); 210 | 211 | /** 212 | * Attention: This write method just writes out the 213 | * contents of the memory directly (w/o converting 214 | * to little-endian first!) 215 | */ 216 | void write( U8* data, size_t length ); 217 | 218 | private: 219 | // we don't want to allow copying and assigning streams 220 | OLEStreamWriter( const OLEStreamWriter& rhs ); 221 | OLEStreamWriter& operator=( const OLEStreamWriter& rhs ); 222 | }; 223 | 224 | } // namespace wvWare 225 | 226 | #endif // OLESTREAM_H 227 | --------------------------------------------------------------------------------