forked from mirrors/gecko-dev
		
	Backed out changeset 2114a592360d (bug 675709) for bustage on OS X: use undeclared identifiers. r=backout on a CLOSED TREE
This commit is contained in:
		
							parent
							
								
									463433cf37
								
							
						
					
					
						commit
						deffc9f665
					
				
					 2 changed files with 2 additions and 241 deletions
				
			
		|  | @ -51,22 +51,8 @@ public: | ||||||
|   void SetInchesScale(float aWidthScale, float aHeightScale); |   void SetInchesScale(float aWidthScale, float aHeightScale); | ||||||
|   void GetInchesScale(float *aWidthScale, float *aHeightScale); |   void GetInchesScale(float *aWidthScale, float *aHeightScale); | ||||||
| 
 | 
 | ||||||
|   NS_IMETHOD SetPaperSizeUnit(int16_t aPaperSizeUnit) override; |  | ||||||
| 
 |  | ||||||
|   NS_IMETHOD SetScaling(double aScaling) override; |  | ||||||
|   NS_IMETHOD SetToFileName(const char16_t * aToFileName) override; |  | ||||||
| 
 |  | ||||||
|   NS_IMETHOD GetOrientation(int32_t *aOrientation) override; |  | ||||||
|   NS_IMETHOD SetOrientation(int32_t aOrientation) override; |  | ||||||
| 
 |  | ||||||
|   NS_IMETHOD SetUnwriteableMarginTop(double aUnwriteableMarginTop) override; |  | ||||||
|   NS_IMETHOD SetUnwriteableMarginLeft(double aUnwriteableMarginLeft) override; |  | ||||||
|   NS_IMETHOD SetUnwriteableMarginBottom(double aUnwriteableMarginBottom) override; |  | ||||||
|   NS_IMETHOD SetUnwriteableMarginRight(double aUnwriteableMarginRight) override; |  | ||||||
| 
 |  | ||||||
|   void SetAdjustedPaperSize(double aWidth, double aHeight); |   void SetAdjustedPaperSize(double aWidth, double aHeight); | ||||||
|   void GetAdjustedPaperSize(double *aWidth, double *aHeight); |   void GetAdjustedPaperSize(double *aWidth, double *aHeight); | ||||||
|   nsresult SetCocoaPaperSize(double aWidth, double aHeight); |  | ||||||
| 
 | 
 | ||||||
| protected: | protected: | ||||||
|   virtual ~nsPrintSettingsX(); |   virtual ~nsPrintSettingsX(); | ||||||
|  | @ -77,8 +63,6 @@ protected: | ||||||
|   nsresult _Clone(nsIPrintSettings **_retval) override; |   nsresult _Clone(nsIPrintSettings **_retval) override; | ||||||
|   nsresult _Assign(nsIPrintSettings *aPS) override; |   nsresult _Assign(nsIPrintSettings *aPS) override; | ||||||
| 
 | 
 | ||||||
|   int GetCocoaUnit(int16_t aGeckoUnit); |  | ||||||
| 
 |  | ||||||
|   // The out param has a ref count of 1 on return so caller needs to PMRelase() when done.
 |   // The out param has a ref count of 1 on return so caller needs to PMRelase() when done.
 | ||||||
|   OSStatus CreateDefaultPageFormat(PMPrintSession aSession, PMPageFormat& outFormat); |   OSStatus CreateDefaultPageFormat(PMPrintSession aSession, PMPageFormat& outFormat); | ||||||
|   OSStatus CreateDefaultPrintSettings(PMPrintSession aSession, PMPrintSettings& outSettings); |   OSStatus CreateDefaultPrintSettings(PMPrintSession aSession, PMPrintSettings& outSettings); | ||||||
|  |  | ||||||
|  | @ -254,13 +254,8 @@ NS_IMETHODIMP nsPrintSettingsX::SetPaperHeight(double aPaperHeight) | ||||||
| NS_IMETHODIMP | NS_IMETHODIMP | ||||||
| nsPrintSettingsX::GetEffectivePageSize(double *aWidth, double *aHeight) | nsPrintSettingsX::GetEffectivePageSize(double *aWidth, double *aHeight) | ||||||
| { | { | ||||||
|   if (kPaperSizeInches == GetCocoaUnit(mPaperSizeUnit)) { |  | ||||||
|   *aWidth  = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale); |   *aWidth  = NS_INCHES_TO_TWIPS(mAdjustedPaperWidth / mWidthScale); | ||||||
|   *aHeight = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale); |   *aHeight = NS_INCHES_TO_TWIPS(mAdjustedPaperHeight / mHeightScale); | ||||||
|   } else { |  | ||||||
|     *aWidth  = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperWidth / mWidthScale); |  | ||||||
|     *aHeight = NS_MILLIMETERS_TO_TWIPS(mAdjustedPaperHeight / mHeightScale); |  | ||||||
|   } |  | ||||||
|   return NS_OK; |   return NS_OK; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -275,221 +270,3 @@ void nsPrintSettingsX::GetAdjustedPaperSize(double *aWidth, double *aHeight) | ||||||
|   *aWidth = mAdjustedPaperWidth; |   *aWidth = mAdjustedPaperWidth; | ||||||
|   *aHeight = mAdjustedPaperHeight; |   *aHeight = mAdjustedPaperHeight; | ||||||
| } | } | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP |  | ||||||
| nsPrintSettingsX::SetPaperSizeUnit(int16_t aPaperSizeUnit) |  | ||||||
| { |  | ||||||
|   mPaperSizeUnit = aPaperSizeUnit; |  | ||||||
|   return NS_OK; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP |  | ||||||
| nsPrintSettingsX::SetScaling(double aScaling) |  | ||||||
| { |  | ||||||
|   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| 
 |  | ||||||
|   NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; |  | ||||||
|   [printInfoDict setObject: [NSNumber numberWithFloat: aScaling] |  | ||||||
|    forKey: NSPrintScalingFactor]; |  | ||||||
|   NSPrintInfo* newPrintInfo = |  | ||||||
|       [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; |  | ||||||
|   if (NS_WARN_IF(!newPrintInfo)) { |  | ||||||
|     return NS_ERROR_OUT_OF_MEMORY; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   SetCocoaPrintInfo(newPrintInfo); |  | ||||||
|   [newPrintInfo release]; |  | ||||||
|   return NS_OK; |  | ||||||
| 
 |  | ||||||
|   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP |  | ||||||
| nsPrintSettingsX::SetToFileName(const char16_t *aToFileName) |  | ||||||
| { |  | ||||||
|   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| 
 |  | ||||||
|   NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; |  | ||||||
|   nsString filename = nsDependentString(aToFileName); |  | ||||||
| 
 |  | ||||||
|   NSURL* jobSavingURL = |  | ||||||
|       [NSURL fileURLWithPath: nsCocoaUtils::ToNSString(filename)]; |  | ||||||
|   if (jobSavingURL) { |  | ||||||
|     [printInfoDict setObject: NSPrintSaveJob forKey: NSPrintJobDisposition]; |  | ||||||
|     [printInfoDict setObject: jobSavingURL forKey: NSPrintJobSavingURL]; |  | ||||||
|   } |  | ||||||
|   NSPrintInfo* newPrintInfo = |  | ||||||
|       [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; |  | ||||||
|   if (NS_WARN_IF(!newPrintInfo)) { |  | ||||||
|     return NS_ERROR_OUT_OF_MEMORY; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   SetCocoaPrintInfo(newPrintInfo); |  | ||||||
|   [newPrintInfo release]; |  | ||||||
|   return NS_OK; |  | ||||||
| 
 |  | ||||||
|   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP |  | ||||||
| nsPrintSettingsX::GetOrientation(int32_t *aOrientation) |  | ||||||
| { |  | ||||||
|   if ([mPrintInfo orientation] == NSPaperOrientationPortrait) { |  | ||||||
|     *aOrientation = nsIPrintSettings::kPortraitOrientation; |  | ||||||
|   } else { |  | ||||||
|     *aOrientation = nsIPrintSettings::kLandscapeOrientation; |  | ||||||
|   } |  | ||||||
|   return NS_OK; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP |  | ||||||
| nsPrintSettingsX::SetOrientation(int32_t aOrientation) |  | ||||||
| { |  | ||||||
|   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| 
 |  | ||||||
|   NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; |  | ||||||
|   if (aOrientation == nsIPrintSettings::kPortraitOrientation) { |  | ||||||
|     [printInfoDict setObject: [NSNumber numberWithInt: NSPaperOrientationPortrait] |  | ||||||
|      forKey: NSPrintOrientation]; |  | ||||||
|   } else { |  | ||||||
|     [printInfoDict setObject: [NSNumber numberWithInt: NSPaperOrientationLandscape] |  | ||||||
|      forKey: NSPrintOrientation]; |  | ||||||
|   } |  | ||||||
|   NSPrintInfo* newPrintInfo = |  | ||||||
|       [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; |  | ||||||
|   if (NS_WARN_IF(!newPrintInfo)) { |  | ||||||
|     return NS_ERROR_OUT_OF_MEMORY; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   SetCocoaPrintInfo(newPrintInfo); |  | ||||||
|   [newPrintInfo release]; |  | ||||||
|   return NS_OK; |  | ||||||
| 
 |  | ||||||
|   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP |  | ||||||
| nsPrintSettingsX::SetUnwriteableMarginTop(double aUnwriteableMarginTop) |  | ||||||
| { |  | ||||||
|   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| 
 |  | ||||||
|   nsPrintSettings::SetUnwriteableMarginTop(aUnwriteableMarginTop); |  | ||||||
|   NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; |  | ||||||
|   [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginTop] |  | ||||||
|    forKey : NSPrintTopMargin]; |  | ||||||
|   NSPrintInfo* newPrintInfo = |  | ||||||
|       [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; |  | ||||||
|   if (NS_WARN_IF(!newPrintInfo)) { |  | ||||||
|     return NS_ERROR_OUT_OF_MEMORY; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   SetCocoaPrintInfo(newPrintInfo); |  | ||||||
|   [newPrintInfo release]; |  | ||||||
|   return NS_OK; |  | ||||||
| 
 |  | ||||||
|   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP |  | ||||||
| nsPrintSettingsX::SetUnwriteableMarginLeft(double aUnwriteableMarginLeft) |  | ||||||
| { |  | ||||||
|   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| 
 |  | ||||||
|   nsPrintSettings::SetUnwriteableMarginLeft(aUnwriteableMarginLeft); |  | ||||||
|   NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; |  | ||||||
|   [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginLeft] |  | ||||||
|    forKey : NSPrintLeftMargin]; |  | ||||||
|   NSPrintInfo* newPrintInfo = |  | ||||||
|       [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; |  | ||||||
|   if (NS_WARN_IF(!newPrintInfo)) { |  | ||||||
|     return NS_ERROR_OUT_OF_MEMORY; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   SetCocoaPrintInfo(newPrintInfo); |  | ||||||
|   [newPrintInfo release]; |  | ||||||
|   return NS_OK; |  | ||||||
| 
 |  | ||||||
|   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP |  | ||||||
| nsPrintSettingsX::SetUnwriteableMarginBottom(double aUnwriteableMarginBottom) |  | ||||||
| { |  | ||||||
|   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| 
 |  | ||||||
|   nsPrintSettings::SetUnwriteableMarginBottom(aUnwriteableMarginBottom); |  | ||||||
|   NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; |  | ||||||
|   [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginBottom] |  | ||||||
|    forKey : NSPrintBottomMargin]; |  | ||||||
|   NSPrintInfo* newPrintInfo = |  | ||||||
|       [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; |  | ||||||
|   if (NS_WARN_IF(!newPrintInfo)) { |  | ||||||
|     return NS_ERROR_OUT_OF_MEMORY; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   SetCocoaPrintInfo(newPrintInfo); |  | ||||||
|   [newPrintInfo release]; |  | ||||||
|   return NS_OK; |  | ||||||
| 
 |  | ||||||
|   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| NS_IMETHODIMP |  | ||||||
| nsPrintSettingsX::SetUnwriteableMarginRight(double aUnwriteableMarginRight) |  | ||||||
| { |  | ||||||
|   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| 
 |  | ||||||
|   nsPrintSettings::SetUnwriteableMarginRight(aUnwriteableMarginRight); |  | ||||||
|   NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; |  | ||||||
|   [printInfoDict setObject : [NSNumber numberWithDouble: aUnwriteableMarginRight] |  | ||||||
|    forKey : NSPrintRightMargin]; |  | ||||||
|   NSPrintInfo* newPrintInfo = |  | ||||||
|       [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; |  | ||||||
|   if (NS_WARN_IF(!newPrintInfo)) { |  | ||||||
|     return NS_ERROR_OUT_OF_MEMORY; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   SetCocoaPrintInfo(newPrintInfo); |  | ||||||
|   [newPrintInfo release]; |  | ||||||
|   return NS_OK; |  | ||||||
| 
 |  | ||||||
|   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int |  | ||||||
| nsPrintSettingsX::GetCocoaUnit(int16_t aGeckoUnit) |  | ||||||
| { |  | ||||||
|   if (aGeckoUnit == kPaperSizeMillimeters) |  | ||||||
|     return kPaperSizeMillimeters; |  | ||||||
|   else |  | ||||||
|     return kPaperSizeInches; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| nsresult nsPrintSettingsX::SetCocoaPaperSize(double aWidth, double aHeight) |  | ||||||
| { |  | ||||||
|   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| 
 |  | ||||||
|   NSSize paperSize; |  | ||||||
|   NSMutableDictionary* printInfoDict = [mPrintInfo dictionary]; |  | ||||||
|   if ([mPrintInfo orientation] == NSPaperOrientationPortrait) { |  | ||||||
|     // switch widths and heights |  | ||||||
|     paperSize = NSMakeSize(aWidth, aHeight); |  | ||||||
|     [printInfoDict setObject: [NSValue valueWithSize: paperSize] |  | ||||||
|      forKey: NSPrintPaperSize]; |  | ||||||
|   } else { |  | ||||||
|     paperSize = NSMakeSize(aHeight, aWidth); |  | ||||||
|     [printInfoDict setObject: [NSValue valueWithSize: paperSize] |  | ||||||
|      forKey: NSPrintPaperSize]; |  | ||||||
|   } |  | ||||||
|   NSPrintInfo* newPrintInfo = |  | ||||||
|       [[NSPrintInfo alloc] initWithDictionary: printInfoDict]; |  | ||||||
|   if (NS_WARN_IF(!newPrintInfo)) { |  | ||||||
|     return NS_ERROR_OUT_OF_MEMORY; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   SetCocoaPrintInfo(newPrintInfo); |  | ||||||
|   [newPrintInfo release]; |  | ||||||
|   return NS_OK; |  | ||||||
| 
 |  | ||||||
|   NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; |  | ||||||
| } |  | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Sebastian Hengst
						Sebastian Hengst