Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Protected Member Functions | Protected Attributes
nsDeviceContextXp Class Reference

#include <nsDeviceContextXP.h>

Inheritance diagram for nsDeviceContextXp:
Inheritance graph
[legend]
Collaboration diagram for nsDeviceContextXp:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsDeviceContextXp ()
 
See documentation in nsIDeviceContext.h
NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD 
InitDeviceContextXP (nsIDeviceContext *aCreatingDeviceContext, nsIDeviceContext *aPrinterContext)
 This method does nothing since a postscript devicecontext will never be created with a NativeWidget.
NS_IMETHOD CreateRenderingContext (nsIRenderingContext *&aContext)
 

NS_IMETHOD CreateRenderingContext (nsIView *aView, nsIRenderingContext *&aContext)
NS_IMETHOD CreateRenderingContext (nsIWidget *aWidget, nsIRenderingContext *&aContext)
NS_IMETHOD CreateRenderingContext (nsIDrawingSurface *aSurface, nsIRenderingContext *&aContext)
NS_IMETHOD CreateRenderingContextInstance (nsIRenderingContext *&aContext)
NS_IMETHOD SupportsNativeWidgets (PRBool &aSupportsWidgets)
 
See documentation in nsIDeviceContext.h
NS_IMETHOD GetScrollBarDimensions (float &aWidth, float &aHeight) const
 
See documentation in nsIDeviceContext.h
NS_IMETHOD CheckFontExistence (const nsString &aFontName)
 
See documentation in nsIDeviceContext.h 12/21/98 dwc
NS_IMETHOD GetDeviceSurfaceDimensions (PRInt32 &aWidth, PRInt32 &aHeight)
 
See documentation in nsIDeviceContext.h
NS_IMETHOD GetRect (nsRect &aRect)
NS_IMETHOD GetClientRect (nsRect &aRect)
 
See documentation in nsIDeviceContext.h
NS_IMETHOD GetDeviceContextFor (nsIDeviceContextSpec *aDevice, nsIDeviceContext *&aContext)
 
See documentation in nsIDeviceContext.h
NS_IMETHOD GetSystemFont (nsSystemFontID anID, nsFont *aFont) const
NS_IMETHOD BeginDocument (PRUnichar *aTitle, PRUnichar *aPrintToFileName, PRInt32 aStartPage, PRInt32 aEndPage)
 
See documentation in nsIDeviceContext.h
NS_IMETHOD EndDocument (void)
 
See documentation in nsIDeviceContext.h
NS_IMETHOD AbortDocument (void)
 
See documentation in nsIDeviceContext.h
NS_IMETHOD BeginPage (void)
 
See documentation in nsIDeviceContext.h
NS_IMETHOD EndPage (void)
 
See documentation in nsIDeviceContext.h 12/21/98 dwc
NS_IMETHOD SetSpec (nsIDeviceContextSpec *aSpec)
NS_IMETHOD GetXlibRgbHandle (XlibRgbHandle *&aHandle)
XlibRgbHandle * GetXlibRgbHandle ()
NS_IMETHOD GetDepth (PRUint32 &depth)
NS_IMETHOD GetPrintContext (nsXPrintContext *&aContext)
NS_IMETHOD CreateFontCache ()
virtual void GetFontMetricsContext (nsFontMetricsXlibContext *&aContext)
virtual void GetRCContext (nsRenderingContextXlibContext *&aContext)
 NS_DEFINE_STATIC_IID_ACCESSOR (NS_IDEVICECONTEXTXP_IID)

Protected Member Functions

virtual ~nsDeviceContextXp ()
 
See documentation in nsIDeviceContext.h 12/21/98 dwc
void DestroyXPContext ()

Protected Attributes

nsCOMPtr< nsXPrintContextmPrintContext
nsCOMPtr< nsIDeviceContextSpecmSpec
nsCOMPtr< nsIDeviceContextmParentDeviceContext
nsFontMetricsXlibContextmFontMetricsContext
nsRenderingContextXlibContextmRCContext

Detailed Description

Definition at line 47 of file nsDeviceContextXP.h.


Constructor & Destructor Documentation

nsDeviceContextXp::~nsDeviceContextXp ( ) [protected, virtual]


See documentation in nsIDeviceContext.h 12/21/98 dwc

Definition at line 74 of file nsDeviceContextXP.cpp.

Here is the call graph for this function:


Member Function Documentation


See documentation in nsIDeviceContext.h

