summaryrefslogtreecommitdiff
path: root/psprint
diff options
context:
space:
mode:
authorPhilipp Lohmann <pl@openoffice.org>2002-11-13 19:15:46 +0000
committerPhilipp Lohmann <pl@openoffice.org>2002-11-13 19:15:46 +0000
commit847a6fbf65572061d02bd4dc5c3d76475b5ab38f (patch)
tree34082114282d5aebd9cd16c822165a8f506efff8 /psprint
parentf74a243257338191654789abb10c62d591d64bc0 (diff)
#i9060# use single logical resolution
Diffstat (limited to 'psprint')
-rw-r--r--psprint/inc/psprint/ppdparser.hxx6
-rw-r--r--psprint/inc/psprint/printergfx.hxx7
-rw-r--r--psprint/inc/psprint/printerjob.hxx9
-rw-r--r--psprint/source/helper/ppdparser.cxx18
-rw-r--r--psprint/source/printergfx/common_gfx.cxx27
-rw-r--r--psprint/source/printergfx/printerjob.cxx21
6 files changed, 39 insertions, 49 deletions
diff --git a/psprint/inc/psprint/ppdparser.hxx b/psprint/inc/psprint/ppdparser.hxx
index bdee073180d5..0e5d85305747 100644
--- a/psprint/inc/psprint/ppdparser.hxx
+++ b/psprint/inc/psprint/ppdparser.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ppdparser.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: pl $ $Date: 2001-05-08 11:45:33 $
+ * last change: $Author: pl $ $Date: 2002-11-13 20:15:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -324,7 +324,7 @@ public:
void rebuildFromStreamBuffer( void* pBuffer, ULONG nBytes );
// convenience
- void getResolution( int& rDPIx, int& rDPIy ) const;
+ int getRenderResolution() const;
// width, height in points, paper will contain the name of the selected
// paper after the call
diff --git a/psprint/inc/psprint/printergfx.hxx b/psprint/inc/psprint/printergfx.hxx
index b7d582459410..bf2b2116fd94 100644
--- a/psprint/inc/psprint/printergfx.hxx
+++ b/psprint/inc/psprint/printergfx.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: printergfx.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: pl $ $Date: 2002-08-01 18:54:32 $
+ * last change: $Author: pl $ $Date: 2002-11-13 20:15:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -227,8 +227,7 @@ private:
double mfScaleX;
double mfScaleY;
- sal_uInt32 mnDpiX;
- sal_uInt32 mnDpiY;
+ sal_uInt32 mnDpi;
sal_uInt16 mnDepth;
sal_uInt16 mnPSLevel;
diff --git a/psprint/inc/psprint/printerjob.hxx b/psprint/inc/psprint/printerjob.hxx
index 1d903e350b59..cbc337e7cdcf 100644
--- a/psprint/inc/psprint/printerjob.hxx
+++ b/psprint/inc/psprint/printerjob.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: printerjob.hxx,v $
*
- * $Revision: 1.2 $
+ * $Revision: 1.3 $
*
- * last change: $Author: pl $ $Date: 2002-11-13 15:32:51 $
+ * last change: $Author: pl $ $Date: 2002-11-13 20:15:41 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -96,8 +96,7 @@ private: // private data
JobData m_aLastJobData;
- sal_uInt32 mnResX;
- sal_uInt32 mnResY;
+ sal_uInt32 mnResolution;
sal_uInt32 mnWidthPt;
sal_uInt32 mnHeightPt;
@@ -125,7 +124,7 @@ private: // private methods
public: // for usage in PrinterGfx
- void GetResolution (sal_uInt32 &rDpiX, sal_uInt32 &rDpiY) const;
+ sal_uInt32 GetResolution () const { return mnResolution; }
void GetScale (double &rXScale, double &rYScale) const;
sal_uInt16 GetDepth () const;
sal_uInt16 GetPostscriptLevel (const JobData *pJobData = NULL) const;
diff --git a/psprint/source/helper/ppdparser.cxx b/psprint/source/helper/ppdparser.cxx
index 2d5edfa7f86b..37ca7321e48f 100644
--- a/psprint/source/helper/ppdparser.cxx
+++ b/psprint/source/helper/ppdparser.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: ppdparser.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: pl $ $Date: 2002-11-13 15:34:13 $
+ * last change: $Author: pl $ $Date: 2002-11-13 20:15:43 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -1486,24 +1486,28 @@ void PPDContext::rebuildFromStreamBuffer( void* pBuffer, ULONG nBytes )
// -------------------------------------------------------------------
-void PPDContext::getResolution( int& rDPIx, int& rDPIy ) const
+int PPDContext::getRenderResolution() const
{
// initialize to reasonable default, if parser is not set
- rDPIx = rDPIy = 300;
+ int nDPI = 300;
if( m_pParser )
{
+ int nDPIx = 300, nDPIy = 300;
const PPDKey* pKey = m_pParser->getKey( String( RTL_CONSTASCII_USTRINGPARAM( "Resolution" ) ) );
if( pKey )
{
const PPDValue* pValue = getValue( pKey );
if( pValue )
- m_pParser->getResolutionFromString( pValue->m_aOption, rDPIx, rDPIy );
+ m_pParser->getResolutionFromString( pValue->m_aOption, nDPIx, nDPIy );
else
- m_pParser->getDefaultResolution( rDPIx, rDPIy );
+ m_pParser->getDefaultResolution( nDPIx, nDPIy );
}
else
- m_pParser->getDefaultResolution( rDPIx, rDPIy );
+ m_pParser->getDefaultResolution( nDPIx, nDPIy );
+
+ nDPI = (nDPIx > nDPIy) ? nDPIx : nDPIy;
}
+ return nDPI;
}
// -------------------------------------------------------------------
diff --git a/psprint/source/printergfx/common_gfx.cxx b/psprint/source/printergfx/common_gfx.cxx
index b961a9eb435a..c973e2b1f717 100644
--- a/psprint/source/printergfx/common_gfx.cxx
+++ b/psprint/source/printergfx/common_gfx.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: common_gfx.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: pl $ $Date: 2002-10-01 10:06:17 $
+ * last change: $Author: pl $ $Date: 2002-11-13 20:15:45 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -107,7 +107,7 @@ PrinterGfx::Init (PrinterJob &rPrinterJob)
mnPSLevel = rPrinterJob.GetPostscriptLevel ();
mbColor = rPrinterJob.IsColorPrinter ();
- rPrinterJob.GetResolution (mnDpiX, mnDpiY);
+ mnDpi = rPrinterJob.GetResolution();
rPrinterJob.GetScale (mfScaleX, mfScaleY);
const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( rPrinterJob.GetPrinterName() ) );
if( mpFontSubstitutes )
@@ -129,12 +129,10 @@ PrinterGfx::Init (const JobData& rData)
mnDepth = rData.m_nColorDepth;
mnPSLevel = rData.m_nPSLevel ? rData.m_nPSLevel : rData.m_pParser->getLanguageLevel();
mbColor = rData.m_nColorDevice ? ( rData.m_nColorDevice == -1 ? sal_False : sal_True ) : ( rData.m_pParser->isColorDevice() ? sal_True : sal_False );
- int nResX, nResY;
- rData.m_aContext.getResolution( nResX, nResY );
- mnDpiX = nResX;
- mnDpiY = nResY;
- mfScaleX = (double)72.0 / (double)mnDpiX;
- mfScaleY = (double)72.0 / (double)mnDpiY;
+ int nRes = rData.m_aContext.getRenderResolution();
+ mnDpi = nRes;
+ mfScaleX = (double)72.0 / (double)mnDpi;
+ mfScaleY = (double)72.0 / (double)mnDpi;
const PrinterInfo& rInfo( PrinterInfoManager::get().getPrinterInfo( rData.m_aPrinterName ) );
if( mpFontSubstitutes )
delete const_cast< ::std::hash_map<fontID,fontID>* >(mpFontSubstitutes);
@@ -150,15 +148,15 @@ PrinterGfx::Init (const JobData& rData)
void
PrinterGfx::GetResolution (sal_Int32 &rDpiX, sal_Int32 &rDpiY) const
{
- rDpiX = mnDpiX;
- rDpiY = mnDpiY;
+ rDpiX = mnDpi;
+ rDpiY = mnDpi;
}
void
PrinterGfx::GetScreenFontResolution (sal_Int32 &rDpiX, sal_Int32 &rDpiY) const
{
- rDpiX = mnDpiX;
- rDpiY = mnDpiY;
+ rDpiX = mnDpi;
+ rDpiY = mnDpi;
}
sal_uInt16
@@ -216,8 +214,7 @@ PrinterGfx::Clear()
maFillColor = PrinterColor();
maTextColor = PrinterColor();
mbCompressBmp = sal_True;
- mnDpiX = 300;
- mnDpiY = 300;
+ mnDpi = 300;
mnDepth = 24;
mnPSLevel = 2;
mbColor = sal_True;
diff --git a/psprint/source/printergfx/printerjob.cxx b/psprint/source/printergfx/printerjob.cxx
index 0b65dec7fdcd..eaae5ac20546 100644
--- a/psprint/source/printergfx/printerjob.cxx
+++ b/psprint/source/printergfx/printerjob.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: printerjob.cxx,v $
*
- * $Revision: 1.19 $
+ * $Revision: 1.20 $
*
- * last change: $Author: pl $ $Date: 2002-11-13 15:32:53 $
+ * last change: $Author: pl $ $Date: 2002-11-13 20:15:46 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -171,13 +171,6 @@ PrinterJob::CreateSpoolFile (const rtl::OUString& rName, const rtl::OUString& rE
*/
void
-PrinterJob::GetResolution (sal_uInt32 &rDpiX, sal_uInt32 &rDpiY) const
-{
- rDpiX = mnResX;
- rDpiY = mnResY;
-}
-
-void
PrinterJob::GetScale (double &rXScale, double &rYScale) const
{
rXScale = mfXScale;
@@ -590,8 +583,7 @@ PrinterJob::AbortJob ()
void
PrinterJob::InitPaperSize (const JobData& rJobSetup)
{
- int nResX, nResY;
- rJobSetup.m_aContext.getResolution (nResX, nResY);
+ int nRes = rJobSetup.m_aContext.getRenderResolution ();
String aPaper;
int nWidth, nHeight;
@@ -602,8 +594,7 @@ PrinterJob::InitPaperSize (const JobData& rJobSetup)
if (pParser != NULL)
pParser->getMargins (aPaper, nLeft, nRight, nUpper, nLower);
- mnResX = nResX;
- mnResY = nResY;
+ mnResolution = nRes;
mnWidthPt = nWidth;
mnHeightPt = nHeight;
@@ -613,8 +604,8 @@ PrinterJob::InitPaperSize (const JobData& rJobSetup)
mnTMarginPt = nUpper;
mnBMarginPt = nLower;
- mfXScale = (double)72.0 / (double)mnResX;
- mfYScale = -1.0 * (double)72.0 / (double)mnResY;
+ mfXScale = (double)72.0 / (double)mnResolution;
+ mfYScale = -1.0 * (double)72.0 / (double)mnResolution;
}