filters.cpp File Reference

(r1785/r1760)

#include "camtypes.h"
#include "epsfiltr.h"
#include "aw_eps.h"
#include "cameleps.h"
#include "ai_eps.h"
#include "ai5_eps.h"
#include "ai8_eps.h"
#include "progress.h"
#include "chapter.h"
#include "bmpfiltr.h"
#include "native.h"
#include "nativeps.h"
#include "layer.h"
#include "freeeps.h"
#include "fontman.h"
#include "sgliboil.h"
#include "cmxfiltr.h"
#include "exjpeg.h"
#include "filtimag.h"
#include "pngfiltr.h"
#include "imjpeg.h"
#include "swffiltr.h"
#include "kerneldc.h"
#include "xsepsops.h"
#include "giffiltr.h"
#include "htmlfltr.h"
#include "lineattr.h"
#include "helpuser.h"
#include "imgmgkft.h"
#include "webfiltr.h"
#include "ftfilter.h"
#include "hardwaremanager.h"

Go to the source code of this file.

Defines

#define new   CAM_DEBUG_NEW
#define ADD_FILTER(Classname)
#define FILTER_HDRSIZE   (8192)
 Works out the best filter to use for the specified file by asking all the filters in turn whether it recognises the file.

Functions

 CC_IMPLEMENT_MEMDUMP (SnapShotList, CC_CLASS_MEMDUMP)
 CC_IMPLEMENT_MEMDUMP (SnapShotItem, ListItem)
 CC_IMPLEMENT_MEMDUMP (AttrRecordList, CC_CLASS_MEMDUMP)
 CC_IMPLEMENT_MEMDUMP (AttrRecordItem, ListItem)
BOOL GetProgressString (CCLexFile *pTheFile, String_64 *pMessage, String_64 *StrToAddToProgress=NULL)
 Works out what progress bar string to use during importing or exporting of the file specified. This consists of the passed in basic message plus, if it will fit, a truncated form, if necessary, of the filename. The file must be a diskfile so that it can access a filename, if not then nothing will be added. If the pTheFile is null then nothing will be added.


Define Documentation

#define ADD_FILTER Classname   ) 
 

Value:

/* Create, initialise and install the Generic import filter */                  \
    pFilter = new Classname;                                                        \
    if (pFilter == NULL) return FALSE;                                              \
                                                                                    \
    if (!pFilter->Init())                                                           \
    {                                                                               \
        /* Error occured - report it and stop trying to initialise filters. */      \
        InformError();                                                              \
        return TRUE;                                                                \
    }                                                                               \
                                                                                    \
    FilterList.AddTail(pFilter);

Definition at line 714 of file filters.cpp.

#define FILTER_HDRSIZE   (8192)
 

Works out the best filter to use for the specified file by asking all the filters in turn whether it recognises the file.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/10/95
Parameters:
pFile the file to be checked [INPUTS] ShowWarnings TRUE shows a message box if the best filter is found is not perfect for this file. (added 1/2/01 ChrisG)
Returns:
pointer to the best filter found or NULL if none found.

Errors: Out of memory, File not recognised.

See also:
FilterFamily::DoImport; FilterFamily::IsDefaultDocRequired;

Filter::IsDefaultDocRequired;

Definition at line 4701 of file filters.cpp.

#define new   CAM_DEBUG_NEW
 

Definition at line 200 of file filters.cpp.


Function Documentation

CC_IMPLEMENT_MEMDUMP AttrRecordItem  ,
ListItem 
 

CC_IMPLEMENT_MEMDUMP AttrRecordList  ,
CC_CLASS_MEMDUMP 
 

CC_IMPLEMENT_MEMDUMP SnapShotItem  ,
ListItem 
 

CC_IMPLEMENT_MEMDUMP SnapShotList  ,
CC_CLASS_MEMDUMP 
 

BOOL GetProgressString CCLexFile pTheFile,
String_64 pMessage,
String_64 StrToAddToProgress = NULL
 

Works out what progress bar string to use during importing or exporting of the file specified. This consists of the passed in basic message plus, if it will fit, a truncated form, if necessary, of the filename. The file must be a diskfile so that it can access a filename, if not then nothing will be added. If the pTheFile is null then nothing will be added.

Author:
Neville_Humphrys (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/7/95
Parameters:
pTheFile file being used for importing [INPUTS] pMessage pointer to the string to append extra bits to StrToAddToProgress - A string to add to the progress string. This is used mainly by the html import filter when importing bitmap to display "file 1 of n".
- [OUTPUTS]
Returns:
True if worked ok, False otherwise.
See also:
Filter::GetImportProgressString; Filter::GetExportProgressString;

Definition at line 1612 of file filters.cpp.

01613 {
01614     // Get a shortened name for the file
01615     String_256 Filename;
01616     INT32 MaxSize = pMessage->MaxLength() - pMessage->Length(); 
01617     // Now take off the size of the " '" and "'" that will be added around it
01618     MaxSize -= 3;
01619     
01620     // CCFile::GetName will return what will fit into the string povided. What we
01621     // really want is just the filename, only present on disk files.
01622     if (pTheFile != NULL && pTheFile->IS_KIND_OF(CCDiskFile))
01623     {
01624         CCDiskFile *pTheDiskFile = (CCDiskFile *)pTheFile;
01625         // This will only work on CCDiskFiles
01626         PathName path = pTheDiskFile->GetPathName();
01627 
01628         // Use just the filename
01629         Filename = path.GetFileName();
01630 
01631         // If it is still too long, turn it into the form "...ffff.ext", i.e. have an
01632         // ellipsis followed by as much of the filename as we can fit into the string.
01633         // (We use the last segment of the filename, i.e. we throw away characters from
01634         // the beginning).
01635         INT32 FilenameLen = Filename.Length();
01636         if (MaxSize < FilenameLen)
01637         {
01638             // Shuffle pathname down to fit into buffer
01639             Filename.Remove(0, FilenameLen - MaxSize);
01640 
01641             // Put the ellipsis at the front
01642             TCHAR *Buf = (TCHAR *) Filename;
01643             Buf[0] = '.';
01644             Buf[1] = '.';
01645             Buf[2] = '.';
01646         }
01647 
01648         // Do an extra check to ensure that waht we are about to add in will fit
01649         if (Filename.Length() <= MaxSize)
01650         {
01651             // If we have a valid file name and it will fit into the progress string
01652             // then tag this onto the end of the progress string with single quotes.
01653 
01654             PCTSTR      res = camStrstr( (const TCHAR *)Filename, _T(".tmp") );
01655             
01656             if (res == NULL)
01657             {
01658                 *pMessage += String_32(_R(IDS_K_FILTERS_FILESTARTQUOTE));
01659                 *pMessage += Filename;  
01660                 *pMessage += String_32(_R(IDS_K_FILTERS_FILEENDQUOTE));
01661             }
01662 
01663             // add (for instance) "file 1 of 5"....
01664             if (StrToAddToProgress && !StrToAddToProgress->IsEmpty())
01665                 *pMessage += *StrToAddToProgress;
01666         }
01667     }
01668     
01669 //  if (pExportFile->GetName(&Filename) && (Filename.Length() < MaxSize))
01670 //  {
01671 //      // If we have a valid file name and it will fit into the progress string
01672 //      // then tag this onto the end of the progress string with single quotes.
01673 //      ProgressString += " '";
01674 //      ProgressString += Filename;
01675 //      ProgressString += "'";
01676 //  }
01677     
01678     return TRUE;
01679 }


Generated on Sat Nov 10 03:49:09 2007 for Camelot by  doxygen 1.4.4