Definition at line 348 of file nsDeviceContextXP.cpp.

{
  PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::AbortDocument()\n"));

  NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);

  nsresult rv = mPrintContext->AbortDocument();
  DestroyXPContext();
  return rv;
}

Here is the call graph for this function:

NS_IMETHODIMP nsDeviceContextXp::BeginDocument ( PRUnichar aTitle,
PRUnichar aPrintToFileName,
PRInt32  aStartPage,
PRInt32  aEndPage 
)


See documentation in nsIDeviceContext.h

Definition at line 300 of file nsDeviceContextXP.cpp.

{  
  PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::BeginDocument()\n"));

  NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);

  return mPrintContext->BeginDocument(aTitle, aPrintToFileName, aStartPage, aEndPage);
}


See documentation in nsIDeviceContext.h

Definition at line 362 of file nsDeviceContextXP.cpp.


See documentation in nsIDeviceContext.h 12/21/98 dwc

Definition at line 234 of file nsDeviceContextXP.cpp.

Here is the call graph for this function:

Definition at line 407 of file nsDeviceContextXP.cpp.

{
  mFontCache = new nsFontCacheXp();
  if (nsnull == mFontCache) {
    return NS_ERROR_OUT_OF_MEMORY;
  }
  return mFontCache->Init(this);
}


Definition at line 172 of file nsDeviceContextXP.cpp.

{
  nsresult rv;
   
  aContext = nsnull;

  NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);

  nsCOMPtr<nsRenderingContextXp> renderingContext = new nsRenderingContextXp();
  if (!renderingContext)
    return NS_ERROR_OUT_OF_MEMORY;
     
  rv = renderingContext->Init(this);

  if (NS_SUCCEEDED(rv)) {
    aContext = renderingContext;
    NS_ADDREF(aContext);
  }

  return rv;
}

Here is the call graph for this function:

Definition at line 63 of file nsDeviceContextXP.h.

{return (DeviceContextImpl::CreateRenderingContext(aView,aContext));}

Definition at line 64 of file nsDeviceContextXP.h.

{return (DeviceContextImpl::CreateRenderingContext(aWidget,aContext));}

Definition at line 72 of file nsDeviceContextXP.h.

Definition at line 194 of file nsDeviceContextXP.cpp.

{
  nsCOMPtr<nsIRenderingContext> renderingContext = new nsRenderingContextXp();
  if (!renderingContext)
    return NS_ERROR_OUT_OF_MEMORY;
         
  aContext = renderingContext;
  NS_ADDREF(aContext);
  
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 310 of file nsDeviceContextXP.cpp.

{
  PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::DestroyXPContext()\n"));

  if (!mPrintContext)
    return;

  /* gisburn: mPrintContext cannot be reused between to print
   * tasks as the destination print server may be a different one
   * or the printer used on the same print server has other
   * properties (build-in fonts for example ) than the printer
   * previously used. */
  FlushFontCache();
  DeleteRenderingContextXlibContext(mRCContext);
  DeleteFontMetricsXlibContext(mFontMetricsContext);
  mRCContext          = nsnull;
  mFontMetricsContext = nsnull;

  mPrintContext = nsnull; // nsCOMPtr will call |delete mPrintContext;|
}

Here is the call graph for this function:

Here is the caller graph for this function:


See documentation in nsIDeviceContext.h

Definition at line 334 of file nsDeviceContextXP.cpp.

{
  PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::EndDocument()\n"));

  NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);

  nsresult rv = mPrintContext->EndDocument();
  DestroyXPContext();
  return rv;
}

Here is the call graph for this function:


See documentation in nsIDeviceContext.h 12/21/98 dwc

Definition at line 373 of file nsDeviceContextXP.cpp.


See documentation in nsIDeviceContext.h

Definition at line 283 of file nsDeviceContextXP.cpp.

{
  return GetRect(aRect);
}

Here is the call graph for this function:

Definition at line 97 of file nsDeviceContextXP.h.

                     { depth = xxlib_rgb_get_depth(GetXlibRgbHandle()); return NS_OK; }

Here is the call graph for this function:


See documentation in nsIDeviceContext.h

Definition at line 291 of file nsDeviceContextXP.cpp.

{
  aContext = nsnull;
  return NS_OK;
}


See documentation in nsIDeviceContext.h

Definition at line 251 of file nsDeviceContextXP.cpp.

