Bug 66057 - "Proxy: $http_proxy should influence proxy settings" [p=roc@ocallahan.org (Robert O'Callahan [roc]) / diane@ghic.org (Diane Trout) / ventnor.bugzilla@yahoo.com.au (Michael Ventnor) r=josh r+sr=biesi a1.9=damons]
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef nsRenderingContextImpl_h___
#define nsRenderingContextImpl_h___
#include "gfxCore.h"
#include "nsIRenderingContext.h"
#include "nsPoint.h"
#include "nsSize.h"
#ifdef MOZ_CAIRO_GFX
class gfxContext;
#endif
class nsRenderingContextImpl : public nsIRenderingContext
{
// CLASS MEMBERS
public:
nsRenderingContextImpl();
// CLASS METHODS
/**
* Return the maximum length of a string that can be handled by the platform
* using the current font metrics.
* The implementation here is just a stub; classes that don't override
* the safe string methods need to implement this.
*/
virtual PRInt32 GetMaxStringLength() = 0;
/**
* Let the device context know whether we want text reordered with
* right-to-left base direction
*/
NS_IMETHOD GetRightToLeftText(PRBool* aIsRTL);
// Safe string method variants: by default, these defer to the more
// elaborate methods below
NS_IMETHOD GetWidth(const nsString& aString, nscoord &aWidth,
PRInt32 *aFontID = nsnull);
NS_IMETHOD GetWidth(const char* aString, nscoord& aWidth);
NS_IMETHOD DrawString(const nsString& aString, nscoord aX, nscoord aY,
PRInt32 aFontID = -1,
const nscoord* aSpacing = nsnull);
// Safe string methods
NS_IMETHOD GetWidth(const char* aString, PRUint32 aLength,
nscoord& aWidth);
NS_IMETHOD GetWidth(const PRUnichar *aString, PRUint32 aLength,
nscoord &aWidth, PRInt32 *aFontID = nsnull);
NS_IMETHOD GetTextDimensions(const char* aString, PRUint32 aLength,
nsTextDimensions& aDimensions);
NS_IMETHOD GetTextDimensions(const PRUnichar* aString, PRUint32 aLength,
nsTextDimensions& aDimensions, PRInt32* aFontID = nsnull);
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS)
NS_IMETHOD GetTextDimensions(const char* aString,
PRInt32 aLength,
PRInt32 aAvailWidth,
PRInt32* aBreaks,
PRInt32 aNumBreaks,
nsTextDimensions& aDimensions,
PRInt32& aNumCharsFit,
nsTextDimensions& aLastWordDimensions,
PRInt32* aFontID = nsnull);
NS_IMETHOD GetTextDimensions(const PRUnichar* aString,
PRInt32 aLength,
PRInt32 aAvailWidth,
PRInt32* aBreaks,
PRInt32 aNumBreaks,
nsTextDimensions& aDimensions,
PRInt32& aNumCharsFit,
nsTextDimensions& aLastWordDimensions,
PRInt32* aFontID = nsnull);
#endif
#ifdef MOZ_MATHML
NS_IMETHOD
GetBoundingMetrics(const char* aString,
PRUint32 aLength,
nsBoundingMetrics& aBoundingMetrics);
NS_IMETHOD
GetBoundingMetrics(const PRUnichar* aString,
PRUint32 aLength,
nsBoundingMetrics& aBoundingMetrics,
PRInt32* aFontID = nsnull);
#endif
NS_IMETHOD DrawString(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing = nsnull);
NS_IMETHOD DrawString(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID = -1,
const nscoord* aSpacing = nsnull);
// Unsafe platform-specific implementations
NS_IMETHOD GetWidthInternal(const char* aString, PRUint32 aLength,
nscoord& aWidth)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD GetWidthInternal(const PRUnichar *aString, PRUint32 aLength,
nscoord &aWidth, PRInt32 *aFontID = nsnull)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD GetTextDimensionsInternal(const char* aString, PRUint32 aLength,
nsTextDimensions& aDimensions)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD GetTextDimensionsInternal(const PRUnichar* aString, PRUint32 aLength,
nsTextDimensions& aDimensions, PRInt32* aFontID = nsnull)
{ return NS_ERROR_NOT_IMPLEMENTED; }
#if defined(_WIN32) || defined(XP_OS2) || defined(MOZ_X11) || defined(XP_BEOS)
NS_IMETHOD GetTextDimensionsInternal(const char* aString,
PRInt32 aLength,
PRInt32 aAvailWidth,
PRInt32* aBreaks,
PRInt32 aNumBreaks,
nsTextDimensions& aDimensions,
PRInt32& aNumCharsFit,
nsTextDimensions& aLastWordDimensions,
PRInt32* aFontID = nsnull)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD GetTextDimensionsInternal(const PRUnichar* aString,
PRInt32 aLength,
PRInt32 aAvailWidth,
PRInt32* aBreaks,
PRInt32 aNumBreaks,
nsTextDimensions& aDimensions,
PRInt32& aNumCharsFit,
nsTextDimensions& aLastWordDimensions,
PRInt32* aFontID = nsnull)
{ return NS_ERROR_NOT_IMPLEMENTED; }
#endif
#ifdef MOZ_MATHML
NS_IMETHOD
GetBoundingMetricsInternal(const char* aString,
PRUint32 aLength,
nsBoundingMetrics& aBoundingMetrics)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD
GetBoundingMetricsInternal(const PRUnichar* aString,
PRUint32 aLength,
nsBoundingMetrics& aBoundingMetrics,
PRInt32* aFontID = nsnull)
{ return NS_ERROR_NOT_IMPLEMENTED; }
#endif
NS_IMETHOD DrawStringInternal(const char *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
const nscoord* aSpacing = nsnull)
{ return NS_ERROR_NOT_IMPLEMENTED; }
NS_IMETHOD DrawStringInternal(const PRUnichar *aString, PRUint32 aLength,
nscoord aX, nscoord aY,
PRInt32 aFontID = -1,
const nscoord* aSpacing = nsnull)
{ return NS_ERROR_NOT_IMPLEMENTED; }
gfxContext *ThebesContext() { return nsnull; }
protected:
virtual ~nsRenderingContextImpl();
};
#endif /* nsRenderingContextImpl */