BitmapPreviewData Class Reference

#include <cbmpdata.h>

Inheritance diagram for BitmapPreviewData:

CCObject SimpleCCObject List of all members.

Public Member Functions

 BitmapPreviewData ()
 Constructor.
 ~BitmapPreviewData ()
 Destructor.
void DeleteBitmapData ()
 Removes all the data of the object, but only if its not shared with other objects of the same type.
void SetNewBitmap (KernelBitmap *pKernelBitmap, UINT32 FileSize, BitmapExportOptions *pOptions)
 Receives a new bitmap (and its file). Deletes the previous bitmap and file (if any) set for that object.
void GenerateBitmapInfoStrings (String_64 &ImageSize, String_64 &FileSize, BOOL bIncludeBpp=FALSE)
 Removes a fileGenerates image size and file size info strings.
void CalculateTime (String_64 &timestring, double)
 Calculates the time to download the bitmap.
BOOL GenerateHTMLStub (BrowserPreviewOptions BrowserOptions)
 Generate a html file which includes our bitmap, together with some other optional stuff. Used for browser preview.

Static Public Member Functions

static BOOL ComposeHTMLColour (DocColour *pColour, String_32 &OutColour)
 Converts from a DocColour to a colour string in html format: "#rrggbb", where rr - the red component, gg - the green, and rr - the blue. All the components specify a hexadecimal value in the 00 - ff range.
static BOOL ExportBrowserTypeBitmap (KernelBitmap *pBmp, PathName *pOutFile)
 Exports a kernel bitmap to a gif file, the gif preview filter is used, so that no export options dialog box is displayed.
static BOOL ExportImagemap (CCDiskFile &DiskFile, PathName *pPath, SelectionType Sel, DPI dpi, ImagemapFilterOptions ifoOptionsToUse)
 Generate a imagemap for our bitmap, and writes it out to our html page.
static BOOL SetBackgroundFromPage (CCDiskFile &DiskFile, Spread *pSpread=NULL)
 Gets the current page background from the current document and generates an HTML string which displays the same background on the HTML page. If a spread has been specified then use that instead of the current document. See Also: BitmapPreviewData::ComposeHTMLColour, BitmapPreviewData::ExportBrowserTypeBitmap.

Private Member Functions

 CC_DECLARE_DYNAMIC (BitmapPreviewData)

Private Attributes

KernelBitmapm_pBitmap
UINT32 m_FileSize
BitmapExportOptionsm_pOptions
PathNamem_pTempHTMLPath
BOOL m_bIsSameBitmap

Static Private Attributes

static PathNamepPagePath = NULL

Friends

class BitmapExportPreviewDialog
class BmapPrevDlg

Detailed Description

Definition at line 151 of file cbmpdata.h.


Constructor & Destructor Documentation

BitmapPreviewData::BitmapPreviewData  ) 
 

Constructor.

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/4/97

Definition at line 258 of file cbmpdata.cpp.

00259 {
00260     m_pBitmap = NULL;
00261     m_FileSize = 0;
00262     m_pOptions = NULL;
00263     m_pTempHTMLPath = NULL;
00264     
00265     m_bIsSameBitmap = TRUE;
00266 }

BitmapPreviewData::~BitmapPreviewData  ) 
 

Destructor.

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/4/97

Definition at line 277 of file cbmpdata.cpp.

00278 {
00279     DeleteBitmapData();
00280 }


Member Function Documentation

void BitmapPreviewData::CalculateTime String_64 timestring,
double  speed
 

Calculates the time to download the bitmap.

> void BitmapPreviewData::CalculateTime(String_64 &timestring,double speed)

Author:
Martin_Bell (Xara Group Ltd) <camelotdev@xara.com> Donnelly
Date:
12/7/97
Parameters:
speed - the download speed [INPUTS]
- [OUTPUTS]
Returns:
timestring - The timeing to be returned as a string

Definition at line 1515 of file cbmpdata.cpp.

01516  {
01517      // sanity check
01518      
01519      double dtime;
01520      String_64 tempstring;
01521      char buffer[16];
01522      INT32 j;
01523      String_16 times;
01524      
01525      dtime =(m_FileSize * 8.0)/speed;
01526      
01527      if (fabs(dtime) == fabs(1.000)) 
01528      {
01529          tempstring.MakeMsg(_R(IDS_1SEC));
01530          timestring.MakeMsg(_R(IDS_TIME_ENTRY),(TCHAR *)tempstring);
01531      }
01532      else if (fabs(dtime) < fabs(1.000))
01533      {
01534          //Added by Graham 14/9/97
01535          
01536          tempstring.MakeMsg(_R(IDS_LESSTHANONESECOND));
01537          timestring.MakeMsg(_R(IDS_TIME_ENTRY),(TCHAR *)tempstring);
01538          
01539      }
01540      else
01541      { 
01542          /* Format and print various data: */
01543          j  = sprintf( buffer,"%.2f",dtime);
01544          
01545          times.MakeMsg(_R(IDS_SECS_MOD), buffer);
01546          timestring.MakeMsg(_R(IDS_TIME_ENTRY),(const TCHAR *)times);
01547      }
01548      
01549      
01550  }

BitmapPreviewData::CC_DECLARE_DYNAMIC BitmapPreviewData   )  [private]
 

BOOL BitmapPreviewData::ComposeHTMLColour DocColour pColour,
String_32 OutColour
[static]
 

Converts from a DocColour to a colour string in html format: "#rrggbb", where rr - the red component, gg - the green, and rr - the blue. All the components specify a hexadecimal value in the 00 - ff range.

> static BOOL BitmapPreviewData::ComposeHTMLColour(DocColour *pColour, String_32 &OutColour)

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/4/97
Parameters:
pColour - pointer to a DocColour [INPUTS]
OutColour - string, where the converted colour is stored. [OUTPUTS]

Definition at line 337 of file cbmpdata.cpp.

00338 {
00339     if (pColour == NULL)
00340         return FALSE;
00341     
00342     // get the RGB values from the colour
00343     INT32 R, G, B;
00344     pColour->GetRGBValue(&R, &G, &B);
00345     
00346     // convert this into a html colour string
00347     OutColour = String_32( _T("#") );
00348     String_32 c;
00349     
00350     // add the red component
00351     if (R < 16) // is a leading 0 required
00352         OutColour += _T("0");
00353     c._MakeMsg( _T("#1%X"), R % 256);
00354     OutColour += c;
00355     
00356     // the green component
00357     if (G < 16)
00358         OutColour += _T("0");
00359     c._MakeMsg( _T("#1%X"), G % 256);
00360     OutColour += c;
00361     
00362     // the blue component
00363     if (B < 16)
00364         OutColour += _T("0");
00365     c._MakeMsg( _T("#1%X"), B % 256);
00366     OutColour += c;
00367     
00368     return TRUE;
00369 }

void BitmapPreviewData::DeleteBitmapData  ) 
 

Removes all the data of the object, but only if its not shared with other objects of the same type.

> void BitmapPreviewData::DeleteBitmapData()

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/4/97

Definition at line 294 of file cbmpdata.cpp.

00295 {
00296     if (!m_bIsSameBitmap)
00297     {
00298         // delete the bitmap
00299         if (m_pBitmap != NULL)
00300             delete m_pBitmap;
00301         m_pBitmap = NULL;
00302         
00303         // delete the options   
00304         // SMFIX - Please dont delete my options these are only place holders, this class is NOT responsible for these objects
00305         //if (m_pOptions != NULL)
00306         //  delete m_pOptions;
00307         //m_pOptions = NULL;
00308     }
00309     
00310     // delete the html stub file
00311     if (m_pTempHTMLPath != NULL)
00312     {
00313         // delete the temp file 
00314         FileUtil::DeleteFile(m_pTempHTMLPath);
00315         
00316         // delete the path name
00317         delete m_pTempHTMLPath;
00318     }
00319     m_pTempHTMLPath = NULL;
00320 }

BOOL BitmapPreviewData::ExportBrowserTypeBitmap KernelBitmap pBmp,
PathName pOutFile
[static]
 

Exports a kernel bitmap to a gif file, the gif preview filter is used, so that no export options dialog box is displayed.

> static BOOL BitmapPreviewData::ExportBrowserTypeBitmap(KernelBitmap *pBmp,PathName *pOutFile)

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/4/97
Parameters:
pKernelBitmap - pointer to a Bitmap to be exported [INPUTS] pOutPath - the path to export the bitmap to

Definition at line 386 of file cbmpdata.cpp.

00387 {
00388     ERROR3IF(pBmp == NULL, "NULL param passed in ExportPreviewBitmap");
00389     ERROR3IF(pOutFile == NULL, "NULL param passed in ExportPreviewBitmap");
00390     if ((pBmp == NULL) || (pOutFile == NULL))
00391         return FALSE;
00392     
00393     // create a disk file
00394     CCDiskFile TempDiskFile(1024, FALSE, TRUE);
00395     
00396     // Find the gif preview filter for export (so we don't get an options dialog box)
00397     Filter *pFilter = Filter::GetFirst();
00398     while (pFilter != NULL)
00399     {
00400         if (IS_A(pFilter,PreviewFilterGIF))
00401             // This is the filter!
00402             break;
00403         
00404         // Try the next filter
00405         pFilter = Filter::GetNext(pFilter);
00406     }
00407     
00408     if (pFilter == NULL)
00409         return FALSE;  // filter not found
00410     
00411     // get the preview bitmap filter, so no dialog box is displayed
00412     PreviewFilterGIF *pGIFFilter = (PreviewFilterGIF *)pFilter;
00413     
00414     BOOL ok = TRUE;
00415     
00416     // create an operation for the export
00417     SelOperation *pOp = new SelOperation;
00418     if (pOp != NULL)
00419     {
00420         ok = pGIFFilter->DoExportBitmap(pOp, &TempDiskFile, pOutFile, pBmp);
00421         
00422         // delete the created operation
00423         delete pOp;
00424     }
00425     else
00426         return FALSE;
00427     
00428     // close the file 
00429     if (TempDiskFile.isOpen())
00430         TempDiskFile.close();
00431     
00432     return ok;
00433 }

BOOL BitmapPreviewData::ExportImagemap CCDiskFile DiskFile,
PathName pPath,
SelectionType  Sel,
DPI  dpi,
ImagemapFilterOptions  ifoOptionsToUse
[static]
 

Generate a imagemap for our bitmap, and writes it out to our html page.

> static BOOL BitmapPreviewData::ExportImagemap(CCDiskFile &DiskFile, PathName *pPath, ImagemapFilterOptions ifoOptionsToUse)

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/6/97
Parameters:
- [INPUTS]

Definition at line 546 of file cbmpdata.cpp.

00548 {
00549     // sanity checks
00550     ERROR3IF(pPath == NULL, "BitmapPreviewData::ExportImagemap - no file path to use");
00551     if (dpi <= 0.0)
00552         return FALSE;
00553     
00554     //Rewritten by Graham 23/7/97
00555     
00556     //First find the imagemap filter
00557     ImagemapFilter* pImagemapFilter = (ImagemapFilter*) Filter::FindFilterFromID(FILTERID_IMAGEMAP);
00558     
00559     if (pImagemapFilter == NULL)  // no imagemap filter found
00560         return FALSE;
00561     
00562     //Now, we're going to set some imagemap filter options into the filter
00563     //But before we do so, let's remember the old set of imagemap filter options
00564     //so that the user doesn't get her defaults overridden
00565     ImagemapFilterOptions ifoOld=pImagemapFilter->GetFilterOptions();
00566     
00567     //Now, base our new set of options on the set we have been given
00568     ImagemapFilterOptions ifoToSet=ifoOptionsToUse;
00569     
00570     //But make the following changes
00571     ifoToSet.m_strName="PreviewBitmapImagemap";
00572     ifoToSet.m_stExportArea=Sel;
00573     ifoToSet.m_dDPI=dpi;
00574     ifoToSet.m_fClipboard=FALSE;
00575     ifoToSet.m_fFile=TRUE;
00576     ifoToSet.m_pthFile=*pPath;
00577     ifoToSet.m_fInsert=TRUE;
00578     ifoToSet.m_pfileFile=&DiskFile;
00579     ifoToSet.m_fReportErrors=FALSE;
00580     
00581     //Then set our new options back into the imagemap filter
00582     pImagemapFilter->SetFilterOptions(ifoToSet);
00583     
00584     //And tell the filter to export the file
00585     BOOL ok= pImagemapFilter->PrepareAndWriteData(Document::GetCurrent());
00586     
00587     //Finally, set the previous set of options back into the filter
00588     pImagemapFilter->SetFilterOptions(ifoOld);
00589     
00590     return ok; // return the result of the export
00591 }

void BitmapPreviewData::GenerateBitmapInfoStrings String_64 ImageSize,
String_64 FileSize,
BOOL  bIncludeBpp = FALSE
 

Removes a fileGenerates image size and file size info strings.