{
  NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);

  float width, height;
  width  = (float) mPrintContext->GetWidth();
  height = (float) mPrintContext->GetHeight();

  aWidth  = NSToIntRound(width  * mDevUnitsToAppUnits);
  aHeight = NSToIntRound(height * mDevUnitsToAppUnits);

  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void nsDeviceContextXp::GetFontMetricsContext ( nsFontMetricsXlibContext *&  aContext) [inline, virtual]

Implements nsDeviceContextX.

Definition at line 103 of file nsDeviceContextXP.h.

{ aContext = mFontMetricsContext; };

Implements nsIDeviceContextXp.

Definition at line 381 of file nsDeviceContextXP.cpp.

{
  aContext = mPrintContext;
  return NS_OK;
}
virtual void nsDeviceContextXp::GetRCContext ( nsRenderingContextXlibContext *&  aContext) [inline, virtual]

Implements nsDeviceContextX.

Definition at line 104 of file nsDeviceContextXP.h.

{ aContext = mRCContext; };

Definition at line 266 of file nsDeviceContextXP.cpp.

{
  NS_ENSURE_TRUE(mPrintContext != nsnull, NS_ERROR_NULL_POINTER);

  PRInt32 width, height;
  nsresult rv;
  rv = GetDeviceSurfaceDimensions(width, height);
  aRect.x = 0;
  aRect.y = 0;
  aRect.width = width;
  aRect.height = height;
  return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

NS_IMETHODIMP nsDeviceContextXp::GetScrollBarDimensions ( float &  aWidth,
float &  aHeight 
) const


See documentation in nsIDeviceContext.h

Definition at line 218 of file nsDeviceContextXP.cpp.

{
  // XXX Oh, yeah.  These are hard coded.
  float scale;
  GetCanonicalPixelScale(scale);
  aWidth  = 15.f * mPixelsToTwips * scale;
  aHeight = 15.f * mPixelsToTwips * scale;

  return NS_OK;
}

Definition at line 239 of file nsDeviceContextXP.cpp.

{
  if (mParentDeviceContext != nsnull) {
    return mParentDeviceContext->GetSystemFont(aID, aFont);
  }
  return NS_ERROR_FAILURE;
}
NS_IMETHOD nsDeviceContextXp::GetXlibRgbHandle ( XlibRgbHandle *&  aHandle) [inline, virtual]

Implements nsDeviceContextX.

Definition at line 94 of file nsDeviceContextXP.h.

                     { return mPrintContext->GetXlibRgbHandle(aHandle); }
XlibRgbHandle* nsDeviceContextXp::GetXlibRgbHandle ( ) [inline]

Definition at line 96 of file nsDeviceContextXP.h.

{ XlibRgbHandle *h; mPrintContext->GetXlibRgbHandle(h); return h; } 

Here is the caller graph for this function:

This method does nothing since a postscript devicecontext will never be created with a NativeWidget.

12/21/98 dwc

Implements nsIDeviceContextXp.

Implements nsIDeviceContextXp.

Definition at line 81 of file nsDeviceContextXP.cpp.

{
  nsresult  rv = NS_ERROR_FAILURE;
  PR_LOG(nsDeviceContextXpLM, PR_LOG_DEBUG, ("nsDeviceContextXp::SetSpec()\n"));

  nsCOMPtr<nsIDeviceContextSpecXp> xpSpec;

  mSpec = aSpec;

  if (mPrintContext)
    DestroyXPContext(); // we cannot reuse that...
    
  mPrintContext = new nsXPrintContext();
  if (!mPrintContext)
    return  NS_ERROR_OUT_OF_MEMORY;
    
  xpSpec = do_QueryInterface(mSpec, &rv);
  if (NS_SUCCEEDED(rv)) {
    rv = mPrintContext->Init(this, xpSpec);

    if (NS_FAILED(rv)) {
      DestroyXPContext();
    }
  }
 
  return rv;
}

Here is the call graph for this function:


See documentation in nsIDeviceContext.h

Definition at line 209 of file nsDeviceContextXP.cpp.

{
  aSupportsWidgets = PR_FALSE;
  return NS_OK;
}

Member Data Documentation

Definition at line 113 of file nsDeviceContextXP.h.

Definition at line 112 of file nsDeviceContextXP.h.

Definition at line 110 of file nsDeviceContextXP.h.

Definition at line 114 of file nsDeviceContextXP.h.

Definition at line 111 of file nsDeviceContextXP.h.


The documentation for this class was generated from the following files: