Fixed postscript title. b=66943 r=mcclusk sr=attinasi

This commit is contained in:
dcone%netscape.com 2001-04-09 14:27:53 +00:00
parent 7c4817ac17
commit ae41110559
3 changed files with 16 additions and 4 deletions

View File

@ -313,7 +313,7 @@ NS_IMETHODIMP nsDeviceContextPS::BeginDocument(PRUnichar * aTitle)
mPSObj = new nsPostScriptObj();
res = mSpec->QueryInterface(kIDeviceContextSpecPSIID, (void **) &psSpec);
if ( res == NS_OK ) {
res = mPSObj->Init(psSpec);
res = mPSObj->Init(psSpec,aTitle);
}
}
return res;

View File

@ -38,6 +38,7 @@
#include "nsICharsetConverterManager.h"
#include "nsIUnicodeEncoder.h"
#include "nsIUnicodeDecoder.h"
#include "nsReadableUtils.h"
#include "nsICharsetAlias.h"
#include "nsIURI.h"
@ -128,6 +129,7 @@ nsPostScriptObj::nsPostScriptObj()
(nsISupports**) &gPrefs);
gLangGroups = new nsHashtable();
mTitle = nsnull;
}
/** ---------------------------------------------------
@ -157,6 +159,10 @@ nsPostScriptObj::~nsPostScriptObj()
}
#endif
// Cleanup things allocated along the way
if (nsnull != mTitle){
nsMemory::Free(mTitle);
}
if (nsnull != mPrintContext){
if (nsnull != mPrintContext->prInfo){
delete mPrintContext->prInfo;
@ -187,7 +193,7 @@ nsPostScriptObj::~nsPostScriptObj()
* @update 2/1/99 dwc
*/
nsresult
nsPostScriptObj::Init( nsIDeviceContextSpecPS *aSpec )
nsPostScriptObj::Init( nsIDeviceContextSpecPS *aSpec, PRUnichar * aTitle )
{
PRBool isGray, isAPrinter, isFirstPageFirst;
int printSize;
@ -312,7 +318,12 @@ printf( "dpi %f top %d bottom %d left %d right %d\n", mPrintSetup->dpi, mPrintSe
pi->pt_size = 0; // Size of above table
pi->n_pages = 0; // # of valid entries in above table
pi->doc_title="Test Title"; // best guess at title
mTitle = nsnull;
if(nsnull != aTitle){
mTitle = ToNewCString(nsLiteralString(aTitle));
}
pi->doc_title = mTitle;
pi->doc_width = 0; // Total document width
pi->doc_height = 0; // Total document height

View File

@ -211,7 +211,7 @@ public:
* Init PostScript Object
* @update 3/19/99 dwc
*/
nsresult Init( nsIDeviceContextSpecPS *aSpec);
nsresult Init( nsIDeviceContextSpecPS *aSpec, PRUnichar * aTitle);
/** ---------------------------------------------------
* Start a postscript page
* @update 2/1/99 dwc
@ -408,6 +408,7 @@ private:
PrintSetup *mPrintSetup;
PRUint16 mPageNumber;
nsCOMPtr<nsIPersistentProperties> mPrinterProps;
char *mTitle;