> void BitmapPreviewData::GenerateBitmapInfoStrings(String_64 &ImageSize, String_64 &FileSize, BOOL bIncludeBpp = FALSE)

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/97
Parameters:
- [INPUTS]
ImageSize - a string receiving the image size info for the current bitmap [OUTPUTS] FileSize - a string receiving the file size info for the current bitmap
Returns:
-

Definition at line 1427 of file cbmpdata.cpp.

01429  {
01430      // sanity check
01431      ERROR3IF(m_pBitmap == NULL, "BitmapPreviewData::GenerateBitmapInfoStrings no bitmap to work with");
01432      ERROR3IF(m_pOptions == NULL, "BitmapPreviewData::GenerateBitmapInfoStrings no export options");
01433      if ((m_pBitmap == NULL) || (m_pOptions == NULL))
01434          return;
01435      
01436      // Get a pointer to the actual bitmap so that we can get some details from it.
01437      OILBitmap *pOilBitmap = m_pBitmap->ActualBitmap;
01438      ERROR3IF(pOilBitmap == NULL,"BitmapPreviewData::GenerateBitmapInfoStrings NULL oil bitmap pointer");
01439      
01440      // Get the details from the specified bitmap
01441      BitmapInfo BmInfo;
01442      pOilBitmap->GetInfo(&BmInfo);
01443      
01444      // make the image size string
01445      
01446      // the width and the height
01447      ImageSize.MakeMsg(_R(IDS_IMAGE_SIZE), BmInfo.PixelWidth, BmInfo.PixelHeight);
01448      
01449      // the image depth
01450      if (bIncludeBpp)
01451      {
01452          UINT32 Depth = m_pOptions->GetDepth();
01453          if (Depth == 1)
01454          {
01455              // monochrome image
01456              ImageSize += String_32(_R(IDS_IMAGE_DEPTH1));
01457          }
01458          else
01459          {
01460              String_16 s;
01461              s.MakeMsg(_R(IDS_IMAGE_DEPTH2), Depth);
01462              ImageSize += s;
01463          }
01464      }
01465      
01466      // make the file size message
01467      FileSize.MakeMsg(_R(IDS_FILE_SIZE), m_FileSize);
01468  }

BOOL BitmapPreviewData::GenerateHTMLStub BrowserPreviewOptions  BrowserOptions  ) 
 

Generate a html file which includes our bitmap, together with some other optional stuff. Used for browser preview.

> BOOL BitmapPreviewData::GenerateHTMLStub(BrowserPreviewOptions BrowserOptions)

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
24/6/97
Parameters:
BrowserOptions - the options for generating the html page [INPUTS]

Definition at line 605 of file cbmpdata.cpp.

00606 {
00607 PORTNOTE("other","Removed _R(IDD_TIMAPOPTIONS) - isn't wanted yet")
00608 #ifndef EXCLUDE_FROM_XARALX
00609     // sanity checks
00610     
00611     // check for export options
00612     
00613     ERROR3IF(m_pOptions == NULL, "BitmapPreviewData::GenerateHTMLStub - need export options");
00614     if (m_pOptions == NULL) // we need export options
00615         return FALSE;
00616     
00617     // get the path for the exported bitmap from the options
00618     PathName TempPath = m_pOptions->GetPathName();
00619     
00620     // check for exported bitmap
00621     ERROR3IF((m_pOptions->HasTempFile() == FALSE) || (TempPath.IsValid() == FALSE), 
00622         "BitmapPreviewData::GenerateHTMLStub - need exported bitmap");
00623     if ((m_pOptions->HasTempFile() == FALSE) || (TempPath.IsValid() == FALSE)) 
00624         return FALSE;
00625     
00626     // delete the previous temp file, if any
00627     if (m_pTempHTMLPath != NULL)
00628         FileUtil::DeleteFile(m_pTempHTMLPath);
00629     else
00630         m_pTempHTMLPath = new PathName;
00631     
00632     // safety check
00633     if (m_pTempHTMLPath == NULL)
00634         return FALSE;
00635     
00636     // create a new temp file 
00637     if (FileUtil::GetTemporaryPathName( _T("htm"),m_pTempHTMLPath) == FALSE)
00638     {
00639         delete m_pTempHTMLPath;
00640         m_pTempHTMLPath = NULL;
00641         
00642         return FALSE;
00643     }
00644     
00645     // start creating the html page
00646     
00647     // create a disk file
00648     CCDiskFile TempDiskFile(1024, FALSE, TRUE);
00649     
00650     // get path name to server, so we can find the logo bitmaps
00651     CString str;
00652     AfxGetModuleShortFileName(AfxGetInstanceHandle(), str);
00653     String_256 strPathName(str.GetBuffer(0));
00654     
00655     // create a path name object from the program name
00656     PathName ProgramPath(strPathName);
00657     
00658     try
00659     {
00660         // open it for reading
00661         if (!TempDiskFile.open(*m_pTempHTMLPath, ios::out))
00662             return FALSE;
00663         
00664         // output header
00665         String_256 s(_R(IDS_HTML_HEAD));
00666         TempDiskFile.write(s);
00667         
00668         // set the background attributes
00669         switch (BrowserOptions.m_Background)
00670         {
00671         case BROWSER_BGR_DOC:
00672             {
00673                 // set the background from the document page
00674                 if (!SetBackgroundFromPage(TempDiskFile, BrowserOptions.m_pSpread))
00675                     ERROR3("Setting the html background from the document page failed\n");
00676             }
00677             break;
00678             
00679         case BROWSER_BGR_CHECKER:
00680             {
00681                 // display the checkered bitmap as background
00682                 
00683                 // get the checkered bitmap name
00684                 String_256 Checker(_R(IDS_HTML_CHECKER));
00685                 
00686                 // set it in the path
00687                 ProgramPath.SetFileNameAndType(Checker);
00688                 
00689                 // set the checkered bitmap as background image
00690                 s.MakeMsg(_R(IDS_CHECK_BACK), (TCHAR *)ProgramPath.GetWebAddress());
00691                 TempDiskFile.write(s);
00692             }
00693             break;
00694             
00695         case BROWSER_BGR_BITMAP:
00696             {
00697                 // set our bitmap as background image
00698                 s.MakeMsg(_R(IDS_BITMAPED_BACKGROUND), (TCHAR *)TempPath.GetWebAddress());
00699                 TempDiskFile.write(s);
00700                 
00701                 
00702             }
00703             break;
00704             
00705         case BROWSER_BGR_NONE:
00706             {
00707                 String_256 background(_R(IDS_PLAIN_BACKGROUND));
00708                 TempDiskFile.write(background);
00709             }
00710             
00711             break;
00712             
00713         default:
00714             ERROR3("Unknown type of BrowserOptions.m_Background");
00715             break;
00716         } // end of switch(BrowserOptions.m_Background) block
00717         
00718         // Get a pointer to the actual bitmap so that we can get some details from it.
00719         //      OILBitmap *pOilBitmap = m_pBitmap->ActualBitmap;
00720         //      ERROR3IF(pOilBitmap == NULL,"BitmapPreviewData::GenerateBitmapInfoStrings NULL oil bitmap pointer");
00721         
00722         // Get the details from the specified bitmap
00723         //      BitmapInfo BmInfo;
00724         //      pOilBitmap->GetInfo(&BmInfo);
00725         
00726         // output our bitmap, but only if it wasn't already set as background
00727         String_256 s2(_R(IDS_PAGE_TITLE));
00728         TempDiskFile.write(s2);
00729         
00730         if (BrowserOptions.m_Background != BROWSER_BGR_BITMAP)
00731         {
00732             // output the bitmap
00733             
00734             if (m_pOptions->GetFilterType() == MAKE_BITMAP_FILTER)
00735             {
00736                 // GIF animation
00737                 s.MakeMsg(_R(IDS_DISPLAY_PIC), (const TCHAR *)TempPath.GetFileName());
00738             }
00739             else
00740             {
00741                 if( m_pOptions->GetFilterNameStrID() == _R(IDN_FILTERNAME_GIF) ||
00742                     m_pOptions->GetFilterNameStrID() == _R(IDS_JPG_EXP_FILTERNAME) ||
00743                     m_pOptions->GetFilterNameStrID() == _R(IDT_FILTERNAME_BMP) )
00744                 {
00745                     s.MakeMsg(_R(IDS_DISPLAY_BMP), (const TCHAR *)TempPath.GetFileName());
00746                 }
00747                 else
00748                 if( m_pOptions->GetFilterNameStrID() == _R(IDS_FILTERNAME_PNG) )
00749                     s.MakeMsg(_R(IDS_DISPLAY_PNG), (const TCHAR *)TempPath.GetFileName());
00750             }   
00751             
00752             TempDiskFile.write(s);
00753         }
00754         else
00755         {
00756             s.MakeMsg(_R(IDS_EMPTY_BOX));
00757             TempDiskFile.write(s);
00758             
00759         }
00760         
00761         switch (m_pOptions->GetFilterNameStrID())
00762         {
00763         case _R(IDT_FILTERNAME_BMP):
00764             s2.MakeMsg(_R(IDS_BMP_MESSAGE));
00765             s.MakeMsg(_R(IDS_WARNING_BOX), (TCHAR *)s2);
00766             TempDiskFile.write(s);
00767             break;
00768         case _R(IDS_FILTERNAME_PNG):
00769             s2.MakeMsg(_R(IDS_PNG_MESSAGE));
00770             s.MakeMsg(_R(IDS_WARNING_BOX), (TCHAR *)s2);
00771             TempDiskFile.write(s);
00772             break;
00773         } // end of switch(m_pOptions->GetFilterNameStrID())
00774         
00775         s.MakeMsg(_R(IDS_DETAILS_BUILD));
00776         TempDiskFile.write(s);
00777         
00778         // output the bitmap info, if requested
00779         if (BrowserOptions.m_bInfo != FALSE)
00780         {
00781             String_64 ImageSize;
00782             String_64 FileSize;
00783             BOOL m_bTransparent = FALSE;
00784             INT32 count;
00785             count=0;
00786             // generate the info strings
00787             
00788             if (m_pOptions->GetFilterType() == MAKE_BITMAP_FILTER)
00789             {
00790                 // This is actually the export animated GIF using the frame gallery system
00791                 MakeBitmapExportOptions* pMkBOptions = (MakeBitmapExportOptions*)m_pOptions;
00792                 ERROR3IF(!pMkBOptions->IS_KIND_OF(MakeBitmapExportOptions), "pMkBOptions isn't");
00793                 
00794                 PALETTE Palette = PAL_OPTIMISED;
00795                 DITHER DitherType;
00796                 UINT32 colDepth;
00797                 String_64 sPalette;
00798                 String_64 Dither;
00799                 UINT32 NoOfColours;
00800                 
00801                 NoOfColours=m_pOptions->GetNumColsInPalette();
00802                 //                      Palette = pMkBOptions->GetPalette();
00803                 DitherType = pMkBOptions->GetDither();
00804                 colDepth = pMkBOptions->GetDepth();
00805                 
00806                 s2.MakeMsg(_R(IDS_ANIMATED_GIF));
00807                 
00808                 if (pMkBOptions->WantTransparent())
00809                 {
00810                     s2.MakeMsg(_R(IDS_TRANSPARENT),"animated GIF");
00811                 }
00812                 
00813                 s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
00814                 TempDiskFile.write(s);
00815                 
00816                 switch (Palette)
00817                 {
00818                 case PAL_OPTIMISED:
00819                     sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
00820                     break;
00821                 case PAL_BROWSER:
00822                 case PAL_STANDARD:
00823                     sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
00824                     break;
00825                 case PAL_GLOBALOPTIMISED:
00826                     sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
00827                     break;
00828                     
00829                 }
00830                 
00831                 if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
00832                 {
00833                     NoOfColours = 216;
00834                 }
00835                 
00836                 switch (colDepth)
00837                 {
00838                 case 32:
00839                 case 24:
00840                     s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
00841                     break;
00842                 case 8:
00843                     {
00844                         // Include the transparent colour in the colour depth check
00845                         UINT32 RealNumberOfColours = NoOfColours;
00846                         if (colDepth <= 8 && pMkBOptions->WantTransparent())
00847                         {
00848                             UINT32 MaxColours = UINT32(pow(2,colDepth));
00849                             RealNumberOfColours++;
00850                             if (RealNumberOfColours > MaxColours)
00851                                 RealNumberOfColours = MaxColours;
00852                         }
00853                         // We say 8 but we really mean the number of colours deep
00854                         // We cannot say 2 colours = 2bpp as we save it as 10 colours due
00855                         // to having 1 transparent colour and the usual lets pick 10 as the
00856                         // transparent colour. Cannot allow the user to choose 1 as the code
00857                         // then outputs 8bpp as GRenderOptPalette::GetOptimisedPalette has the
00858                         // test if (ReservedColours < NumColours), which fails.
00859                         /* if (RealNumberOfColours <= 2)
00860                         s2.MakeMsg(_R(IDS_PALETTEINFO),2,NoOfColours,(const TCHAR*)sPalette);
00861                         else */
00862                         if (RealNumberOfColours <= 16)
00863                             s2.MakeMsg(_R(IDS_PALETTEINFO),4,NoOfColours,(const TCHAR*)sPalette);
00864                         else
00865                             s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
00866                         break;
00867                     }
00868                 case 1:
00869                     s2.MakeMsg(_R(IDS_MONO),colDepth);
00870                     break;
00871                 case 4:
00872                 default:
00873                     s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);                    
00874                     break;
00875                 }
00876                 
00877                 TempDiskFile.write(s2);                 
00878                 
00879                 s.MakeMsg(_R(IDS_NODITHER));
00880                 switch (DitherType)
00881                 {
00882                 case XARADITHER_ORDERED:
00883                 case XARADITHER_ORDERED_GREY:
00884                     Dither.MakeMsg(_R(IDS_DITH_ORDER));
00885                     s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
00886                     break;
00887                 case XARADITHER_ERROR_DIFFUSION:
00888                 case XARADITHER_SIMPLE:
00889                     Dither.MakeMsg(_R(IDS_DITH_ERROR));
00890                     s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
00891                     break;
00892                 case XARADITHER_NONE:
00893                     s.MakeMsg(_R(IDS_NODITHER));
00894                     break;
00895                 }
00896                 
00897                 TempDiskFile.write(s);
00898             } // if (m_pOptions->GetFilterType() == MAKE_BITMAP_FILTER) block ends
00899             else
00900             {
00901                 switch (m_pOptions->GetFilterNameStrID())
00902                 {
00903                 case _R(IDN_FILTERNAME_GIF):
00904                     {
00905                         GIFExportOptions* pGIFOptions = (GIFExportOptions*)m_pOptions;
00906                         ERROR3IF(!pGIFOptions->IS_KIND_OF(GIFExportOptions), "pGIFOptions isn't");
00907                         PALETTE Palette = PAL_OPTIMISED;
00908                         DITHER DitherType;
00909                         UINT32 colDepth;
00910                         String_64 sPalette;
00911                         String_64 Dither;
00912                         UINT32 NoOfColours;
00913                         
00914                         NoOfColours=m_pOptions->GetNumColsInPalette();
00915                         //                      Palette = pGIFOptions->GetPalette();
00916                         DitherType = pGIFOptions->GetDither();
00917                         colDepth = pGIFOptions->GetDepth();
00918                         
00919                         
00920                         if (pGIFOptions->WantTransparent())
00921                             count=count+1;
00922                         
00923                         if (pGIFOptions->WantInterlaced())
00924                             count=count+2;
00925                         
00926                         s.MakeMsg(_R(IDS_GIF));
00927                         s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
00928                         
00929                         switch (count)
00930                         {
00931                         case 1:
00932                             s2.MakeMsg(_R(IDS_TRANSPARENT),"GIF");
00933                             break;
00934                         case 2:
00935                             s2.MakeMsg(_R(IDS_INTERLACED),"GIF");
00936                             break;
00937                         case 3:
00938                             s2.MakeMsg(_R(IDS_INTER_TRANS),"GIF");
00939                             break;
00940                         case 0:
00941                             break;
00942                         }
00943                         
00944                         s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
00945                         TempDiskFile.write(s);
00946                         
00947                         switch (Palette)
00948                         {
00949                         case PAL_OPTIMISED:
00950                             sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
00951                             break;
00952                         case PAL_BROWSER:
00953                         case PAL_STANDARD:
00954                             sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
00955                             break;
00956                         case PAL_GLOBALOPTIMISED:
00957                             sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
00958                             break;
00959                             
00960                         }
00961                         
00962                         if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
00963                         {
00964                             NoOfColours = 216;
00965                         }
00966                         
00967                         s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);                    
00968                         
00969                         if (colDepth == 8)
00970                             s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
00971                         
00972                         if (colDepth == 1)
00973                             s2.MakeMsg(_R(IDS_MONO),colDepth);
00974                         
00975                         if (colDepth > 8)
00976                             s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
00977                         
00978                         TempDiskFile.write(s2);                 
00979                         
00980                         s.MakeMsg(_R(IDS_NODITHER));
00981                         switch (DitherType)
00982                         {
00983                         case XARADITHER_ORDERED:
00984                         case XARADITHER_ORDERED_GREY:
00985                             Dither.MakeMsg(_R(IDS_DITH_ORDER));
00986                             s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
00987                             break;
00988                         case XARADITHER_ERROR_DIFFUSION:
00989                         case XARADITHER_SIMPLE:
00990                             Dither.MakeMsg(_R(IDS_DITH_ERROR));
00991                             s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
00992                             break;
00993                         case XARADITHER_NONE:
00994                             s.MakeMsg(_R(IDS_NODITHER));
00995                             break;
00996                         }
00997                         
00998                         TempDiskFile.write(s);
00999                         
01000                         
01001                     } // end case _R(IDN_FILTERNAME_GIF)
01002                     break;
01003                 case _R(IDS_JPG_EXP_FILTERNAME): 
01004                     {
01005                         JPEGExportOptions* pJPEGOptions = (JPEGExportOptions *)m_pOptions;
01006                         ERROR3IF(!pJPEGOptions->IS_KIND_OF(JPEGExportOptions), "pJPEGOptions isn't");
01007                         INT32 Quality = pJPEGOptions->GetQuality(); // Default Quality
01008                         BOOL Progressive = pJPEGOptions->DoAsProgressive();
01009                         if (Quality > 100)
01010                             Quality = 100;
01011                         
01012                         
01013                         s.MakeMsg(_R(IDS_JPEG));
01014                         s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
01015                         
01016                         if (Progressive)
01017                             s2.MakeMsg(_R(IDS_PROGRESSIVE));
01018                         
01019                         s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
01020                         TempDiskFile.write(s);
01021                         
01022                         
01023                         s.MakeMsg(_R(IDS_JCOMPRESSION),Quality);
01024                         TempDiskFile.write(s);                  
01025                     } // end case _R(IDS_JPG_EXP_FILTERNAME)
01026                     break;
01027                     
01028                 case _R(IDT_FILTERNAME_BMP):
01029                     {
01030                         BMPExportOptions* pBMPOptions = (BMPExportOptions*)m_pOptions;
01031                         ERROR3IF(!pBMPOptions->IS_KIND_OF(BMPExportOptions), "pBMPOptions isn't");
01032                         PALETTE Palette;
01033                         DITHER DitherType;
01034                         UINT32 colDepth;
01035                         String_64 sPalette;
01036                         String_64 Dither;
01037                         UINT32 NoOfColours;
01038                         
01039                         NoOfColours=m_pOptions->GetNumColsInPalette();
01040                         Palette = pBMPOptions->GetPalette();
01041                         DitherType = pBMPOptions->GetDither();
01042                         colDepth = pBMPOptions->GetDepth();
01043                         
01044                         s.MakeMsg(_R(IDS_BMP));
01045                         s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
01046                         
01047                         s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
01048                         TempDiskFile.write(s);
01049                         
01050                         switch (Palette)
01051                         {
01052                         case PAL_OPTIMISED:
01053                             sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
01054                             break;
01055                         case PAL_BROWSER:
01056                         case PAL_STANDARD:
01057                             sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
01058                             break;
01059                         case PAL_GLOBALOPTIMISED:
01060                             sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
01061                             break;
01062                         }
01063                         
01064                         if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
01065                         {
01066                             NoOfColours = 216;
01067                         }
01068                         
01069                         if (colDepth == 8 && NoOfColours > 256)
01070                             NoOfColours = 256;
01071                         
01072                         s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);                    
01073                         
01074                         if (colDepth == 8)
01075                             s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
01076                         
01077                         if (colDepth == 1)
01078                             s2.MakeMsg(_R(IDS_MONO),colDepth);
01079                         
01080                         if (colDepth > 8)
01081                             s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
01082                         
01083                         TempDiskFile.write(s2);                 
01084                         
01085                         s.MakeMsg(_R(IDS_NODITHER));
01086                         switch (DitherType)
01087                         {
01088                         case XARADITHER_ORDERED:
01089                         case XARADITHER_ORDERED_GREY:
01090                             Dither.MakeMsg(_R(IDS_DITH_ORDER));
01091                             s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
01092                             break;
01093                         case XARADITHER_ERROR_DIFFUSION:
01094                         case XARADITHER_SIMPLE:
01095                             Dither.MakeMsg(_R(IDS_DITH_ERROR));
01096                             s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
01097                             break;
01098                         case XARADITHER_NONE:
01099                             s.MakeMsg(_R(IDS_NODITHER));
01100                             break;
01101                         }
01102                         
01103                         TempDiskFile.write(s);
01104                     } // end case _R(IDT_FILTERNAME_BMP)
01105                     break;
01106                     
01107                 case _R(IDS_FILTERNAME_PNG):
01108                     {
01109                         PNGExportOptions* pPNGOptions = (PNGExportOptions*)m_pOptions;
01110                         ERROR3IF(!pPNGOptions->IS_KIND_OF(PNGExportOptions), "pPNGOptions isn't");
01111                         PALETTE Palette = PAL_OPTIMISED;
01112                         DITHER DitherType;
01113                         UINT32 colDepth;
01114                         String_64 sPalette;
01115                         String_64 Dither;
01116                         UINT32 NoOfColours;
01117                         
01118                         NoOfColours=m_pOptions->GetNumColsInPalette();
01119                         
01120                         //                      Palette = pPNGOptions->GetPalette();
01121                         DitherType = pPNGOptions->GetDither();
01122                         colDepth = pPNGOptions->GetDepth();
01123                         
01124                         
01125                         if (pPNGOptions->WantTransparent())
01126                             count=count+1;
01127                         
01128                         if (pPNGOptions->WantInterlaced())
01129                             count=count+2;
01130                         
01131                         s.MakeMsg(_R(IDS_PNG));
01132                         s2.MakeMsg(_R(IDS_A), (const TCHAR*)s);
01133                         
01134                         switch (count)
01135                         {
01136                         case 1:
01137                             s2.MakeMsg(_R(IDS_TRANSPARENT),"PNG");
01138                             break;
01139                         case 2:
01140                             s2.MakeMsg(_R(IDS_INTERLACED),"PNG");
01141                             break;
01142                         case 3:
01143                             s2.MakeMsg(_R(IDS_INTER_TRANS),"PNG");
01144                             break;
01145                         case 0:
01146                             break;
01147                         }
01148                         
01149                         s.MakeMsg(_R(IDS_TEXTLINE_BR),(const TCHAR*)s2);
01150                         TempDiskFile.write(s);
01151                         
01152                         switch (Palette)
01153                         {
01154                         case PAL_OPTIMISED:
01155                             sPalette.MakeMsg(_R(IDS_OPTIMISED_PAL));
01156                             break;
01157                         case PAL_BROWSER:
01158                         case PAL_STANDARD:
01159                             sPalette.MakeMsg(_R(IDS_BROWSER_PAL));
01160                             break;
01161                         case PAL_GLOBALOPTIMISED:
01162                             sPalette.MakeMsg(_R(IDS_GLOBAL_OPT));
01163                             break;
01164                         }
01165                         
01166                         if (colDepth == 8 && (Palette == PAL_STANDARD || Palette == PAL_BROWSER) )
01167                         {
01168                             NoOfColours = 216;
01169                         }
01170                         
01171                         s2.MakeMsg(_R(IDS_PALETTEINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);                    
01172                         
01173                         if (colDepth == 8)
01174                             s2.MakeMsg(_R(IDS_AN_PALINFO),colDepth,NoOfColours,(const TCHAR*)sPalette);
01175                         
01176                         if (colDepth == 1)
01177                             s2.MakeMsg(_R(IDS_MONO),colDepth);
01178                         
01179                         if (colDepth > 8)
01180                             s2.MakeMsg(_R(IDS_TRUECOLOUR),colDepth);
01181                         
01182                         TempDiskFile.write(s2);                 
01183                         
01184                         s.MakeMsg(_R(IDS_NODITHER));
01185                         switch (DitherType)
01186                         {
01187                         case XARADITHER_ORDERED:
01188                         case XARADITHER_ORDERED_GREY:
01189                             Dither.MakeMsg(_R(IDS_DITH_ORDER));
01190                             s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
01191                             break;
01192                         case XARADITHER_ERROR_DIFFUSION:
01193                         case XARADITHER_SIMPLE:
01194                             Dither.MakeMsg(_R(IDS_DITH_ERROR));
01195                             s.MakeMsg(_R(IDS_DITHERING),(const TCHAR*) Dither);
01196                             break;
01197                         case XARADITHER_NONE:
01198                             s.MakeMsg(_R(IDS_NODITHER));
01199                             break;
01200                         }
01201                         
01202                         TempDiskFile.write(s);
01203                     } // end case _R(IDS_FILTERNAME_PNG)
01204                     
01205                     break;
01206                 } // end switch (m_pOptions->GetFilterNameStrID())
01207             } // end else block
01208             
01209             GenerateBitmapInfoStrings(ImageSize, FileSize);
01210             
01211             // output the bitmap info
01212             s.MakeMsg(_R(IDS_HTML_INFO1), (TCHAR *)ImageSize);
01213             TempDiskFile.write(s);
01214             
01215             // output the bitmap file size info
01216             s.MakeMsg(_R(IDS_HTML_INFO2), (TCHAR *)FileSize);
01217             TempDiskFile.write(s);
01218             
01219             s.MakeMsg(_R(IDS_CLOSE_CENTER));
01220             TempDiskFile.write(s);
01221             
01222             s.MakeMsg(_R(IDS_TDTR_CLOSE));
01223             TempDiskFile.write(s);
01224             
01225             s.MakeMsg(_R(IDS_BANNER_BOX));
01226             TempDiskFile.write(s);
01227             
01228             s.MakeMsg(_R(IDS_SPEED_BUILD));
01229             TempDiskFile.write(s);
01230             //          s.MakeMsg(_R(IDS_SPEED_BUILD2));
01231             //          TempDiskFile.write(s);
01232             
01233             s.MakeMsg(_R(IDS_ES_TR));
01234             TempDiskFile.write(s);
01235             
01236             String_64 times;
01237             
01238             s.MakeMsg(_R(IDS_TIME_ENTRY),"14.4k");
01239             TempDiskFile.write(s);
01240             CalculateTime(times,14400.0);
01241             TempDiskFile.write(times);
01242             s.MakeMsg(_R(IDS_ES_TR));
01243             TempDiskFile.write(s);
01244             
01245             s.MakeMsg(_R(IDS_TIME_ENTRY),"28.8k");
01246             TempDiskFile.write(s);
01247             CalculateTime(times,28800.0);
01248             TempDiskFile.write(times);
01249             s.MakeMsg(_R(IDS_ES_TR));
01250             TempDiskFile.write(s);
01251             
01252             s.MakeMsg(_R(IDS_TIME_ENTRY),"33.6k");
01253             TempDiskFile.write(s);
01254             CalculateTime(times,33600.0);
01255             TempDiskFile.write(times);
01256             s.MakeMsg(_R(IDS_ES_TR));
01257             TempDiskFile.write(s);
01258             
01259             s.MakeMsg(_R(IDS_TIME_ENTRY),"57.6k");
01260             TempDiskFile.write(s);
01261             CalculateTime(times,57600.0);
01262             TempDiskFile.write(times);
01263             s.MakeMsg(_R(IDS_ES_TR));
01264             TempDiskFile.write(s);
01265             
01266             s.MakeMsg(_R(IDS_TIME_ENTRY),"64k");
01267             TempDiskFile.write(s);
01268             CalculateTime(times,65536.0);
01269             TempDiskFile.write(times);
01270             s.MakeMsg(_R(IDS_ES_TR));
01271             TempDiskFile.write(s);
01272             
01273             s.MakeMsg(_R(IDS_TIME_ENTRY),"128k");
01274             TempDiskFile.write(s);
01275             CalculateTime(times,131072.0);
01276             TempDiskFile.write(times);
01277             
01278             //          s.MakeMsg(_R(IDS_ES_TR));
01279             //          TempDiskFile.write(s);
01280             
01281             s.MakeMsg(_R(IDS_SPEED_END));
01282             TempDiskFile.write(s);
01283             
01284             TRACE( _T("m_FileSize = %d"), m_FileSize);
01285         } // end of if (BrowserOptions.m_bInfo != FALSE)
01286         
01287         String_64 webaddy(_R(IDS_HTML_URL_PROGRAM));
01288         //Mark Howitt, 29/10/97. Setup the _R(IDS_HTML_URL_VISITMSG) To be a TCHAR* Also. It likes it that way!
01289         String_64 webvmess(_R(IDS_HTML_URL_VISITMSG));
01290         
01291         s.MakeMsg(_R(IDS_LINK_BOX),(TCHAR *)webaddy,(TCHAR *)webvmess);
01292         TempDiskFile.write(s);
01293         
01294         //end of my stuff
01295         
01296         s.MakeMsg(_R(IDS_END_TABLE));
01297         TempDiskFile.write(s);
01298         
01299         s.MakeMsg(_R(IDS_CLOSE_CENTER));
01300         TempDiskFile.write(s);
01301         
01302         // output the "Exported from" string
01303         
01304         // get the xara logo file name
01305         String_256 Logo(_R(IDS_HTML_XARALOGO));
01306         
01307         // set it in the path
01308         ProgramPath.SetFileNameAndType(Logo);
01309         
01310         // get the xara link
01311         String_256 URL(_R(IDS_HTML_URL_XARA));
01312         
01313         // output the xara link and the xara logo
01314         s.MakeMsg(_R(IDS_HTML_XARA), (TCHAR *)URL, (TCHAR *)ProgramPath.GetWebAddress());
01315         TempDiskFile.write(s);
01316         
01317         // Do not display the Xara X logo bottom right...
01318         /*
01319         // get the program logo file name
01320         Logo.Load(_R(IDS_HTML_PROGRAMLOGO));
01321         
01322         // set it in the path
01323         ProgramPath.SetFileNameAndType(Logo);
01324         
01325         // output the program link
01326         URL.Load(_R(IDS_HTML_URL_PROGRAM));
01327         s.MakeMsg(_R(IDS_HTML_PROGRAM), (TCHAR *)URL, (TCHAR *)ProgramPath.GetWebAddress());
01328         TempDiskFile.write(s);
01329         */
01330         
01331         // output the end of the file
01332         s.Load(_R(IDS_HTML_END));
01333         TempDiskFile.write(s);
01334         
01335         // close the file
01336         TempDiskFile.close();
01337         
01338         // now export the image map, if the option for that is set
01339         if (BrowserOptions.m_bImagemap != FALSE)
01340         {
01341             // export the image map
01342             ExportImagemap( TempDiskFile, 
01343                 m_pTempHTMLPath, 
01344                 m_pOptions->GetSelectionType(), 
01345                 m_pOptions->GetDPI(),
01346                 BrowserOptions.m_ifoImagemapOptions);
01347         }
01348         
01349         TCHAR *FileWebAddress =  m_pTempHTMLPath->GetWebAddress();
01350         
01351         //Graham 17/9/97
01352         ProgramPath.SetFileNameAndType(PRODUCT_WEBLINKEXENAME);
01353         
01354         const TCHAR *PathToWebLink = (const TCHAR *)ProgramPath.GetPath();
01355         
01356         String_256 CmdLine = PathToWebLink + String_256(" -f ") + FileWebAddress;
01357         //TCHAR *CommandLine = (TCHAR *)CmdLine;
01358         
01359         if (!InvokeWeblink(CmdLine))
01360             return FALSE;
01361         
01362     } // end of TRY block
01363     
01364     catch( CFileException )
01365     {
01366         // any disk problems - come here
01367         
01368         // not much we can do really - just close the file and return FALSE
01369         if (TempDiskFile.isOpen())
01370             TempDiskFile.close();
01371         
01372         return FALSE;
01373     }
01374 #endif
01375         
01376     return TRUE;
01377 }

BOOL BitmapPreviewData::SetBackgroundFromPage CCDiskFile DiskFile,
Spread pSpread = NULL
[static]
 

Gets the current page background from the current document and generates an HTML string which displays the same background on the HTML page. If a spread has been specified then use that instead of the current document. See Also: BitmapPreviewData::ComposeHTMLColour, BitmapPreviewData::ExportBrowserTypeBitmap.

> static BOOL BitmapPreviewData::SetBackgroundFromPage(CCDiskFile &DiskFile, Spread * pSpread = NULL)

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/4/97
Parameters:
DiskFile - the file to write to [INPUTS] pSpread - the spread to pull the page background from

Definition at line 452 of file cbmpdata.cpp.

00453 {
00454     String_256 s; // to contain the generated html strings
00455     
00456     // If the user has not specified a spead then assume the selected spread in the current doc
00457     if (pSpread == NULL)
00458     {
00459         // get the current doc
00460         Document *pDoc = Document::GetCurrent();
00461         ERROR3IF(pDoc == NULL, "No Current Document");
00462         if (pDoc == NULL)
00463             return FALSE;
00464         pSpread = pDoc->GetSelectedSpread();
00465     }
00466     
00467     // get the page colour, or bitmap fill
00468     KernelBitmap *pPageBmp = NULL;
00469     DocColour *pPageColour = NULL;
00470     OpBackground::GetPageColour(pSpread, &pPageBmp, &pPageColour);
00471     
00472     BOOL Ok = TRUE;
00473     // check for a bitmap page background first
00474     if (pPageBmp != NULL) // the page background was a bitmap
00475     {
00476         // check if we haven't exported that bitmap before
00477         if (pPagePath == NULL)
00478         {
00479             // alocate the path name
00480             pPagePath = new PathName;
00481             
00482             if (pPagePath)
00483             {
00484                 // create a new temporary file
00485                 Ok = FileUtil::GetTemporaryPathName( _T("gif"), pPagePath);
00486             }
00487             else
00488                 Ok = FALSE;
00489             
00490         }
00491         
00492         // check if we have a valid path
00493         if (Ok) Ok = pPagePath->IsValid();
00494         
00495         // export the background bitmap into the a file
00496         if (Ok && ExportBrowserTypeBitmap(pPageBmp, pPagePath))
00497         {
00498             // everything went ok, so add the link in the html file
00499             s.MakeMsg(_R(IDS_HTML_BGIMAGE), (const TCHAR *)pPagePath->GetFileName());
00500             DiskFile.write(s);
00501         }
00502         
00503         return Ok;
00504     }
00505     
00506     // If we recovered a page background colour then use that
00507     // otherwise Page is by default white so set this as a background
00508     BOOL AllocatedColour = FALSE;
00509     if (pPageColour == NULL)
00510     {
00511         // Neither colour nor bitmap.
00512         AllocatedColour = TRUE;
00513         pPageColour = new DocColour(COLOUR_WHITE);  // default colour of a page (white)
00514     }
00515     
00516     // convert to a browser colour
00517     String_32 col;
00518     if (ComposeHTMLColour(pPageColour,col))
00519     {
00520         // output the background colour
00521         s.MakeMsg(_R(IDS_HTML_BGCOLOUR), (TCHAR *)col);
00522         DiskFile.write(s);
00523     }
00524     else
00525         Ok = FALSE;
00526     
00527     if (AllocatedColour && pPageColour != NULL)
00528         delete pPageColour;
00529     
00530     return Ok;
00531 }

