LCOV - code coverage report
Current view: directory - widget/xpwidgets - nsPrintSettingsImpl.cpp (source / functions) Found Hit Coverage
Test: app.info Lines: 562 0 0.0 %
Date: 2012-06-02 Functions: 138 0 0.0 %

       1                 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2                 : /* ***** BEGIN LICENSE BLOCK *****
       3                 :  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
       4                 :  *
       5                 :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :  * the License. You may obtain a copy of the License at
       8                 :  * http://www.mozilla.org/MPL/
       9                 :  *
      10                 :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :  * for the specific language governing rights and limitations under the
      13                 :  * License.
      14                 :  *
      15                 :  * The Original Code is mozilla.org code.
      16                 :  *
      17                 :  * The Initial Developer of the Original Code is
      18                 :  * Netscape Communications Corporation.
      19                 :  * Portions created by the Initial Developer are Copyright (C) 2000
      20                 :  * the Initial Developer. All Rights Reserved.
      21                 :  *
      22                 :  * Contributor(s):
      23                 :  *
      24                 :  * Alternatively, the contents of this file may be used under the terms of
      25                 :  * either of the GNU General Public License Version 2 or later (the "GPL"),
      26                 :  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
      27                 :  * in which case the provisions of the GPL or the LGPL are applicable instead
      28                 :  * of those above. If you wish to allow use of your version of this file only
      29                 :  * under the terms of either the GPL or the LGPL, and not to allow others to
      30                 :  * use your version of this file under the terms of the MPL, indicate your
      31                 :  * decision by deleting the provisions above and replace them with the notice
      32                 :  * and other provisions required by the GPL or the LGPL. If you do not delete
      33                 :  * the provisions above, a recipient may use your version of this file under
      34                 :  * the terms of any one of the MPL, the GPL or the LGPL.
      35                 :  *
      36                 :  * ***** END LICENSE BLOCK ***** */
      37                 : 
      38                 : #include "nsPrintSettingsImpl.h"
      39                 : #include "nsReadableUtils.h"
      40                 : #include "nsIPrintSession.h"
      41                 : 
      42                 : #define DEFAULT_MARGIN_WIDTH 0.5
      43                 : 
      44               0 : NS_IMPL_ISUPPORTS1(nsPrintSettings, nsIPrintSettings)
      45                 : 
      46                 : /** ---------------------------------------------------
      47                 :  *  See documentation in nsPrintSettingsImpl.h
      48                 :  *      @update 6/21/00 dwc
      49                 :  */
      50               0 : nsPrintSettings::nsPrintSettings() :
      51                 :   mPrintOptions(0L),
      52                 :   mPrintRange(kRangeAllPages),
      53                 :   mStartPageNum(1),
      54                 :   mEndPageNum(1),
      55                 :   mScaling(1.0),
      56                 :   mPrintBGColors(false),
      57                 :   mPrintBGImages(false),
      58                 :   mPrintFrameTypeUsage(kUseInternalDefault),
      59                 :   mPrintFrameType(kFramesAsIs),
      60                 :   mHowToEnableFrameUI(kFrameEnableNone),
      61                 :   mIsCancelled(false),
      62                 :   mPrintSilent(false),
      63                 :   mPrintPreview(false),
      64                 :   mShrinkToFit(true),
      65                 :   mShowPrintProgress(true),
      66                 :   mPrintPageDelay(50),
      67                 :   mPaperData(0),
      68                 :   mPaperSizeType(kPaperSizeDefined),
      69                 :   mPaperWidth(8.5),
      70                 :   mPaperHeight(11.0),
      71                 :   mPaperSizeUnit(kPaperSizeInches),
      72                 :   mPrintReversed(false),
      73                 :   mPrintInColor(true),
      74                 :   mOrientation(kPortraitOrientation),
      75                 :   mDownloadFonts(false),
      76                 :   mNumCopies(1),
      77                 :   mPrintToFile(false),
      78                 :   mOutputFormat(kOutputFormatNative),
      79                 :   mIsInitedFromPrinter(false),
      80               0 :   mIsInitedFromPrefs(false)
      81                 : {
      82                 : 
      83                 :   /* member initializers and constructor code */
      84               0 :   PRInt32 marginWidth = NS_INCHES_TO_INT_TWIPS(DEFAULT_MARGIN_WIDTH);
      85               0 :   mMargin.SizeTo(marginWidth, marginWidth, marginWidth, marginWidth);
      86               0 :   mEdge.SizeTo(0, 0, 0, 0);
      87               0 :   mUnwriteableMargin.SizeTo(0,0,0,0);
      88                 : 
      89               0 :   mPrintOptions = kPrintOddPages | kPrintEvenPages;
      90                 : 
      91               0 :   mHeaderStrs[0].AssignLiteral("&T");
      92               0 :   mHeaderStrs[2].AssignLiteral("&U");
      93                 : 
      94               0 :   mFooterStrs[0].AssignLiteral("&PT"); // Use &P (Page Num Only) or &PT (Page Num of Page Total)
      95               0 :   mFooterStrs[2].AssignLiteral("&D");
      96                 : 
      97               0 : }
      98                 : 
      99                 : /** ---------------------------------------------------
     100                 :  *  See documentation in nsPrintSettingsImpl.h
     101                 :  *      @update 6/21/00 dwc
     102                 :  */
     103               0 : nsPrintSettings::nsPrintSettings(const nsPrintSettings& aPS)
     104                 : {
     105               0 :   *this = aPS;
     106               0 : }
     107                 : 
     108                 : /** ---------------------------------------------------
     109                 :  *  See documentation in nsPrintSettingsImpl.h
     110                 :  *      @update 6/21/00 dwc
     111                 :  */
     112               0 : nsPrintSettings::~nsPrintSettings()
     113                 : {
     114               0 : }
     115                 : 
     116                 : /* [noscript] attribute nsIPrintSession printSession; */
     117               0 : NS_IMETHODIMP nsPrintSettings::GetPrintSession(nsIPrintSession **aPrintSession)
     118                 : {
     119               0 :   NS_ENSURE_ARG_POINTER(aPrintSession);
     120               0 :   *aPrintSession = nsnull;
     121                 :   
     122               0 :   nsCOMPtr<nsIPrintSession> session = do_QueryReferent(mSession);
     123               0 :   if (!session)
     124               0 :     return NS_ERROR_NOT_INITIALIZED;
     125               0 :   *aPrintSession = session;
     126               0 :   NS_ADDREF(*aPrintSession);
     127               0 :   return NS_OK;
     128                 : }
     129               0 : NS_IMETHODIMP nsPrintSettings::SetPrintSession(nsIPrintSession *aPrintSession)
     130                 : {
     131                 :   // Clearing it by passing NULL is not allowed. That's why we
     132                 :   // use a weak ref so that it doesn't have to be cleared.
     133               0 :   NS_ENSURE_ARG(aPrintSession);
     134                 :   
     135               0 :   mSession = do_GetWeakReference(aPrintSession);
     136               0 :   if (!mSession) {
     137                 :     // This may happen if the implementation of this object does
     138                 :     // not support weak references - programmer error.
     139               0 :     NS_ERROR("Could not get a weak reference from aPrintSession");
     140               0 :     return NS_ERROR_FAILURE;
     141                 :   }
     142               0 :   return NS_OK;
     143                 : }
     144                 : 
     145                 : /* attribute long startPageRange; */
     146               0 : NS_IMETHODIMP nsPrintSettings::GetStartPageRange(PRInt32 *aStartPageRange)
     147                 : {
     148                 :   //NS_ENSURE_ARG_POINTER(aStartPageRange);
     149               0 :   *aStartPageRange = mStartPageNum;
     150               0 :   return NS_OK;
     151                 : }
     152               0 : NS_IMETHODIMP nsPrintSettings::SetStartPageRange(PRInt32 aStartPageRange)
     153                 : {
     154               0 :   mStartPageNum = aStartPageRange;
     155               0 :   return NS_OK;
     156                 : }
     157                 : 
     158                 : /* attribute long endPageRange; */
     159               0 : NS_IMETHODIMP nsPrintSettings::GetEndPageRange(PRInt32 *aEndPageRange)
     160                 : {
     161                 :   //NS_ENSURE_ARG_POINTER(aEndPageRange);
     162               0 :   *aEndPageRange = mEndPageNum;
     163               0 :   return NS_OK;
     164                 : }
     165               0 : NS_IMETHODIMP nsPrintSettings::SetEndPageRange(PRInt32 aEndPageRange)
     166                 : {
     167               0 :   mEndPageNum = aEndPageRange;
     168               0 :   return NS_OK;
     169                 : }
     170                 : 
     171                 : /* attribute boolean printReversed; */
     172               0 : NS_IMETHODIMP nsPrintSettings::GetPrintReversed(bool *aPrintReversed)
     173                 : {
     174                 :   //NS_ENSURE_ARG_POINTER(aPrintReversed);
     175               0 :   *aPrintReversed = mPrintReversed;
     176               0 :   return NS_OK;
     177                 : }
     178               0 : NS_IMETHODIMP nsPrintSettings::SetPrintReversed(bool aPrintReversed)
     179                 : {
     180               0 :   mPrintReversed = aPrintReversed;
     181               0 :   return NS_OK;
     182                 : }
     183                 : 
     184                 : /* attribute boolean printInColor; */
     185               0 : NS_IMETHODIMP nsPrintSettings::GetPrintInColor(bool *aPrintInColor)
     186                 : {
     187                 :   //NS_ENSURE_ARG_POINTER(aPrintInColor);
     188               0 :   *aPrintInColor = mPrintInColor;
     189               0 :   return NS_OK;
     190                 : }
     191               0 : NS_IMETHODIMP nsPrintSettings::SetPrintInColor(bool aPrintInColor)
     192                 : {
     193               0 :   mPrintInColor = aPrintInColor;
     194               0 :   return NS_OK;
     195                 : }
     196                 : 
     197                 : /* attribute short orientation; */
     198               0 : NS_IMETHODIMP nsPrintSettings::GetOrientation(PRInt32 *aOrientation)
     199                 : {
     200               0 :   NS_ENSURE_ARG_POINTER(aOrientation);
     201               0 :   *aOrientation = mOrientation;
     202               0 :   return NS_OK;
     203                 : }
     204               0 : NS_IMETHODIMP nsPrintSettings::SetOrientation(PRInt32 aOrientation)
     205                 : {
     206               0 :   mOrientation = aOrientation;
     207               0 :   return NS_OK;
     208                 : }
     209                 : 
     210                 : /* attribute wstring colorspace; */
     211               0 : NS_IMETHODIMP nsPrintSettings::GetColorspace(PRUnichar * *aColorspace)
     212                 : {
     213               0 :   NS_ENSURE_ARG_POINTER(aColorspace);
     214               0 :   if (!mColorspace.IsEmpty()) {
     215               0 :     *aColorspace = ToNewUnicode(mColorspace);
     216                 :   } else {
     217               0 :     *aColorspace = nsnull;
     218                 :   }
     219               0 :   return NS_OK;
     220                 : }
     221               0 : NS_IMETHODIMP nsPrintSettings::SetColorspace(const PRUnichar * aColorspace)
     222                 : {
     223               0 :   if (aColorspace) {
     224               0 :     mColorspace = aColorspace;
     225                 :   } else {
     226               0 :     mColorspace.SetLength(0);
     227                 :   }
     228               0 :   return NS_OK;
     229                 : }
     230                 : 
     231                 : /* attribute wstring resolutionname; */
     232               0 : NS_IMETHODIMP nsPrintSettings::GetResolutionName(PRUnichar * *aResolutionName)
     233                 : {
     234               0 :   NS_ENSURE_ARG_POINTER(aResolutionName);
     235               0 :   if (!mResolutionName.IsEmpty()) {
     236               0 :     *aResolutionName = ToNewUnicode(mResolutionName);
     237                 :   } else {
     238               0 :     *aResolutionName = nsnull;
     239                 :   }
     240               0 :   return NS_OK;
     241                 : }
     242               0 : NS_IMETHODIMP nsPrintSettings::SetResolutionName(const PRUnichar * aResolutionName)
     243                 : {
     244               0 :   if (aResolutionName) {
     245               0 :     mResolutionName = aResolutionName;
     246                 :   } else {
     247               0 :     mResolutionName.SetLength(0);
     248                 :   }
     249               0 :   return NS_OK;
     250                 : }
     251                 : 
     252                 : /* attribute boolean downloadFonts; */
     253               0 : NS_IMETHODIMP nsPrintSettings::GetDownloadFonts(bool *aDownloadFonts)
     254                 : {
     255                 :   //NS_ENSURE_ARG_POINTER(aDownloadFonts);
     256               0 :   *aDownloadFonts = mDownloadFonts;
     257               0 :   return NS_OK;
     258                 : }
     259               0 : NS_IMETHODIMP nsPrintSettings::SetDownloadFonts(bool aDownloadFonts)
     260                 : {
     261               0 :   mDownloadFonts = aDownloadFonts;
     262               0 :   return NS_OK;
     263                 : }
     264                 : 
     265                 : /* attribute wstring printer; */
     266               0 : NS_IMETHODIMP nsPrintSettings::GetPrinterName(PRUnichar * *aPrinter)
     267                 : {
     268               0 :    NS_ENSURE_ARG_POINTER(aPrinter);
     269                 : 
     270               0 :    *aPrinter = ToNewUnicode(mPrinter);
     271               0 :    NS_ENSURE_TRUE(*aPrinter, NS_ERROR_OUT_OF_MEMORY);
     272                 : 
     273               0 :    return NS_OK;
     274                 : }
     275                 : 
     276               0 : NS_IMETHODIMP nsPrintSettings::SetPrinterName(const PRUnichar * aPrinter)
     277                 : {
     278               0 :   if (!aPrinter || !mPrinter.Equals(aPrinter)) {
     279               0 :     mIsInitedFromPrinter = false;
     280               0 :     mIsInitedFromPrefs   = false;
     281                 :   }
     282                 : 
     283               0 :   mPrinter.Assign(aPrinter);
     284               0 :   return NS_OK;
     285                 : }
     286                 : 
     287                 : /* attribute long numCopies; */
     288               0 : NS_IMETHODIMP nsPrintSettings::GetNumCopies(PRInt32 *aNumCopies)
     289                 : {
     290               0 :   NS_ENSURE_ARG_POINTER(aNumCopies);
     291               0 :   *aNumCopies = mNumCopies;
     292               0 :   return NS_OK;
     293                 : }
     294               0 : NS_IMETHODIMP nsPrintSettings::SetNumCopies(PRInt32 aNumCopies)
     295                 : {
     296               0 :   mNumCopies = aNumCopies;
     297               0 :   return NS_OK;
     298                 : }
     299                 : 
     300                 : /* attribute wstring printCommand; */
     301               0 : NS_IMETHODIMP nsPrintSettings::GetPrintCommand(PRUnichar * *aPrintCommand)
     302                 : {
     303                 :   //NS_ENSURE_ARG_POINTER(aPrintCommand);
     304               0 :   *aPrintCommand = ToNewUnicode(mPrintCommand);
     305               0 :   return NS_OK;
     306                 : }
     307               0 : NS_IMETHODIMP nsPrintSettings::SetPrintCommand(const PRUnichar * aPrintCommand)
     308                 : {
     309               0 :   if (aPrintCommand) {
     310               0 :     mPrintCommand = aPrintCommand;
     311                 :   } else {
     312               0 :     mPrintCommand.SetLength(0);
     313                 :   }
     314               0 :   return NS_OK;
     315                 : }
     316                 : 
     317                 : /* attribute boolean printToFile; */
     318               0 : NS_IMETHODIMP nsPrintSettings::GetPrintToFile(bool *aPrintToFile)
     319                 : {
     320                 :   //NS_ENSURE_ARG_POINTER(aPrintToFile);
     321               0 :   *aPrintToFile = mPrintToFile;
     322               0 :   return NS_OK;
     323                 : }
     324               0 : NS_IMETHODIMP nsPrintSettings::SetPrintToFile(bool aPrintToFile)
     325                 : {
     326               0 :   mPrintToFile = aPrintToFile;
     327               0 :   return NS_OK;
     328                 : }
     329                 : 
     330                 : /* attribute wstring toFileName; */
     331               0 : NS_IMETHODIMP nsPrintSettings::GetToFileName(PRUnichar * *aToFileName)
     332                 : {
     333                 :   //NS_ENSURE_ARG_POINTER(aToFileName);
     334               0 :   *aToFileName = ToNewUnicode(mToFileName);
     335               0 :   return NS_OK;
     336                 : }
     337               0 : NS_IMETHODIMP nsPrintSettings::SetToFileName(const PRUnichar * aToFileName)
     338                 : {
     339               0 :   if (aToFileName) {
     340               0 :     mToFileName = aToFileName;
     341                 :   } else {
     342               0 :     mToFileName.SetLength(0);
     343                 :   }
     344               0 :   return NS_OK;
     345                 : }
     346                 : 
     347                 : /* attribute short outputFormat; */
     348               0 : NS_IMETHODIMP nsPrintSettings::GetOutputFormat(PRInt16 *aOutputFormat)
     349                 : {
     350               0 :   NS_ENSURE_ARG_POINTER(aOutputFormat);
     351               0 :   *aOutputFormat = mOutputFormat;
     352               0 :   return NS_OK;
     353                 : }
     354               0 : NS_IMETHODIMP nsPrintSettings::SetOutputFormat(PRInt16 aOutputFormat)
     355                 : {
     356               0 :   mOutputFormat = aOutputFormat;
     357               0 :   return NS_OK;
     358                 : }
     359                 : 
     360                 : /* attribute long printPageDelay; */
     361               0 : NS_IMETHODIMP nsPrintSettings::GetPrintPageDelay(PRInt32 *aPrintPageDelay)
     362                 : {
     363               0 :   *aPrintPageDelay = mPrintPageDelay;
     364               0 :   return NS_OK;
     365                 : }
     366               0 : NS_IMETHODIMP nsPrintSettings::SetPrintPageDelay(PRInt32 aPrintPageDelay)
     367                 : {
     368               0 :   mPrintPageDelay = aPrintPageDelay;
     369               0 :   return NS_OK;
     370                 : }
     371                 : 
     372                 : /* attribute boolean isInitializedFromPrinter; */
     373               0 : NS_IMETHODIMP nsPrintSettings::GetIsInitializedFromPrinter(bool *aIsInitializedFromPrinter)
     374                 : {
     375               0 :   NS_ENSURE_ARG_POINTER(aIsInitializedFromPrinter);
     376               0 :   *aIsInitializedFromPrinter = (bool)mIsInitedFromPrinter;
     377               0 :   return NS_OK;
     378                 : }
     379               0 : NS_IMETHODIMP nsPrintSettings::SetIsInitializedFromPrinter(bool aIsInitializedFromPrinter)
     380                 : {
     381               0 :   mIsInitedFromPrinter = (bool)aIsInitializedFromPrinter;
     382               0 :   return NS_OK;
     383                 : }
     384                 : 
     385                 : /* attribute boolean isInitializedFromPrefs; */
     386               0 : NS_IMETHODIMP nsPrintSettings::GetIsInitializedFromPrefs(bool *aInitializedFromPrefs)
     387                 : {
     388               0 :   NS_ENSURE_ARG_POINTER(aInitializedFromPrefs);
     389               0 :   *aInitializedFromPrefs = (bool)mIsInitedFromPrefs;
     390               0 :   return NS_OK;
     391                 : }
     392               0 : NS_IMETHODIMP nsPrintSettings::SetIsInitializedFromPrefs(bool aInitializedFromPrefs)
     393                 : {
     394               0 :   mIsInitedFromPrefs = (bool)aInitializedFromPrefs;
     395               0 :   return NS_OK;
     396                 : }
     397                 : 
     398                 : /* attribute double marginTop; */
     399               0 : NS_IMETHODIMP nsPrintSettings::GetMarginTop(double *aMarginTop)
     400                 : {
     401               0 :   NS_ENSURE_ARG_POINTER(aMarginTop);
     402               0 :   *aMarginTop = NS_TWIPS_TO_INCHES(mMargin.top);
     403               0 :   return NS_OK;
     404                 : }
     405               0 : NS_IMETHODIMP nsPrintSettings::SetMarginTop(double aMarginTop)
     406                 : {
     407               0 :   mMargin.top = NS_INCHES_TO_INT_TWIPS(float(aMarginTop));
     408               0 :   return NS_OK;
     409                 : }
     410                 : 
     411                 : /* attribute double marginLeft; */
     412               0 : NS_IMETHODIMP nsPrintSettings::GetMarginLeft(double *aMarginLeft)
     413                 : {
     414               0 :   NS_ENSURE_ARG_POINTER(aMarginLeft);
     415               0 :   *aMarginLeft = NS_TWIPS_TO_INCHES(mMargin.left);
     416               0 :   return NS_OK;
     417                 : }
     418               0 : NS_IMETHODIMP nsPrintSettings::SetMarginLeft(double aMarginLeft)
     419                 : {
     420               0 :   mMargin.left = NS_INCHES_TO_INT_TWIPS(float(aMarginLeft));
     421               0 :   return NS_OK;
     422                 : }
     423                 : 
     424                 : /* attribute double marginBottom; */
     425               0 : NS_IMETHODIMP nsPrintSettings::GetMarginBottom(double *aMarginBottom)
     426                 : {
     427               0 :   NS_ENSURE_ARG_POINTER(aMarginBottom);
     428               0 :   *aMarginBottom = NS_TWIPS_TO_INCHES(mMargin.bottom);
     429               0 :   return NS_OK;
     430                 : }
     431               0 : NS_IMETHODIMP nsPrintSettings::SetMarginBottom(double aMarginBottom)
     432                 : {
     433               0 :   mMargin.bottom = NS_INCHES_TO_INT_TWIPS(float(aMarginBottom));
     434               0 :   return NS_OK;
     435                 : }
     436                 : 
     437                 : /* attribute double marginRight; */
     438               0 : NS_IMETHODIMP nsPrintSettings::GetMarginRight(double *aMarginRight)
     439                 : {
     440               0 :   NS_ENSURE_ARG_POINTER(aMarginRight);
     441               0 :   *aMarginRight = NS_TWIPS_TO_INCHES(mMargin.right);
     442               0 :   return NS_OK;
     443                 : }
     444               0 : NS_IMETHODIMP nsPrintSettings::SetMarginRight(double aMarginRight)
     445                 : {
     446               0 :   mMargin.right = NS_INCHES_TO_INT_TWIPS(float(aMarginRight));
     447               0 :   return NS_OK;
     448                 : }
     449                 : 
     450                 : /* attribute double edgeTop; */
     451               0 : NS_IMETHODIMP nsPrintSettings::GetEdgeTop(double *aEdgeTop)
     452                 : {
     453               0 :   NS_ENSURE_ARG_POINTER(aEdgeTop);
     454               0 :   *aEdgeTop = NS_TWIPS_TO_INCHES(mEdge.top);
     455               0 :   return NS_OK;
     456                 : }
     457               0 : NS_IMETHODIMP nsPrintSettings::SetEdgeTop(double aEdgeTop)
     458                 : {
     459               0 :   mEdge.top = NS_INCHES_TO_INT_TWIPS(float(aEdgeTop));
     460               0 :   return NS_OK;
     461                 : }
     462                 : 
     463                 : /* attribute double edgeLeft; */
     464               0 : NS_IMETHODIMP nsPrintSettings::GetEdgeLeft(double *aEdgeLeft)
     465                 : {
     466               0 :   NS_ENSURE_ARG_POINTER(aEdgeLeft);
     467               0 :   *aEdgeLeft = NS_TWIPS_TO_INCHES(mEdge.left);
     468               0 :   return NS_OK;
     469                 : }
     470               0 : NS_IMETHODIMP nsPrintSettings::SetEdgeLeft(double aEdgeLeft)
     471                 : {
     472               0 :   mEdge.left = NS_INCHES_TO_INT_TWIPS(float(aEdgeLeft));
     473               0 :   return NS_OK;
     474                 : }
     475                 : 
     476                 : /* attribute double edgeBottom; */
     477               0 : NS_IMETHODIMP nsPrintSettings::GetEdgeBottom(double *aEdgeBottom)
     478                 : {
     479               0 :   NS_ENSURE_ARG_POINTER(aEdgeBottom);
     480               0 :   *aEdgeBottom = NS_TWIPS_TO_INCHES(mEdge.bottom);
     481               0 :   return NS_OK;
     482                 : }
     483               0 : NS_IMETHODIMP nsPrintSettings::SetEdgeBottom(double aEdgeBottom)
     484                 : {
     485               0 :   mEdge.bottom = NS_INCHES_TO_INT_TWIPS(float(aEdgeBottom));
     486               0 :   return NS_OK;
     487                 : }
     488                 : 
     489                 : /* attribute double edgeRight; */
     490               0 : NS_IMETHODIMP nsPrintSettings::GetEdgeRight(double *aEdgeRight)
     491                 : {
     492               0 :   NS_ENSURE_ARG_POINTER(aEdgeRight);
     493               0 :   *aEdgeRight = NS_TWIPS_TO_INCHES(mEdge.right);
     494               0 :   return NS_OK;
     495                 : }
     496               0 : NS_IMETHODIMP nsPrintSettings::SetEdgeRight(double aEdgeRight)
     497                 : {
     498               0 :   mEdge.right = NS_INCHES_TO_INT_TWIPS(float(aEdgeRight));
     499               0 :   return NS_OK;
     500                 : }
     501                 : 
     502                 : /* attribute double unwriteableMarginTop; */
     503               0 : NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginTop(double *aUnwriteableMarginTop)
     504                 : {
     505               0 :   NS_ENSURE_ARG_POINTER(aUnwriteableMarginTop);
     506               0 :   *aUnwriteableMarginTop = NS_TWIPS_TO_INCHES(mUnwriteableMargin.top);
     507               0 :   return NS_OK;
     508                 : }
     509               0 : NS_IMETHODIMP nsPrintSettings::SetUnwriteableMarginTop(double aUnwriteableMarginTop)
     510                 : {
     511               0 :   if (aUnwriteableMarginTop >= 0.0) {
     512               0 :     mUnwriteableMargin.top = NS_INCHES_TO_INT_TWIPS(aUnwriteableMarginTop);
     513                 :   }
     514               0 :   return NS_OK;
     515                 : }
     516                 : 
     517                 : /* attribute double unwriteableMarginLeft; */
     518               0 : NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginLeft(double *aUnwriteableMarginLeft)
     519                 : {
     520               0 :   NS_ENSURE_ARG_POINTER(aUnwriteableMarginLeft);
     521               0 :   *aUnwriteableMarginLeft = NS_TWIPS_TO_INCHES(mUnwriteableMargin.left);
     522               0 :   return NS_OK;
     523                 : }
     524               0 : NS_IMETHODIMP nsPrintSettings::SetUnwriteableMarginLeft(double aUnwriteableMarginLeft)
     525                 : {
     526               0 :   if (aUnwriteableMarginLeft >= 0.0) {
     527               0 :     mUnwriteableMargin.left = NS_INCHES_TO_INT_TWIPS(aUnwriteableMarginLeft);
     528                 :   }
     529               0 :   return NS_OK;
     530                 : }
     531                 : 
     532                 : /* attribute double unwriteableMarginBottom; */
     533               0 : NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginBottom(double *aUnwriteableMarginBottom)
     534                 : {
     535               0 :   NS_ENSURE_ARG_POINTER(aUnwriteableMarginBottom);
     536               0 :   *aUnwriteableMarginBottom = NS_TWIPS_TO_INCHES(mUnwriteableMargin.bottom);
     537               0 :   return NS_OK;
     538                 : }
     539               0 : NS_IMETHODIMP nsPrintSettings::SetUnwriteableMarginBottom(double aUnwriteableMarginBottom)
     540                 : {
     541               0 :   if (aUnwriteableMarginBottom >= 0.0) {
     542               0 :     mUnwriteableMargin.bottom = NS_INCHES_TO_INT_TWIPS(aUnwriteableMarginBottom);
     543                 :   }
     544               0 :   return NS_OK;
     545                 : }
     546                 : 
     547                 : /* attribute double unwriteableMarginRight; */
     548               0 : NS_IMETHODIMP nsPrintSettings::GetUnwriteableMarginRight(double *aUnwriteableMarginRight)
     549                 : {
     550               0 :   NS_ENSURE_ARG_POINTER(aUnwriteableMarginRight);
     551               0 :   *aUnwriteableMarginRight = NS_TWIPS_TO_INCHES(mUnwriteableMargin.right);
     552               0 :   return NS_OK;
     553                 : }
     554               0 : NS_IMETHODIMP nsPrintSettings::SetUnwriteableMarginRight(double aUnwriteableMarginRight)
     555                 : {
     556               0 :   if (aUnwriteableMarginRight >= 0.0) {
     557               0 :     mUnwriteableMargin.right = NS_INCHES_TO_INT_TWIPS(aUnwriteableMarginRight);
     558                 :   }
     559               0 :   return NS_OK;
     560                 : }
     561                 : 
     562                 : /* attribute double scaling; */
     563               0 : NS_IMETHODIMP nsPrintSettings::GetScaling(double *aScaling)
     564                 : {
     565               0 :   NS_ENSURE_ARG_POINTER(aScaling);
     566               0 :   *aScaling = mScaling;
     567               0 :   return NS_OK;
     568                 : }
     569                 : 
     570               0 : NS_IMETHODIMP nsPrintSettings::SetScaling(double aScaling)
     571                 : {
     572               0 :   mScaling = aScaling;
     573               0 :   return NS_OK;
     574                 : }
     575                 : 
     576                 : /* attribute boolean printBGColors; */
     577               0 : NS_IMETHODIMP nsPrintSettings::GetPrintBGColors(bool *aPrintBGColors)
     578                 : {
     579               0 :   NS_ENSURE_ARG_POINTER(aPrintBGColors);
     580               0 :   *aPrintBGColors = mPrintBGColors;
     581               0 :   return NS_OK;
     582                 : }
     583               0 : NS_IMETHODIMP nsPrintSettings::SetPrintBGColors(bool aPrintBGColors)
     584                 : {
     585               0 :   mPrintBGColors = aPrintBGColors;
     586               0 :   return NS_OK;
     587                 : }
     588                 : 
     589                 : /* attribute boolean printBGImages; */
     590               0 : NS_IMETHODIMP nsPrintSettings::GetPrintBGImages(bool *aPrintBGImages)
     591                 : {
     592               0 :   NS_ENSURE_ARG_POINTER(aPrintBGImages);
     593               0 :   *aPrintBGImages = mPrintBGImages;
     594               0 :   return NS_OK;
     595                 : }
     596               0 : NS_IMETHODIMP nsPrintSettings::SetPrintBGImages(bool aPrintBGImages)
     597                 : {
     598               0 :   mPrintBGImages = aPrintBGImages;
     599               0 :   return NS_OK;
     600                 : }
     601                 : 
     602                 : /* attribute long printRange; */
     603               0 : NS_IMETHODIMP nsPrintSettings::GetPrintRange(PRInt16 *aPrintRange)
     604                 : {
     605               0 :   NS_ENSURE_ARG_POINTER(aPrintRange);
     606               0 :   *aPrintRange = mPrintRange;
     607               0 :   return NS_OK;
     608                 : }
     609               0 : NS_IMETHODIMP nsPrintSettings::SetPrintRange(PRInt16 aPrintRange)
     610                 : {
     611               0 :   mPrintRange = aPrintRange;
     612               0 :   return NS_OK;
     613                 : }
     614                 : 
     615                 : /* attribute wstring docTitle; */
     616               0 : NS_IMETHODIMP nsPrintSettings::GetTitle(PRUnichar * *aTitle)
     617                 : {
     618               0 :   NS_ENSURE_ARG_POINTER(aTitle);
     619               0 :   if (!mTitle.IsEmpty()) {
     620               0 :     *aTitle = ToNewUnicode(mTitle);
     621                 :   } else {
     622               0 :     *aTitle = nsnull;
     623                 :   }
     624               0 :   return NS_OK;
     625                 : }
     626               0 : NS_IMETHODIMP nsPrintSettings::SetTitle(const PRUnichar * aTitle)
     627                 : {
     628               0 :   if (aTitle) {
     629               0 :     mTitle = aTitle;
     630                 :   } else {
     631               0 :     mTitle.SetLength(0);
     632                 :   }
     633               0 :   return NS_OK;
     634                 : }
     635                 : 
     636                 : /* attribute wstring docURL; */
     637               0 : NS_IMETHODIMP nsPrintSettings::GetDocURL(PRUnichar * *aDocURL)
     638                 : {
     639               0 :   NS_ENSURE_ARG_POINTER(aDocURL);
     640               0 :   if (!mURL.IsEmpty()) {
     641               0 :     *aDocURL = ToNewUnicode(mURL);
     642                 :   } else {
     643               0 :     *aDocURL = nsnull;
     644                 :   }
     645               0 :   return NS_OK;
     646                 : }
     647               0 : NS_IMETHODIMP nsPrintSettings::SetDocURL(const PRUnichar * aDocURL)
     648                 : {
     649               0 :   if (aDocURL) {
     650               0 :     mURL = aDocURL;
     651                 :   } else {
     652               0 :     mURL.SetLength(0);
     653                 :   }
     654               0 :   return NS_OK;
     655                 : }
     656                 : 
     657                 : /** ---------------------------------------------------
     658                 :  *  See documentation in nsPrintSettingsImpl.h
     659                 :  *      @update 1/12/01 rods
     660                 :  */
     661                 : NS_IMETHODIMP 
     662               0 : nsPrintSettings::GetPrintOptions(PRInt32 aType, bool *aTurnOnOff)
     663                 : {
     664               0 :   NS_ENSURE_ARG_POINTER(aTurnOnOff);
     665               0 :   *aTurnOnOff = mPrintOptions & aType ? true : false;
     666               0 :   return NS_OK;
     667                 : }
     668                 : /** ---------------------------------------------------
     669                 :  *  See documentation in nsPrintSettingsImpl.h
     670                 :  *      @update 1/12/01 rods
     671                 :  */
     672                 : NS_IMETHODIMP 
     673               0 : nsPrintSettings::SetPrintOptions(PRInt32 aType, bool aTurnOnOff)
     674                 : {
     675               0 :   if (aTurnOnOff) {
     676               0 :     mPrintOptions |=  aType;
     677                 :   } else {
     678               0 :     mPrintOptions &= ~aType;
     679                 :   }
     680               0 :   return NS_OK;
     681                 : }
     682                 : 
     683                 : /** ---------------------------------------------------
     684                 :  *  See documentation in nsPrintSettingsImpl.h
     685                 :  *      @update 1/12/01 rods
     686                 :  */
     687                 : NS_IMETHODIMP 
     688               0 : nsPrintSettings::GetPrintOptionsBits(PRInt32 *aBits)
     689                 : {
     690               0 :   NS_ENSURE_ARG_POINTER(aBits);
     691               0 :   *aBits = mPrintOptions;
     692               0 :   return NS_OK;
     693                 : }
     694                 : 
     695                 : /* attribute wstring docTitle; */
     696                 : nsresult 
     697               0 : nsPrintSettings::GetMarginStrs(PRUnichar * *aTitle, 
     698                 :                               nsHeaderFooterEnum aType, 
     699                 :                               PRInt16 aJust)
     700                 : {
     701               0 :   NS_ENSURE_ARG_POINTER(aTitle);
     702               0 :   *aTitle = nsnull;
     703               0 :   if (aType == eHeader) {
     704               0 :     switch (aJust) {
     705               0 :       case kJustLeft:   *aTitle = ToNewUnicode(mHeaderStrs[0]);break;
     706               0 :       case kJustCenter: *aTitle = ToNewUnicode(mHeaderStrs[1]);break;
     707               0 :       case kJustRight:  *aTitle = ToNewUnicode(mHeaderStrs[2]);break;
     708                 :     } //switch
     709                 :   } else {
     710               0 :     switch (aJust) {
     711               0 :       case kJustLeft:   *aTitle = ToNewUnicode(mFooterStrs[0]);break;
     712               0 :       case kJustCenter: *aTitle = ToNewUnicode(mFooterStrs[1]);break;
     713               0 :       case kJustRight:  *aTitle = ToNewUnicode(mFooterStrs[2]);break;
     714                 :     } //switch
     715                 :   }
     716               0 :   return NS_OK;
     717                 : }
     718                 : 
     719                 : nsresult
     720               0 : nsPrintSettings::SetMarginStrs(const PRUnichar * aTitle, 
     721                 :                               nsHeaderFooterEnum aType, 
     722                 :                               PRInt16 aJust)
     723                 : {
     724               0 :   NS_ENSURE_ARG_POINTER(aTitle);
     725               0 :   if (aType == eHeader) {
     726               0 :     switch (aJust) {
     727               0 :       case kJustLeft:   mHeaderStrs[0] = aTitle;break;
     728               0 :       case kJustCenter: mHeaderStrs[1] = aTitle;break;
     729               0 :       case kJustRight:  mHeaderStrs[2] = aTitle;break;
     730                 :     } //switch
     731                 :   } else {
     732               0 :     switch (aJust) {
     733               0 :       case kJustLeft:   mFooterStrs[0] = aTitle;break;
     734               0 :       case kJustCenter: mFooterStrs[1] = aTitle;break;
     735               0 :       case kJustRight:  mFooterStrs[2] = aTitle;break;
     736                 :     } //switch
     737                 :   }
     738               0 :   return NS_OK;
     739                 : }
     740                 : 
     741                 : /* attribute wstring Header String Left */
     742               0 : NS_IMETHODIMP nsPrintSettings::GetHeaderStrLeft(PRUnichar * *aTitle)
     743                 : {
     744               0 :   return GetMarginStrs(aTitle, eHeader, kJustLeft);
     745                 : }
     746               0 : NS_IMETHODIMP nsPrintSettings::SetHeaderStrLeft(const PRUnichar * aTitle)
     747                 : {
     748               0 :   return SetMarginStrs(aTitle, eHeader, kJustLeft);
     749                 : }
     750                 : 
     751                 : /* attribute wstring Header String Center */
     752               0 : NS_IMETHODIMP nsPrintSettings::GetHeaderStrCenter(PRUnichar * *aTitle)
     753                 : {
     754               0 :   return GetMarginStrs(aTitle, eHeader, kJustCenter);
     755                 : }
     756               0 : NS_IMETHODIMP nsPrintSettings::SetHeaderStrCenter(const PRUnichar * aTitle)
     757                 : {
     758               0 :   return SetMarginStrs(aTitle, eHeader, kJustCenter);
     759                 : }
     760                 : 
     761                 : /* attribute wstring Header String Right */
     762               0 : NS_IMETHODIMP nsPrintSettings::GetHeaderStrRight(PRUnichar * *aTitle)
     763                 : {
     764               0 :   return GetMarginStrs(aTitle, eHeader, kJustRight);
     765                 : }
     766               0 : NS_IMETHODIMP nsPrintSettings::SetHeaderStrRight(const PRUnichar * aTitle)
     767                 : {
     768               0 :   return SetMarginStrs(aTitle, eHeader, kJustRight);
     769                 : }
     770                 : 
     771                 : 
     772                 : /* attribute wstring Footer String Left */
     773               0 : NS_IMETHODIMP nsPrintSettings::GetFooterStrLeft(PRUnichar * *aTitle)
     774                 : {
     775               0 :   return GetMarginStrs(aTitle, eFooter, kJustLeft);
     776                 : }
     777               0 : NS_IMETHODIMP nsPrintSettings::SetFooterStrLeft(const PRUnichar * aTitle)
     778                 : {
     779               0 :   return SetMarginStrs(aTitle, eFooter, kJustLeft);
     780                 : }
     781                 : 
     782                 : /* attribute wstring Footer String Center */
     783               0 : NS_IMETHODIMP nsPrintSettings::GetFooterStrCenter(PRUnichar * *aTitle)
     784                 : {
     785               0 :   return GetMarginStrs(aTitle, eFooter, kJustCenter);
     786                 : }
     787               0 : NS_IMETHODIMP nsPrintSettings::SetFooterStrCenter(const PRUnichar * aTitle)
     788                 : {
     789               0 :   return SetMarginStrs(aTitle, eFooter, kJustCenter);
     790                 : }
     791                 : 
     792                 : /* attribute wstring Footer String Right */
     793               0 : NS_IMETHODIMP nsPrintSettings::GetFooterStrRight(PRUnichar * *aTitle)
     794                 : {
     795               0 :   return GetMarginStrs(aTitle, eFooter, kJustRight);
     796                 : }
     797               0 : NS_IMETHODIMP nsPrintSettings::SetFooterStrRight(const PRUnichar * aTitle)
     798                 : {
     799               0 :   return SetMarginStrs(aTitle, eFooter, kJustRight);
     800                 : }
     801                 : 
     802                 : /* attribute short printFrameTypeUsage; */
     803               0 : NS_IMETHODIMP nsPrintSettings::GetPrintFrameTypeUsage(PRInt16 *aPrintFrameTypeUsage)
     804                 : {
     805               0 :   NS_ENSURE_ARG_POINTER(aPrintFrameTypeUsage);
     806               0 :   *aPrintFrameTypeUsage = mPrintFrameTypeUsage;
     807               0 :   return NS_OK;
     808                 : }
     809               0 : NS_IMETHODIMP nsPrintSettings::SetPrintFrameTypeUsage(PRInt16 aPrintFrameTypeUsage)
     810                 : {
     811               0 :   mPrintFrameTypeUsage = aPrintFrameTypeUsage;
     812               0 :   return NS_OK;
     813                 : }
     814                 : 
     815                 : /* attribute long printFrameType; */
     816               0 : NS_IMETHODIMP nsPrintSettings::GetPrintFrameType(PRInt16 *aPrintFrameType)
     817                 : {
     818               0 :   NS_ENSURE_ARG_POINTER(aPrintFrameType);
     819               0 :   *aPrintFrameType = (PRInt32)mPrintFrameType;
     820               0 :   return NS_OK;
     821                 : }
     822               0 : NS_IMETHODIMP nsPrintSettings::SetPrintFrameType(PRInt16 aPrintFrameType)
     823                 : {
     824               0 :   mPrintFrameType = aPrintFrameType;
     825               0 :   return NS_OK;
     826                 : }
     827                 : 
     828                 : /* attribute boolean printSilent; */
     829               0 : NS_IMETHODIMP nsPrintSettings::GetPrintSilent(bool *aPrintSilent)
     830                 : {
     831               0 :   NS_ENSURE_ARG_POINTER(aPrintSilent);
     832               0 :   *aPrintSilent = mPrintSilent;
     833               0 :   return NS_OK;
     834                 : }
     835               0 : NS_IMETHODIMP nsPrintSettings::SetPrintSilent(bool aPrintSilent)
     836                 : {
     837               0 :   mPrintSilent = aPrintSilent;
     838               0 :   return NS_OK;
     839                 : }
     840                 : 
     841                 : /* attribute boolean shrinkToFit; */
     842               0 : NS_IMETHODIMP nsPrintSettings::GetShrinkToFit(bool *aShrinkToFit)
     843                 : {
     844               0 :   NS_ENSURE_ARG_POINTER(aShrinkToFit);
     845               0 :   *aShrinkToFit = mShrinkToFit;
     846               0 :   return NS_OK;
     847                 : }
     848               0 : NS_IMETHODIMP nsPrintSettings::SetShrinkToFit(bool aShrinkToFit)
     849                 : {
     850               0 :   mShrinkToFit = aShrinkToFit;
     851               0 :   return NS_OK;
     852                 : }
     853                 : 
     854                 : /* attribute boolean showPrintProgress; */
     855               0 : NS_IMETHODIMP nsPrintSettings::GetShowPrintProgress(bool *aShowPrintProgress)
     856                 : {
     857               0 :   NS_ENSURE_ARG_POINTER(aShowPrintProgress);
     858               0 :   *aShowPrintProgress = mShowPrintProgress;
     859               0 :   return NS_OK;
     860                 : }
     861               0 : NS_IMETHODIMP nsPrintSettings::SetShowPrintProgress(bool aShowPrintProgress)
     862                 : {
     863               0 :   mShowPrintProgress = aShowPrintProgress;
     864               0 :   return NS_OK;
     865                 : }
     866                 : 
     867                 : /* attribute wstring paperName; */
     868               0 : NS_IMETHODIMP nsPrintSettings::GetPaperName(PRUnichar * *aPaperName)
     869                 : {
     870               0 :   NS_ENSURE_ARG_POINTER(aPaperName);
     871               0 :   if (!mPaperName.IsEmpty()) {
     872               0 :     *aPaperName = ToNewUnicode(mPaperName);
     873                 :   } else {
     874               0 :     *aPaperName = nsnull;
     875                 :   }
     876               0 :   return NS_OK;
     877                 : }
     878               0 : NS_IMETHODIMP nsPrintSettings::SetPaperName(const PRUnichar * aPaperName)
     879                 : {
     880               0 :   if (aPaperName) {
     881               0 :     mPaperName = aPaperName;
     882                 :   } else {
     883               0 :     mPaperName.SetLength(0);
     884                 :   }
     885               0 :   return NS_OK;
     886                 : }
     887                 : 
     888                 : /* attribute wstring plexName; */
     889               0 : NS_IMETHODIMP nsPrintSettings::GetPlexName(PRUnichar * *aPlexName)
     890                 : {
     891               0 :   NS_ENSURE_ARG_POINTER(aPlexName);
     892               0 :   if (!mPlexName.IsEmpty()) {
     893               0 :     *aPlexName = ToNewUnicode(mPlexName);
     894                 :   } else {
     895               0 :     *aPlexName = nsnull;
     896                 :   }
     897               0 :   return NS_OK;
     898                 : }
     899               0 : NS_IMETHODIMP nsPrintSettings::SetPlexName(const PRUnichar * aPlexName)
     900                 : {
     901               0 :   if (aPlexName) {
     902               0 :     mPlexName = aPlexName;
     903                 :   } else {
     904               0 :     mPlexName.SetLength(0);
     905                 :   }
     906               0 :   return NS_OK;
     907                 : }
     908                 : 
     909                 : /* attribute boolean howToEnableFrameUI; */
     910               0 : NS_IMETHODIMP nsPrintSettings::GetHowToEnableFrameUI(PRInt16 *aHowToEnableFrameUI)
     911                 : {
     912               0 :   NS_ENSURE_ARG_POINTER(aHowToEnableFrameUI);
     913               0 :   *aHowToEnableFrameUI = mHowToEnableFrameUI;
     914               0 :   return NS_OK;
     915                 : }
     916               0 : NS_IMETHODIMP nsPrintSettings::SetHowToEnableFrameUI(PRInt16 aHowToEnableFrameUI)
     917                 : {
     918               0 :   mHowToEnableFrameUI = aHowToEnableFrameUI;
     919               0 :   return NS_OK;
     920                 : }
     921                 : 
     922                 : /* attribute long isCancelled; */
     923               0 : NS_IMETHODIMP nsPrintSettings::GetIsCancelled(bool *aIsCancelled)
     924                 : {
     925               0 :   NS_ENSURE_ARG_POINTER(aIsCancelled);
     926               0 :   *aIsCancelled = mIsCancelled;
     927               0 :   return NS_OK;
     928                 : }
     929               0 : NS_IMETHODIMP nsPrintSettings::SetIsCancelled(bool aIsCancelled)
     930                 : {
     931               0 :   mIsCancelled = aIsCancelled;
     932               0 :   return NS_OK;
     933                 : }
     934                 : 
     935                 : /* attribute double paperWidth; */
     936               0 : NS_IMETHODIMP nsPrintSettings::GetPaperWidth(double *aPaperWidth)
     937                 : {
     938               0 :   NS_ENSURE_ARG_POINTER(aPaperWidth);
     939               0 :   *aPaperWidth = mPaperWidth;
     940               0 :   return NS_OK;
     941                 : }
     942               0 : NS_IMETHODIMP nsPrintSettings::SetPaperWidth(double aPaperWidth)
     943                 : {
     944               0 :   mPaperWidth = aPaperWidth;
     945               0 :   return NS_OK;
     946                 : }
     947                 : 
     948                 : /* attribute double paperHeight; */
     949               0 : NS_IMETHODIMP nsPrintSettings::GetPaperHeight(double *aPaperHeight)
     950                 : {
     951               0 :   NS_ENSURE_ARG_POINTER(aPaperHeight);
     952               0 :   *aPaperHeight = mPaperHeight;
     953               0 :   return NS_OK;
     954                 : }
     955               0 : NS_IMETHODIMP nsPrintSettings::SetPaperHeight(double aPaperHeight)
     956                 : {
     957               0 :   mPaperHeight = aPaperHeight;
     958               0 :   return NS_OK;
     959                 : }
     960                 : 
     961                 : /* attribute short PaperSizeUnit; */
     962               0 : NS_IMETHODIMP nsPrintSettings::GetPaperSizeUnit(PRInt16 *aPaperSizeUnit)
     963                 : {
     964               0 :   NS_ENSURE_ARG_POINTER(aPaperSizeUnit);
     965               0 :   *aPaperSizeUnit = mPaperSizeUnit;
     966               0 :   return NS_OK;
     967                 : }
     968               0 : NS_IMETHODIMP nsPrintSettings::SetPaperSizeUnit(PRInt16 aPaperSizeUnit)
     969                 : {
     970               0 :   mPaperSizeUnit = aPaperSizeUnit;
     971               0 :   return NS_OK;
     972                 : }
     973                 : 
     974                 : /* attribute short PaperSizeType; */
     975               0 : NS_IMETHODIMP nsPrintSettings::GetPaperSizeType(PRInt16 *aPaperSizeType)
     976                 : {
     977               0 :   NS_ENSURE_ARG_POINTER(aPaperSizeType);
     978               0 :   *aPaperSizeType = mPaperSizeType;
     979               0 :   return NS_OK;
     980                 : }
     981               0 : NS_IMETHODIMP nsPrintSettings::SetPaperSizeType(PRInt16 aPaperSizeType)
     982                 : {
     983               0 :   mPaperSizeType = aPaperSizeType;
     984               0 :   return NS_OK;
     985                 : }
     986                 : 
     987                 : /* attribute short PaperData; */
     988               0 : NS_IMETHODIMP nsPrintSettings::GetPaperData(PRInt16 *aPaperData)
     989                 : {
     990               0 :   NS_ENSURE_ARG_POINTER(aPaperData);
     991               0 :   *aPaperData = mPaperData;
     992               0 :   return NS_OK;
     993                 : }
     994               0 : NS_IMETHODIMP nsPrintSettings::SetPaperData(PRInt16 aPaperData)
     995                 : {
     996               0 :   mPaperData = aPaperData;
     997               0 :   return NS_OK;
     998                 : }
     999                 : 
    1000                 : /** ---------------------------------------------------
    1001                 :  *  See documentation in nsPrintOptionsImpl.h
    1002                 :  *      @update 6/21/00 dwc
    1003                 :  *      @update 1/12/01 rods
    1004                 :  */
    1005                 : NS_IMETHODIMP 
    1006               0 : nsPrintSettings::SetMarginInTwips(nsIntMargin& aMargin)
    1007                 : {
    1008               0 :   mMargin = aMargin;
    1009               0 :   return NS_OK;
    1010                 : }
    1011                 : 
    1012                 : NS_IMETHODIMP 
    1013               0 : nsPrintSettings::SetEdgeInTwips(nsIntMargin& aEdge)
    1014                 : {
    1015               0 :   mEdge = aEdge;
    1016               0 :   return NS_OK;
    1017                 : }
    1018                 : 
    1019                 : // NOTE: Any subclass implementation of this function should make sure
    1020                 : // to check for negative margin values in aUnwriteableMargin (which 
    1021                 : // would indicate that we should use the system default unwriteable margin.)
    1022                 : NS_IMETHODIMP 
    1023               0 : nsPrintSettings::SetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin)
    1024                 : {
    1025               0 :   if (aUnwriteableMargin.top >= 0) {
    1026               0 :     mUnwriteableMargin.top = aUnwriteableMargin.top;
    1027                 :   }
    1028               0 :   if (aUnwriteableMargin.left >= 0) {
    1029               0 :     mUnwriteableMargin.left = aUnwriteableMargin.left;
    1030                 :   }
    1031               0 :   if (aUnwriteableMargin.bottom >= 0) {
    1032               0 :     mUnwriteableMargin.bottom = aUnwriteableMargin.bottom;
    1033                 :   }
    1034               0 :   if (aUnwriteableMargin.right >= 0) {
    1035               0 :     mUnwriteableMargin.right = aUnwriteableMargin.right;
    1036                 :   }
    1037               0 :   return NS_OK;
    1038                 : }
    1039                 : 
    1040                 : /** ---------------------------------------------------
    1041                 :  *  See documentation in nsPrintOptionsImpl.h
    1042                 :  *      @update 6/21/00 dwc
    1043                 :  */
    1044                 : NS_IMETHODIMP 
    1045               0 : nsPrintSettings::GetMarginInTwips(nsIntMargin& aMargin)
    1046                 : {
    1047               0 :   aMargin = mMargin;
    1048               0 :   return NS_OK;
    1049                 : }
    1050                 : 
    1051                 : NS_IMETHODIMP 
    1052               0 : nsPrintSettings::GetEdgeInTwips(nsIntMargin& aEdge)
    1053                 : {
    1054               0 :   aEdge = mEdge;
    1055               0 :   return NS_OK;
    1056                 : }
    1057                 : 
    1058                 : NS_IMETHODIMP 
    1059               0 : nsPrintSettings::GetUnwriteableMarginInTwips(nsIntMargin& aUnwriteableMargin)
    1060                 : {
    1061               0 :   aUnwriteableMargin = mUnwriteableMargin;
    1062               0 :   return NS_OK;
    1063                 : }
    1064                 : 
    1065                 : /** ---------------------------------------------------
    1066                 :  * Stub - platform-specific implementations can use this function.
    1067                 :  */
    1068                 : NS_IMETHODIMP
    1069               0 : nsPrintSettings::SetupSilentPrinting()
    1070                 : {
    1071               0 :   return NS_OK;
    1072                 : }
    1073                 : 
    1074                 : /** ---------------------------------------------------
    1075                 :  *  See documentation in nsPrintOptionsImpl.h
    1076                 :  */
    1077                 : NS_IMETHODIMP 
    1078               0 : nsPrintSettings::GetEffectivePageSize(double *aWidth, double *aHeight)
    1079                 : {
    1080               0 :   if (mPaperSizeUnit == kPaperSizeInches) {
    1081               0 :     *aWidth  = NS_INCHES_TO_TWIPS(float(mPaperWidth));
    1082               0 :     *aHeight = NS_INCHES_TO_TWIPS(float(mPaperHeight));
    1083                 :   } else {
    1084               0 :     *aWidth  = NS_MILLIMETERS_TO_TWIPS(float(mPaperWidth));
    1085               0 :     *aHeight = NS_MILLIMETERS_TO_TWIPS(float(mPaperHeight));
    1086                 :   }
    1087               0 :   if (kLandscapeOrientation == mOrientation) {
    1088               0 :     double temp = *aWidth;
    1089               0 :     *aWidth = *aHeight;
    1090               0 :     *aHeight = temp;
    1091                 :   }
    1092               0 :   return NS_OK;
    1093                 : }
    1094                 : 
    1095                 : NS_IMETHODIMP
    1096               0 : nsPrintSettings::GetPageRanges(nsTArray<PRInt32> &aPages)
    1097                 : {
    1098               0 :   aPages.Clear();
    1099               0 :   return NS_OK;
    1100                 : }
    1101                 : 
    1102                 : nsresult 
    1103               0 : nsPrintSettings::_Clone(nsIPrintSettings **_retval)
    1104                 : {
    1105               0 :   nsPrintSettings* printSettings = new nsPrintSettings(*this);
    1106               0 :   return printSettings->QueryInterface(NS_GET_IID(nsIPrintSettings), (void**)_retval); // ref counts
    1107                 : }
    1108                 : 
    1109                 : /* nsIPrintSettings clone (); */
    1110                 : NS_IMETHODIMP 
    1111               0 : nsPrintSettings::Clone(nsIPrintSettings **_retval)
    1112                 : {
    1113               0 :   NS_ENSURE_ARG_POINTER(_retval);
    1114               0 :   return _Clone(_retval);
    1115                 : }
    1116                 : 
    1117                 : /* void assign (in nsIPrintSettings aPS); */
    1118                 : nsresult 
    1119               0 : nsPrintSettings::_Assign(nsIPrintSettings *aPS)
    1120                 : {
    1121               0 :   nsPrintSettings *ps = static_cast<nsPrintSettings*>(aPS);
    1122               0 :   *this = *ps;
    1123               0 :   return NS_OK;
    1124                 : }
    1125                 : 
    1126                 : /* void assign (in nsIPrintSettings aPS); */
    1127                 : NS_IMETHODIMP 
    1128               0 : nsPrintSettings::Assign(nsIPrintSettings *aPS)
    1129                 : {
    1130               0 :   NS_ENSURE_ARG(aPS);
    1131               0 :   return _Assign(aPS);
    1132                 : }
    1133                 : 
    1134                 : //-------------------------------------------
    1135               0 : nsPrintSettings& nsPrintSettings::operator=(const nsPrintSettings& rhs)
    1136                 : {
    1137               0 :   if (this == &rhs) {
    1138               0 :     return *this;
    1139                 :   }
    1140                 : 
    1141               0 :   mStartPageNum        = rhs.mStartPageNum;
    1142               0 :   mEndPageNum          = rhs.mEndPageNum;
    1143               0 :   mMargin              = rhs.mMargin;
    1144               0 :   mEdge                = rhs.mEdge;
    1145               0 :   mUnwriteableMargin   = rhs.mUnwriteableMargin;
    1146               0 :   mScaling             = rhs.mScaling;
    1147               0 :   mPrintBGColors       = rhs.mPrintBGColors;
    1148               0 :   mPrintBGImages       = rhs.mPrintBGImages;
    1149               0 :   mPrintRange          = rhs.mPrintRange;
    1150               0 :   mTitle               = rhs.mTitle;
    1151               0 :   mURL                 = rhs.mURL;
    1152               0 :   mHowToEnableFrameUI  = rhs.mHowToEnableFrameUI;
    1153               0 :   mIsCancelled         = rhs.mIsCancelled;
    1154               0 :   mPrintFrameTypeUsage = rhs.mPrintFrameTypeUsage;
    1155               0 :   mPrintFrameType      = rhs.mPrintFrameType;
    1156               0 :   mPrintSilent         = rhs.mPrintSilent;
    1157               0 :   mShrinkToFit         = rhs.mShrinkToFit;
    1158               0 :   mShowPrintProgress   = rhs.mShowPrintProgress;
    1159               0 :   mPaperName           = rhs.mPaperName;
    1160               0 :   mPlexName            = rhs.mPlexName;
    1161               0 :   mPaperSizeType       = rhs.mPaperSizeType;
    1162               0 :   mPaperData           = rhs.mPaperData;
    1163               0 :   mPaperWidth          = rhs.mPaperWidth;
    1164               0 :   mPaperHeight         = rhs.mPaperHeight;
    1165               0 :   mPaperSizeUnit       = rhs.mPaperSizeUnit;
    1166               0 :   mPrintReversed       = rhs.mPrintReversed;
    1167               0 :   mPrintInColor        = rhs.mPrintInColor;
    1168               0 :   mOrientation         = rhs.mOrientation;
    1169               0 :   mPrintCommand        = rhs.mPrintCommand;
    1170               0 :   mNumCopies           = rhs.mNumCopies;
    1171               0 :   mPrinter             = rhs.mPrinter;
    1172               0 :   mPrintToFile         = rhs.mPrintToFile;
    1173               0 :   mToFileName          = rhs.mToFileName;
    1174               0 :   mOutputFormat        = rhs.mOutputFormat;
    1175               0 :   mPrintPageDelay      = rhs.mPrintPageDelay;
    1176                 : 
    1177               0 :   for (PRInt32 i=0;i<NUM_HEAD_FOOT;i++) {
    1178               0 :     mHeaderStrs[i] = rhs.mHeaderStrs[i];
    1179               0 :     mFooterStrs[i] = rhs.mFooterStrs[i];
    1180                 :   }
    1181                 : 
    1182               0 :   return *this;
    1183                 : }
    1184                 : 

Generated by: LCOV version 1.7