~ubuntu-branches/ubuntu/maverick/scribus-ng/maverick-backports

« back to all changes in this revision

Viewing changes to scribus/scprintengine_gdi.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Oleksandr Moskalenko
  • Date: 2010-07-15 12:43:00 UTC
  • mfrom: (0.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20100715124300-2u304r2rvy55vpkv
Tags: 1.3.7.dfsg~svn20100715-1
* Upstream svn. update.
* debian/scribus-ng.lintian: Updated overrides.
* debian/control: Updated standards version to 3.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#error "This file compiles on win32 platform only!"
13
13
#endif
14
14
 
 
15
#include <algorithm>
15
16
#include <memory>
16
17
#include <valarray>
17
18
#include <windows.h>
471
472
                double bleedH = options.bleeds.Left + options.bleeds.Right;
472
473
                double bleedV = options.bleeds.Top  + options.bleeds.Bottom;
473
474
                StartPage( printerDC );
474
 
                succeed = sendPSFile( tempFilePath, printerDC, page->width() + bleedH, page->height() + bleedV);
 
475
                succeed = sendPSFile( tempFilePath, printerDC, page->width() + bleedH, page->height() + bleedV, (page->PageOri == 1));
475
476
                EndPage( printerDC );
476
477
        }
477
478
        
497
498
        return succeed;
498
499
}
499
500
 
500
 
bool ScPrintEngine_GDI::sendPSFile( QString filePath, HDC printerDC, int pageWidth, int pageHeight  )
 
501
bool ScPrintEngine_GDI::sendPSFile( QString filePath, HDC printerDC, int pageWidth, int pageHeight, bool landscape )
501
502
{
502
503
        int  escape;
503
504
        int  logPixelsX;
553
554
        if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
554
555
                return false;
555
556
 
 
557
        // Match Postscript and GDI coordinate system
 
558
        sprintf( (char*) sps.data, "0 %0.3f neg translate\n", (double) physicalHeight );
 
559
        sps.numBytes = strlen( (char*) sps.data );
 
560
        if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
 
561
                return false;
 
562
 
 
563
        // In case of landscape printing, pslib will rotate the page
 
564
        // we must take that into account
 
565
        if (landscape)
 
566
        {
 
567
                sprintf( (char*) sps.data, "-90 rotate %0.3f %0.3f translate\n", (double) -pageHeight, 0.0);
 
568
                sps.numBytes = strlen( (char*) sps.data );
 
569
                if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )
 
570
                        return false;
 
571
                transx = ( physicalHeight - pageHeight ) / -2.0;
 
572
                transy = ( physicalWidth  - pageWidth ) / 2.0;
 
573
        }
 
574
        else
 
575
        {
 
576
                transx = ( physicalWidth  - pageWidth ) / 2.0;
 
577
                transy = ( physicalHeight - pageHeight ) / 2.0;
 
578
        }
 
579
 
556
580
        // Center the printed page in paper zone
557
 
        transx = ( physicalWidth - pageWidth ) / 2.0;
558
 
        transy = ( pageHeight - physicalHeight ) / 2.0 - pageHeight;
559
581
        sprintf( (char*) sps.data, "%0.3f %0.3f translate\n", transx, transy );
560
582
        sps.numBytes = strlen( (char*) sps.data );
561
583
        if( ExtEscape( printerDC, escape, sizeof(sps), (LPCSTR) &sps, 0, NULL) <= 0 )