void BitmapPreviewData::SetNewBitmap KernelBitmap pKernelBitmap,
UINT32  FileSize,
BitmapExportOptions pOptions
 

Receives a new bitmap (and its file). Deletes the previous bitmap and file (if any) set for that object.

> void BitmapPreviewData::SetNewBitmap(KernelBitmap *pKernelBitmap, PathName *TempPath, UINT32 FileSize, BitmapExportOptions *pOptions)

Author:
Stefan_Stoykov (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/5/97
Parameters:
pKernelBitmap - pointer to a kernel bitmap [INPUTS] TempPath - The disk file of the bitmap FileSize - the size of the temp disk file pOptions - the export options for the bitmap
- [OUTPUTS]
Returns:
-

Definition at line 1489 of file cbmpdata.cpp.

01491  {
01492      // delete any previous data
01493      DeleteBitmapData();
01494      
01495      // now remember the data
01496      m_pBitmap = pKernelBitmap;
01497      m_FileSize = FileSize;
01498      m_pOptions = pOptions;
01499  }


Friends And Related Function Documentation

friend class BitmapExportPreviewDialog [friend]
 

Definition at line 156 of file cbmpdata.h.

friend class BmapPrevDlg [friend]
 

Definition at line 157 of file cbmpdata.h.


Member Data Documentation

BOOL BitmapPreviewData::m_bIsSameBitmap [private]
 

Definition at line 183 of file cbmpdata.h.

UINT32 BitmapPreviewData::m_FileSize [private]
 

Definition at line 179 of file cbmpdata.h.

KernelBitmap* BitmapPreviewData::m_pBitmap [private]
 

Definition at line 178 of file cbmpdata.h.

BitmapExportOptions* BitmapPreviewData::m_pOptions [private]
 

Definition at line 180 of file cbmpdata.h.

PathName* BitmapPreviewData::m_pTempHTMLPath [private]
 

Definition at line 181 of file cbmpdata.h.

PathName * BitmapPreviewData::pPagePath = NULL [static, private]
 

Definition at line 184 of file cbmpdata.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:51:21 2007 for Camelot by  doxygen 1.4.4