This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C1C3A5.1987B9B0 Content-Type: text/plain; charset="iso-8859-1" David: > > Hmm, each applications handles the KoPageLayout itself. > > The way to gain access to this from KoDocument would be to centralize even > > more code in kofficecore, e.g. storing the page layout there and porting the > > koffice apps to use that variable instead of storing it themselves. Me: > This sounds like a lot of work, right? Well, I was wrong. The attached patch does this (in a very basic way; just moves m_pageLayout into KoDocument). It now looks much nicer. http://www.babysimon.co.uk/kde/kofficepreview.png But I'm afraid something's definitely up with the font sizes. The text "Big heading" in the KWord file, and the text "Groovy presentation" in the KPresenter file (thank you Laurent!) are both meant to be centred. But I still think it looks quite cool. Me again: > In that case, maybe the save functionality should create a thumbnail and > embed it within the file (blue sky thinking here really). Just in case I was crazy enough to want to do this, would KoDocument::saveToStore be the right place to put it? I think this should get two desktop files - one for KOffice native formats and one for everything else (since when/if I get this embedded thumbnail thing to work KOffice native documents should be much faster). Would this be able to go into CVS? That way someone else might fill in the rest of the mimetypes ;) Thanks, Simon ------_=_NextPart_000_01C1C3A5.1987B9B0 Content-Type: application/octet-stream; name="koffice.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="koffice.diff" ? koffice.diff=0A= ? doc/kformula/.memdump=0A= ? doc/koffice/.memdump=0A= ? doc/kontour/.memdump=0A= ? doc/koshell/.memdump=0A= ? doc/kpresenter/.memdump=0A= ? doc/kspread/.memdump=0A= ? doc/kugar/.memdump=0A= ? doc/kword/.memdump=0A= ? doc/thesaurus/.memdump=0A= ? kontour/kontour_viewiface.kidl=0A= ? kontour/kontour_viewiface_skel.cc=0A= ? krayon/Makefile.in=0A= ? krayon/Makefile=0A= ? krayon/core/Makefile.in=0A= ? krayon/core/Makefile=0A= ? krayon/data/Makefile.in=0A= ? krayon/data/Makefile=0A= ? krayon/data/brushes/Makefile.in=0A= ? krayon/data/brushes/Makefile=0A= ? krayon/data/images/Makefile.in=0A= ? krayon/data/images/Makefile=0A= ? krayon/data/patterns/Makefile.in=0A= ? krayon/data/patterns/Makefile=0A= ? krayon/dtd/Makefile.in=0A= ? krayon/dtd/Makefile=0A= ? krayon/pics/Makefile.in=0A= ? krayon/pics/Makefile=0A= ? krayon/plugins/Makefile.in=0A= ? krayon/plugins/Makefile=0A= ? krayon/plugins/example/Makefile.in=0A= ? krayon/plugins/example/Makefile=0A= ? krayon/test/Makefile.in=0A= ? krayon/test/Makefile=0A= ? krayon/tools/Makefile.in=0A= ? krayon/tools/Makefile=0A= ? krayon/ui/Makefile.in=0A= ? krayon/ui/Makefile=0A= ? kword/serialletter/Makefile.in=0A= ? kword/serialletter/Makefile=0A= ? kword/serialletter/sql/Makefile.in=0A= ? kword/serialletter/sql/Makefile=0A= ? kword/serialletter/sql/qtsqldatasourceeditor.h=0A= ? kword/serialletter/sql/qtsqlopenwidget.h=0A= ? kword/serialletter/sql/kwqtsqlpower.h=0A= ? kword/serialletter/sql/serialletter_qtsql_base.kidl=0A= ? kword/serialletter/sql/serialletter_qtsql_base_skel.cc=0A= ? kword/serialletter/sql/qtsqldatasourceeditor.cc=0A= ? kword/serialletter/sql/qtsqlopenwidget.cc=0A= ? kword/serialletter/sql/serialletter_qtsql_power_plugin.kidl=0A= ? kword/serialletter/sql/serialletter_qtsql_power_plugin_skel.cc=0A= ? kword/serialletter/sql/kwqtsqlpower.cc=0A= ? tools/thumbnail/kofficecreator.cpp=0A= ? tools/thumbnail/kofficecreator.h=0A= ? tools/thumbnail/kofficethumbnail.desktop=0A= ? tools/thumbnail/otherofficethumbnail.desktop=0A= Index: kpresenter/kpresenter_doc.cc=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /home/kde/koffice/kpresenter/kpresenter_doc.cc,v=0A= retrieving revision 1.436=0A= diff -u -3 -p -r1.436 kpresenter_doc.cc=0A= --- kpresenter/kpresenter_doc.cc 2002/03/03 17:33:02 1.436=0A= +++ kpresenter/kpresenter_doc.cc 2002/03/04 17:36:27=0A= @@ -189,7 +189,7 @@ KPresenterDoc::KPresenterDoc( QWidget *p=0A= emit sig_changeActivePage(newpage );=0A= m_stickyPage=3Dnew KPrPage(this);=0A= objStartY =3D 0;=0A= - setPageLayout( _pageLayout );=0A= + setPageLayout( m_pageLayout );=0A= _presPen =3D QPen( red, 3, SolidLine );=0A= presSpeed =3D 2;=0A= ignoreSticky =3D TRUE;=0A= @@ -406,18 +406,18 @@ QDomDocument KPresenterDoc::saveXML()=0A= presenter.setAttribute("syntaxVersion", = CURRENT_SYNTAX_VERSION);=0A= doc.appendChild(presenter);=0A= QDomElement paper=3Ddoc.createElement("PAPER");=0A= - paper.setAttribute("format", static_cast( _pageLayout.format = ));=0A= - paper.setAttribute("ptWidth", _pageLayout.ptWidth);=0A= - paper.setAttribute("ptHeight", _pageLayout.ptHeight);=0A= + paper.setAttribute("format", static_cast( m_pageLayout.format = ));=0A= + paper.setAttribute("ptWidth", m_pageLayout.ptWidth);=0A= + paper.setAttribute("ptHeight", m_pageLayout.ptHeight);=0A= =0A= - paper.setAttribute("orientation", static_cast( = _pageLayout.orientation ));=0A= + paper.setAttribute("orientation", static_cast( = m_pageLayout.orientation ));=0A= paper.setAttribute("unit", m_unit );=0A= QDomElement paperBorders=3Ddoc.createElement("PAPERBORDERS");=0A= =0A= - paperBorders.setAttribute("ptLeft", _pageLayout.ptLeft);=0A= - paperBorders.setAttribute("ptTop", _pageLayout.ptTop);=0A= - paperBorders.setAttribute("ptRight", _pageLayout.ptRight);=0A= - paperBorders.setAttribute("ptBottom", _pageLayout.ptBottom);=0A= + paperBorders.setAttribute("ptLeft", m_pageLayout.ptLeft);=0A= + paperBorders.setAttribute("ptTop", m_pageLayout.ptTop);=0A= + paperBorders.setAttribute("ptRight", m_pageLayout.ptRight);=0A= + paperBorders.setAttribute("ptBottom", m_pageLayout.ptBottom);=0A= paper.appendChild(paperBorders);=0A= presenter.appendChild(paper);=0A= =0A= @@ -1579,7 +1579,7 @@ bool KPresenterDoc::completeLoading( KoS=0A= setPageLayout( __pgLayout );=0A= }=0A= else=0A= - setPageLayout( _pageLayout );=0A= + setPageLayout( m_pageLayout );=0A= }=0A= recalcVariables( VT_FIELD );=0A= return true;=0A= @@ -1645,7 +1645,7 @@ void KPresenterDoc::setPageLayout( KoPag=0A= // if ( _pageLayout =3D=3D pgLayout )=0A= // return;=0A= =0A= - _pageLayout =3D pgLayout;=0A= + m_pageLayout =3D pgLayout;=0A= =0A= //for ( int i =3D 0; i < static_cast( m_pageList.count() ); = i++ )=0A= // m_pageList.at( i )->updateBackgroundSize();=0A= @@ -1773,12 +1773,12 @@ QValueList KPresenterDoc::reorderPa=0A= /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D get size of = page = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D*/=0A= QRect KPresenterDoc::getPageRect( bool decBorders ) const=0A= {=0A= - int pw, ph, bl =3D static_cast(_pageLayout.ptLeft);=0A= - int br =3D static_cast(_pageLayout.ptRight);=0A= - int bt =3D static_cast(_pageLayout.ptTop);=0A= - int bb =3D static_cast(_pageLayout.ptBottom);=0A= - int wid =3D static_cast(_pageLayout.ptWidth);=0A= - int hei =3D static_cast(_pageLayout.ptHeight);=0A= + int pw, ph, bl =3D static_cast(m_pageLayout.ptLeft);=0A= + int br =3D static_cast(m_pageLayout.ptRight);=0A= + int bt =3D static_cast(m_pageLayout.ptTop);=0A= + int bb =3D static_cast(m_pageLayout.ptBottom);=0A= + int wid =3D static_cast(m_pageLayout.ptWidth);=0A= + int hei =3D static_cast(m_pageLayout.ptHeight);=0A= =0A= if ( !decBorders ) {=0A= br =3D 0;=0A= @@ -1796,24 +1796,24 @@ QRect KPresenterDoc::getPageRect( bool d=0A= = /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/=0A= int KPresenterDoc::getLeftBorder() const=0A= {=0A= - return static_cast(_pageLayout.ptLeft);=0A= + return static_cast(m_pageLayout.ptLeft);=0A= }=0A= =0A= = /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/=0A= int KPresenterDoc::getTopBorder() const=0A= {=0A= - return static_cast(_pageLayout.ptTop);=0A= + return static_cast(m_pageLayout.ptTop);=0A= }=0A= =0A= = /*=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D*/=0A= int KPresenterDoc::getBottomBorder() const=0A= {=0A= - return static_cast(_pageLayout.ptBottom);=0A= + return static_cast(m_pageLayout.ptBottom);=0A= }=0A= =0A= int KPresenterDoc::getRightBorder() const=0A= {=0A= - return static_cast(_pageLayout.ptRight);=0A= + return static_cast(m_pageLayout.ptRight);=0A= }=0A= =0A= =0A= @@ -2437,8 +2437,8 @@ void KPresenterDoc::updateRulerPageLayou=0A= QPtrListIterator it( views() );=0A= for (; it.current(); ++it )=0A= {=0A= - = ((KPresenterView*)it.current())->getHRuler()->setPageLayout(_pageLayout = );=0A= - ((KPresenterView*)it.current())->getVRuler()->setPageLayout( = _pageLayout );=0A= + = ((KPresenterView*)it.current())->getHRuler()->setPageLayout(m_pageLayout= );=0A= + = ((KPresenterView*)it.current())->getVRuler()->setPageLayout(m_pageLayout= );=0A= =0A= }=0A= =0A= Index: kpresenter/kpresenter_doc.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /home/kde/koffice/kpresenter/kpresenter_doc.h,v=0A= retrieving revision 1.227=0A= diff -u -3 -p -r1.227 kpresenter_doc.h=0A= --- kpresenter/kpresenter_doc.h 2002/03/03 16:16:13 1.227=0A= +++ kpresenter/kpresenter_doc.h 2002/03/04 17:36:27=0A= @@ -121,8 +121,6 @@ public:=0A= void createHeaderFooter();=0A= void updateHeaderFooterPosition();=0A= =0A= - KoPageLayout pageLayout() const { return _pageLayout; }=0A= -=0A= bool insertNewTemplate( bool clean=3Dfalse );=0A= =0A= const QPtrList & getPageList() const {return = m_pageList;}=0A= @@ -376,9 +374,6 @@ protected:=0A= QString filename;=0A= QString pix_string;=0A= };=0A= -=0A= - // page layout=0A= - KoPageLayout _pageLayout;=0A= =0A= // screenpresentations=0A= bool _spInfinitLoop, _spManualSwitch, = _showPresentationDuration;=0A= Index: kword/kwdoc.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /home/kde/koffice/kword/kwdoc.h,v=0A= retrieving revision 1.146=0A= diff -u -3 -p -r1.146 kwdoc.h=0A= --- kword/kwdoc.h 2002/02/28 20:16:24 1.146=0A= +++ kword/kwdoc.h 2002/03/04 17:36:28=0A= @@ -162,7 +162,6 @@ public:=0A= void setPageLayout( const KoPageLayout& _layout, const KoColumns& = _cl, const KoKWHeaderFooter& _hf );=0A= =0A= void getPageLayout( KoPageLayout& _layout, KoColumns& _cl, = KoKWHeaderFooter& _hf );=0A= - KoPageLayout pageLayout() const { return m_pageLayout; }=0A= =0A= KWTextFrameSet * textFrameSet ( unsigned int _num ) const;=0A= // Return the frameset number @p _num=0A= @@ -554,7 +553,6 @@ private:=0A= QPtrList m_lstViews;=0A= QPtrList m_lstChildren;=0A= =0A= - KoPageLayout m_pageLayout;=0A= KoColumns m_pageColumns;=0A= KoKWHeaderFooter m_pageHeaderFooter;=0A= =0A= Index: lib/kofficecore/koDocument.cc=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /home/kde/koffice/lib/kofficecore/koDocument.cc,v=0A= retrieving revision 1.200=0A= diff -u -3 -p -r1.200 koDocument.cc=0A= --- lib/kofficecore/koDocument.cc 2002/03/02 20:39:19 1.200=0A= +++ lib/kofficecore/koDocument.cc 2002/03/04 17:36:28=0A= @@ -185,6 +185,13 @@ KoDocument::KoDocument( QWidget * parent=0A= }=0A= =0A= d->m_docInfo =3D new KoDocumentInfo( this, "document info" );=0A= +=0A= + m_pageLayout.ptWidth =3D 0;=0A= + m_pageLayout.ptHeight =3D 0;=0A= + m_pageLayout.ptTop =3D 0;=0A= + m_pageLayout.ptBottom =3D 0;=0A= + m_pageLayout.ptLeft =3D 0;=0A= + m_pageLayout.ptRight =3D 0;=0A= }=0A= =0A= KoDocument::~KoDocument()=0A= Index: lib/kofficecore/koDocument.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /home/kde/koffice/lib/kofficecore/koDocument.h,v=0A= retrieving revision 1.105=0A= diff -u -3 -p -r1.105 koDocument.h=0A= --- lib/kofficecore/koDocument.h 2002/03/02 20:39:19 1.105=0A= +++ lib/kofficecore/koDocument.h 2002/03/04 17:36:28=0A= @@ -28,6 +28,7 @@ using namespace std;=0A= #include =0A= #include =0A= #include =0A= +#include =0A= =0A= class QDomElement;=0A= class QDomDocument;=0A= @@ -440,6 +441,8 @@ public:=0A= */=0A= virtual bool isStoredExtern();=0A= =0A= + KoPageLayout pageLayout() const { return m_pageLayout; }=0A= +=0A= signals:=0A= /**=0A= * This signal is emitted, if a direct or indirect child document = changes=0A= @@ -570,6 +573,8 @@ protected:=0A= =0A= /** @internal */=0A= virtual void insertChild(QObject *o) { QObject::insertChild(o); }=0A= +=0A= + KoPageLayout m_pageLayout;=0A= =0A= private slots:=0A= void slotChildChanged( KoChild *c );=0A= Index: tools/thumbnail/Makefile.am=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /home/kde/koffice/tools/thumbnail/Makefile.am,v=0A= retrieving revision 1.2=0A= diff -u -3 -p -r1.2 Makefile.am=0A= --- tools/thumbnail/Makefile.am 2001/09/20 17:01:35 1.2=0A= +++ tools/thumbnail/Makefile.am 2002/03/04 17:36:28=0A= @@ -1,11 +1,16 @@=0A= -INCLUDES =3D $(KOFFICE_INCLUDES) $(all_includes)=0A= +INCLUDES =3D $(KOFFICE_INCLUDES) $(all_includes) -I../../kword/ = -I../../kpresenter -I../../lib/kotext=0A= LDFLAGS =3D $(all_libraries) $(KDE_RPATH)=0A= METASOURCES =3D AUTO=0A= =0A= -kde_module_LTLIBRARIES =3D clipartthumbnail.la=0A= +kde_module_LTLIBRARIES =3D clipartthumbnail.la kofficethumbnail.la=0A= =0A= clipartthumbnail_la_SOURCES =3D clipartcreator.cpp=0A= clipartthumbnail_la_LIBADD =3D $(LIB_KOFFICECORE) # for = KoClipartCollection=0A= clipartthumbnail_la_LDFLAGS =3D $(all_libraries) -module = $(KDE_PLUGIN)=0A= =0A= -kde_services_DATA =3D clipartthumbnail.desktop=0A= +kofficethumbnail_la_SOURCES =3D kofficecreator.cpp=0A= +kofficethumbnail_la_LIBADD =3D $(LIB_KOFFICECORE)=0A= +kofficethumbnail_la_LDFLAGS =3D $(all_libraries) -module = $(KDE_PLUGIN)=0A= +=0A= +kde_services_DATA =3D clipartthumbnail.desktop = kofficethumbnail.desktop otherofficethumbnail.desktop=0A= +=0A= ------_=_NextPart_000_01C1C3A5.1987B9B0 Content-Type: application/octet-stream; name="kofficecreator.cpp" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="kofficecreator.cpp" /* This file is part of the KDE libraries=0A= Copyright (C) 2002 Simon MacMullen=0A= =0A= This library is free software; you can redistribute it and/or=0A= modify it under the terms of the GNU Library General Public=0A= License as published by the Free Software Foundation; either=0A= version 2 of the License, or (at your option) any later version.=0A= =0A= This library is distributed in the hope that it will be useful,=0A= but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the = GNU=0A= Library General Public License for more details.=0A= =0A= You should have received a copy of the GNU Library General Public = License=0A= along with this library; see the file COPYING.LIB. If not, write = to=0A= the Free Software Foundation, Inc., 59 Temple Place - Suite 330,=0A= Boston, MA 02111-1307, USA.=0A= */=0A= =0A= // $Id: htmlcreator.cpp,v 1.7 2001/12/29 17:22:21 mueller Exp $=0A= =0A= #include =0A= =0A= #include =0A= #include =0A= #include =0A= =0A= #include =0A= #include =0A= #include =0A= #include =0A= #include =0A= #include =0A= #include =0A= #include =0A= #include "kofficecreator.h"=0A= =0A= extern "C"=0A= {=0A= ThumbCreator *new_creator()=0A= {=0A= return new KOfficeCreator;=0A= }=0A= };=0A= =0A= KOfficeCreator::KOfficeCreator()=0A= : m_doc(0)=0A= {=0A= }=0A= =0A= KOfficeCreator::~KOfficeCreator()=0A= {=0A= delete m_doc;=0A= }=0A= =0A= bool KOfficeCreator::create(const QString &path, int width, int height, = QImage &img)=0A= {=0A= KFileItem document ( KFileItem::Unknown, KFileItem::Unknown, = path);=0A= =0A= // Copied straight from the tutorial=0A= KTrader::OfferList offers =3D = KTrader::self()->query(document.mimetype(),=0A= "'KOfficePart' in = ServiceTypes");=0A= KLibFactory *factory =3D 0;=0A= KTrader::OfferList::Iterator it(offers.begin());=0A= for( ; it !=3D offers.end(); ++it) {=0A= KService::Ptr ptr =3D (*it);=0A= =0A= factory =3D KLibLoader::self()->factory( = ptr->library().latin1() );=0A= if (factory) {=0A= m_doc =3D static_cast(factory->create(0,=0A= ptr->name().latin1(), = "KParts::ReadOnlyPart"));=0A= break;=0A= }=0A= }=0A= =0A= if (!m_doc) return false;=0A= =0A= connect(m_doc, SIGNAL(completed()), SLOT(slotCompleted()));=0A= =0A= m_doc->openURL(path);=0A= m_completed =3D false;=0A= startTimer(5000);=0A= while (!m_completed)=0A= kapp->processOneEvent();=0A= killTimers();=0A= =0A= double docWidth, docHeight;=0A= int dpi =3D 75; // FIXME=0A= =0A= KoPageLayout layout =3D m_doc->pageLayout();=0A= =0A= if (layout.ptWidth > 1.0) {=0A= // for eg KWord we want the first page=0A= docWidth =3D layout.ptWidth / 72 * dpi;=0A= docHeight =3D layout.ptHeight / 72 * dpi;=0A= =0A= } else {=0A= // For eg kspread we just want the top left hand corner=0A= docWidth =3D 500.0;=0A= docHeight =3D 500.0;=0A= }=0A= =0A= double ratio =3D docWidth / docHeight;=0A= =0A= // render the page on a bigger pixmap and use smoothScale,=0A= // looks better than directly scaling with the QPainter (malte)=0A= QPixmap pix;=0A= if (width > 400)=0A= {=0A= pix.resize(width, (int)(width / ratio));=0A= }=0A= else=0A= pix.resize(400, (int)(400 / ratio));=0A= =0A= pix.fill( QColor( 245, 245, 245 ) );=0A= =0A= int borderX =3D pix.width() / width,=0A= borderY =3D pix.height() / height;=0A= QRect rc(borderX, borderY, pix.width() - borderX * 2, pix.height() = - borderY * 2);=0A= =0A= double zoomX =3D pix.width() / docWidth;=0A= double zoomY =3D pix.height() / docHeight;=0A= =0A= QPainter p;=0A= p.begin(&pix);=0A= m_doc->paintEverything(p, rc, false, 0, zoomX, zoomY);=0A= p.end();=0A= =0A= delete m_doc;=0A= m_doc =3D 0L;=0A= =0A= img =3D pix.convertToImage();=0A= return true;=0A= }=0A= =0A= void KOfficeCreator::timerEvent(QTimerEvent *)=0A= {=0A= m_doc->closeURL();=0A= m_completed =3D true;=0A= }=0A= =0A= void KOfficeCreator::slotCompleted()=0A= {=0A= m_completed =3D true;=0A= }=0A= =0A= ThumbCreator::Flags KOfficeCreator::flags() const=0A= {=0A= return (Flags)(DrawFrame | BlendIcon);=0A= }=0A= =0A= #include "kofficecreator.moc"=0A= =0A= ------_=_NextPart_000_01C1C3A5.1987B9B0 Content-Type: application/octet-stream; name="kofficecreator.h" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="kofficecreator.h" /* This file is part of the KDE libraries=0A= Copyright (C) 2002 Simon MacMullen=0A= =0A= This library is free software; you can redistribute it and/or=0A= modify it under the terms of the GNU Library General Public=0A= License as published by the Free Software Foundation; either=0A= version 2 of the License, or (at your option) any later version.=0A= =0A= This library is distributed in the hope that it will be useful,=0A= but WITHOUT ANY WARRANTY; without even the implied warranty of=0A= MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the = GNU=0A= Library General Public License for more details.=0A= =0A= You should have received a copy of the GNU Library General Public = License=0A= along with this library; see the file COPYING.LIB. If not, write = to=0A= the Free Software Foundation, Inc., 59 Temple Place - Suite 330,=0A= Boston, MA 02111-1307, USA.=0A= */=0A= =0A= #ifndef _KWORDCREATOR_H_=0A= #define _KWORDCREATOR_H_ "$Id: htmlcreator.h,v 1.4 2001/10/01 20:32:50 = faure Exp $"=0A= =0A= #include =0A= #include =0A= #include "../../lib/kofficecore/koDocument.h"=0A= =0A= class KoDocument;=0A= =0A= class KOfficeCreator : public QObject, public ThumbCreator=0A= {=0A= Q_OBJECT=0A= public:=0A= KOfficeCreator();=0A= virtual ~KOfficeCreator();=0A= virtual bool create(const QString &path, int width, int height, = QImage &img);=0A= virtual Flags flags() const;=0A= =0A= protected:=0A= virtual void timerEvent(QTimerEvent *);=0A= =0A= private slots:=0A= void slotCompleted();=0A= =0A= private:=0A= KoDocument *m_doc;=0A= bool m_completed;=0A= };=0A= =0A= #endif=0A= ------_=_NextPart_000_01C1C3A5.1987B9B0 Content-Type: application/octet-stream; name="kofficethumbnail.desktop" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="kofficethumbnail.desktop" [Desktop Entry]=0A= Encoding=3DUTF-8=0A= Type=3DService=0A= Name=3DKOffice Files=0A= ServiceTypes=3DThumbCreator=0A= MimeTypes=3Dapplication/x-kword,application/x-kspread,application/x-kpre= senter=0A= X-KDE-Library=3Dkofficethumbnail=0A= CacheThumbnail=3Dtrue=0A= ------_=_NextPart_000_01C1C3A5.1987B9B0 Content-Type: application/octet-stream; name="otherofficethumbnail.desktop" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="otherofficethumbnail.desktop" [Desktop Entry]=0A= Encoding=3DUTF-8=0A= Type=3DService=0A= Name=3DOther Office Files=0A= ServiceTypes=3DThumbCreator=0A= MimeTypes=3Dapplication/msword,application/msexcel=0A= X-KDE-Library=3Dkofficethumbnail=0A= CacheThumbnail=3Dtrue=0A= ------_=_NextPart_000_01C1C3A5.1987B9B0-- _______________________________________________ koffice-devel mailing list koffice-devel@mail.kde.org http://mail.kde.org/mailman/listinfo/koffice-devel