[prev in list] [next in list] [prev in thread] [next in thread]
List: koffice-devel
Subject: Re: KOffice 1.3.1
From: Karl-Heinz Zimmer <khz () kde ! org>
Date: 2004-04-13 9:34:38
Message-ID: 200404131134.39977 () postmaster ! bugcops ! org
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Dienstag, 13. April 2004 11:24, Karl-Heinz Zimmer wrote:
> On Dienstag, 13. April 2004 11:14, Karl-Heinz Zimmer wrote:
> > On Montag, 12. April 2004 12:50, LukᨠTinkl wrote:
> > > Hi,
> > > I've prepared a test tarball of the upcoming KOffice 1.3.1 bugfix
> > > release. You can find it in
> > > http://developer.kde.org/~lukas/koffice/koffice-1.3.1.tar.bz2; please
> > > test and report any problems to me.
> >
> > Panik!
> >
> > Stupidly I forgot to add my last patch to the 1.3 branch. :-(
> > Lukᨠtold me weeks ago that it would be OK to have it in this branch
> > but due to other issues I never comitted it there.
> >
> > Is there any chance to have it added still now?
>
> Sorry, forgot to tell you _why_ I really would like to have this patch
> in there: Since release of IndeView in Feb.2004 we have had thousands
> of downloads (30 - 300 per day) of the tarball from our english/spanish/
> german webpage http://www.indeview.org
OOPS, that was a wrong patch file - please use the attached one for your
testing...
Cheers,
Karl-Heinz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)
iD8DBQFAe7QuCcaVnbvggDcRAjojAJkBy1AXifxsENrDlMzYIb78d70hywCglfBb
YKcMNJT5a4V1dnIbBTaWdVQ=
=box8
-----END PGP SIGNATURE-----
["DCOP_enabled_exportPage_method_for_KPrCanvas_1_3_1.patch" (text/x-diff)]
Index: KPresenterViewIface.cc
===================================================================
RCS file: /home/kde/koffice/kpresenter/KPresenterViewIface.cc,v
retrieving revision 1.53
diff -r1.53 KPresenterViewIface.cc
23a24,25
> #include "kprcanvas.h"
> #include "kprpage.h"
588a591,636
> // note: _nPage is the user visible 1-based page number
> // if 0 < _verbose exportPage() returns the title and notes of the page
> // if not verbose it returns an empty string
> QStringList KPresenterViewIface::exportPage( int _nPage,
> int _nWidth,
> int _nHeight,
> const QString & _fileName,
> const QString & _format,
> int _quality,
> int _verbose )const
> {
> QStringList res;
> // we translate the user visible 1-based page number
> // to KPresenter's internal 0-based page number
> const int nPage = _nPage-1;
> if( 0 <= nPage &&
> view &&
> view->kPresenterDoc() &&
> nPage < (int)view->kPresenterDoc()->getPageNums() ){
> KPrCanvas* canvas = view->getCanvas();
> if( canvas ){
> if( canvas->exportPage( nPage,
> QMAX(8, _nWidth),
> QMAX(8, _nHeight),
> KURL::fromPathOrURL( _fileName ),
> _format.isEmpty() ? "PNG" : _format.latin1(),
> QMAX(-1, QMIN(100, _quality))) ){
> if( 0 < _verbose ){
> KPrPage* page = view->kPresenterDoc()->pageList().at( nPage );
> if( page ){
> // Note: Do not i18n the following strings, they are prepared
> // to be written to an IndeView page information file,
> // see http://www.indeview.org for details.
> // Note: We use the 1-based page number as fallback page title.
> res << QString("Name=%1")
> .arg( page->pageTitle( QString("Page%1").arg(_nPage) ) );
> res << QString("Notes=%1")
> .arg( page->noteText() );
> }
> }
> }
> }
> }
> return res;
> }
>
Index: KPresenterViewIface.h
===================================================================
RCS file: /home/kde/koffice/kpresenter/KPresenterViewIface.h,v
retrieving revision 1.53
diff -r1.53 KPresenterViewIface.h
26a27
> #include <qstringlist.h>
181a183,211
>
> /**
> \brief Save page to bitmap file.
>
> Export a page of the currently open presentation to disk
> using a bitmap format like e.g. PNG.
> This method uses a QPixmap::save() call.
>
> \param _nPage the user visible <b>1-based</b> page number
> \param _nWidth the desired image width in px
> \param _nHeight the desired image height in px
> \param _fileName the name of the image file to be created (see QPixmap::save())
> \param _format the format of the image file (see QPixmap::save())
> \param _quality the quality of the image (see QPixmap::save())
> \param _verbose the verbosity of the method's return value:
> if 0 < _verbose exportPage() returns the title and the notes of the page
> if not _verbose it returns an empty string
>
> \returns Page title and page notes if the file was written successfully.
>
> \sa KPrCanvas::exportPage
> */
> QStringList exportPage( int _nPage,
> int _nWidth,
> int _nHeight,
> const QString & _fileName,
> const QString & _format,
> int _quality,
> int _verbose )const;
Index: kprcanvas.cc
===================================================================
RCS file: /home/kde/koffice/kpresenter/kprcanvas.cc,v
retrieving revision 1.377.2.7
diff -r1.377.2.7 kprcanvas.cc
2411a2412,2465
> bool KPrCanvas::exportPage( int nPage,
> int nWidth,
> int nHeight,
> const KURL& _fileURL,
> const char* format,
> int quality )
> {
> bool res = false;
> const QCursor oldCursor( cursor() );
> setCursor( waitCursor );
> QPixmap pix( nWidth, nHeight );
> drawPageInPix( pix, nPage, 0, true, nWidth, nHeight );
> if( !pix.isNull() ){
> // Depending on the desired target size due to rounding
> // errors during zoom the resulting pixmap *might* be
> // 1 pixel or 2 pixels wider/higher than desired: we just
> // remove the additional columns/rows. This can be done
> // since KPresenter is leaving a minimal border below/at
> // the right of the image anyway.
> const QSize desiredSize(nWidth, nHeight);
> if( desiredSize != pix.size() )
> pix.resize( desiredSize );
> // save the pixmap to the desired file
> KURL fileURL(_fileURL);
> if( fileURL.protocol().isEmpty() )
> fileURL.setProtocol( "file" );
> const bool bLocalFile = fileURL.isLocalFile();
> KTempFile* tmpFile = bLocalFile ? NULL : new KTempFile();
> if( !bLocalFile )
> tmpFile->setAutoDelete( true );
> if( bLocalFile || 0 == tmpFile->status() ){
> QFile file( bLocalFile ? fileURL.path(0) : tmpFile->name() );
> if ( file.open( IO_ReadWrite ) ) {
> res = pix.save( &file, format, quality );
> file.close();
> }
> if( !bLocalFile ){
> if( res ){
> #if KDE_IS_VERSION(3,1,90)
> res = KIO::NetAccess::upload( this, tmpFile->name(), fileURL );
> #else
> res = KIO::NetAccess::upload( tmpFile->name(), fileURL, this );
> #endif
> }
> }
> }
> if( !bLocalFile ){
> delete tmpFile;
> }
> }
> setCursor( oldCursor );
> return res;
> }
>
3380c3434,3441
< void KPrCanvas::drawPageInPix( QPixmap &_pix, int pgnum, int zoom, bool forceRealVariableValue )
---
> // Set forceWidth and/or forceHeight to override the zoom factor
> // and obtain a pixmap of the specified width and/or height.
> // By omitting one of them you make sure that the aspect ratio
> // of your page is used for the resulting image.
> void KPrCanvas::drawPageInPix( QPixmap &_pix, int pgnum, int zoom,
> bool forceRealVariableValue,
> int forceWidth,
> int forceHeight )
3385c3446,3447
< int oldZoom = m_view->kPresenterDoc()->zoomHandler()->zoom();
---
> KPresenterDoc *doc = m_view->kPresenterDoc();
> int oldZoom = doc->zoomHandler()->zoom();
3387c3449,3473
< m_view->zoomDocument(zoom);
---
>
> if( 0 < forceWidth || 0 < forceHeight )
> {
> const QRect rect( doc->getPageRect( true ) );
> const double dRectHeight = static_cast<double>(rect.height());
> const double dRectWidth = static_cast<double>(rect.width());
> double dForceHeight = static_cast<double>(forceHeight);
> double dForceWidth = static_cast<double>(forceWidth);
>
> // adjust width or height, in case one of them is missing
> if( 0 >= forceWidth )
> dForceWidth = dForceHeight * dRectWidth / dRectHeight;
> else if( 0 >= forceHeight )
> dForceHeight = dForceWidth * dRectHeight / dRectWidth;
>
> // set the stretching values
> doc->zoomHandler()->setResolution( dForceWidth / dRectWidth,
> dForceHeight / dRectHeight );
> // As of yet (Feb. 2004) the following call results
> // in a NOP but be prepared for the future...
> doc->newZoomAndResolution( false, false );
> }else{
> m_view->zoomDocument(zoom);
> }
>
3428d3513
< KPresenterDoc *doc = m_view->kPresenterDoc();
Index: kprcanvas.h
===================================================================
RCS file: /home/kde/koffice/kpresenter/kprcanvas.h,v
retrieving revision 1.143.2.2
diff -r1.143.2.2 kprcanvas.h
151c151,196
< void drawPageInPix( QPixmap&, int pgnum, int zoom, bool forceRealVariableValue = false );
---
> /**
> \brief Draw page into QPixmap.
>
> Draws page pgnum of the currently open presentation into a QPixmap
> using the specified zoom factor (or fixed width/height dimensions, resp.)
>
> Set forceWidth and/or forceHeight to override the zoom factor
> and obtain a pixmap of the specified width and/or height.
> By omitting one of them you make sure that the aspect ratio
> of your page is used for the resulting image.
>
> \sa exportPage
> */
> void drawPageInPix( QPixmap&, int pgnum, int zoom,
> bool forceRealVariableValue = false,
> int forceWidth = 0,
> int forceHeight = 0 );
>
> /**
> \brief Save page to bitmap file.
>
> Export a page of the currently open presentation to disk
> using a bitmap format like e.g. PNG.
> This method uses a QPixmap::save() call.
>
> \param nPage the internally used <b>0-based</b> page number
> \param nWidth the desired image width in px
> \param nHeight the desired image height in px
> \param fileURL the URL of the image file to be created: if this
> does not point to a local file a KTempFile is created by QPixmap::save()
> which is then copied over to the desired location.
> \param format the format of the image file (see QPixmap::save())
> \param quality the quality of the image (see QPixmap::save())
>
> example:
> \verbatim
> exportPage( 0, s, 800, 600, "/home/khz/page0.png", "PNG", 100 );
> \endverbatim
> \returns True if the file was written successfully.
>
> \sa drawPageInPix, KPresenterViewIface::exportPage
> */
> bool exportPage( int nPage, int nWidth, int nHeight,
> const KURL& fileURL,
> const char* format,
> int quality = -1 );
_______________________________________________
koffice-devel mailing list
koffice-devel@mail.kde.org
https://mail.kde.org/mailman/listinfo/koffice-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic