layout/base/src/nsPrintPreviewContext.cpp,3.22 | . | Disk File |
Skipping to line 41 | . | |
#include "nsIView.h" |
. |
#include "nsIView.h" |
#include "nsIWidget.h" |
. |
#include "nsIWidget.h" |
#include "nsGfxCIID.h" |
. |
#include "nsGfxCIID.h" |
#include "nsLayoutAtoms.h" |
. |
#include "nsLayoutAtoms.h" |
#include "prlog.h" |
. |
#include "prlog.h" |
  |
. |
#include "nsIPrintSettings.h" |
|
. |
|
// Print Options |
. |
class PrintPreviewContext : public nsPresContext, nsIPrintPreviewContext { |
#include "nsIPrintOptions.h" |
. |
  |
#include "nsGfxCIID.h" |
. |
  |
#include "nsIServiceManager.h" |
. |
  |
static NS_DEFINE_CID(kPrintOptionsCID, NS_PRINTOPTIONS_CID); |
. |
  |
|
. |
  |
class PrintPreviewContext : public nsPresContext { |
. |
  |
public: |
. |
public: |
PrintPreviewContext(); |
. |
PrintPreviewContext(); |
~PrintPreviewContext(); |
. |
~PrintPreviewContext(); |
|
. |
|
//Interfaces for addref and release and queryinterface |
. |
//Interfaces for addref and release and queryinterface |
Skipping to line 59 | . | |
NS_IMETHOD IsPaginated(PRBool* aResult); |
. |
NS_IMETHOD IsPaginated(PRBool* aResult); |
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) { mCanPaginatedScroll = aRe
sult; return NS_OK; } |
. |
NS_IMETHOD SetPaginatedScrolling(PRBool aResult) { mCanPaginatedScroll = aRe
sult; return NS_OK; } |
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult); |
. |
NS_IMETHOD GetPaginatedScrolling(PRBool* aResult); |
NS_IMETHOD GetPageDim(nsRect* aActualRect, nsRect* aAdjRect); |
. |
NS_IMETHOD GetPageDim(nsRect* aActualRect, nsRect* aAdjRect); |
NS_IMETHOD SetPageDim(nsRect* aRect); |
. |
NS_IMETHOD SetPageDim(nsRect* aRect); |
  |
. |
NS_IMETHOD SetPrintSettings(nsIPrintSettings* aPS); |
  |
. |
NS_IMETHOD GetPrintSettings(nsIPrintSettings** aPS); |
|
. |
|
protected: |
. |
protected: |
nsRect mPageDim; |
. |
nsRect mPageDim; |
PRBool mCanPaginatedScroll; |
. |
PRBool mCanPaginatedScroll; |
  |
. |
nsCOMPtr<nsIPrintSettings> mPrintSettings; |
}; |
. |
}; |
|
. |
|
PrintPreviewContext::PrintPreviewContext() : |
. |
PrintPreviewContext::PrintPreviewContext() : |
mPageDim(-1,-1,-1,-1), |
. |
mPageDim(-1,-1,-1,-1), |
mCanPaginatedScroll(PR_TRUE) |
. |
mCanPaginatedScroll(PR_TRUE) |
Skipping to line 143 | . | |
NS_ENSURE_ARG_POINTER(aPageDim); |
. |
NS_ENSURE_ARG_POINTER(aPageDim); |
mPageDim = *aPageDim; |
. |
mPageDim = *aPageDim; |
return NS_OK; |
. |
return NS_OK; |
} |
. |
} |
|
. |
|
  |
. |
NS_IMETHODIMP |
  |
. |
PrintPreviewContext::SetPrintSettings(nsIPrintSettings * aPrintSettings) |
  |
. |
{ |
  |
. |
NS_ENSURE_ARG_POINTER(aPrintSettings); |
  |
. |
mPrintSettings = aPrintSettings; |
  |
. |
return NS_OK; |
  |
. |
} |
  |
. |
|
  |
. |
NS_IMETHODIMP |
  |
. |
PrintPreviewContext::GetPrintSettings(nsIPrintSettings * *aPrintSettings) |
  |
. |
{ |
  |
. |
NS_ENSURE_ARG_POINTER(aPrintSettings); |
  |
. |
|
  |
. |
*aPrintSettings = mPrintSettings; |
  |
. |
NS_IF_ADDREF(*aPrintSettings); |
  |
. |
|
  |
. |
return NS_OK; |
  |
. |
} |
  |
. |
|
NS_EXPORT nsresult |
. |
NS_EXPORT nsresult |
NS_NewPrintPreviewContext(nsIPresContext** aInstancePtrResult) |
. |
NS_NewPrintPreviewContext(nsIPrintPreviewContext** aInstancePtrResult) |
{ |
. |
{ |
if (aInstancePtrResult == nsnull) { |
. |
if (aInstancePtrResult == nsnull) { |
return NS_ERROR_NULL_POINTER; |
. |
return NS_ERROR_NULL_POINTER; |
} |
. |
} |
|
. |
|
Skipping to line 175 | . | |
|
. |
|
if (it == nsnull) { |
. |
if (it == nsnull) { |
return NS_ERROR_OUT_OF_MEMORY; |
. |
return NS_ERROR_OUT_OF_MEMORY; |
} |
. |
} |
|
. |
|
return it->QueryInterface(NS_GET_IID(nsIPresContext), (void **) aInstancePtr
Result); |
. |
return it->QueryInterface(NS_GET_IID(nsIPrintPreviewContext), (void **) aIns
tancePtrResult); |
} |
. |
} |