InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
CHMLFiltImportProvider Class Reference
Inheritance diagram for CHMLFiltImportProvider:
CPMUnknown< IImportProvider >IImportProviderIPMUnknown

Public Member Functions

 CHMLFiltImportProvider (IPMUnknown *boss)
 
virtual int32 CountFileTypes (void)
 
virtual SysOSType GetFileType (int32 n)
 
virtual int32 CountFormats (void)
 
virtual PMString GetFormatName (int32 formatIndex)
 
virtual int32 CountExtensionsForFormat (int32 formatIndex)
 
virtual PMString GetExtensionForFormat (int32 formatIndex, int32 extensionIndex)
 
virtual ImportAbility CanImportThisType (IFormatType *formatType)
 
virtual ImportAbility CanImportThisStream (IPMStream *stream)
 
virtual void ImportThis (IDataBase *db, IPMStream *stream, UIFlags uiFlags, UIDRef *importedItem, UIDRef *pDataLinkUIDRef=nil, PMString *asFormat=nil)
 
virtual PMFlavor GetInternalFlavor (void)
 
virtual int32 CountExternalFlavors (void)
 
virtual ExternalPMFlavor GetExternalFlavor (int32 n)
 
- Public Member Functions inherited from CPMUnknown< IImportProvider >
IPMUnknownQueryInterface (PMIID interfaceID) const
 
void AddRef () const
 
void Release () const
 
void PreDirty (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
void PreDirtyNoMessage (ImplementationID prop=kInvalidImpl, bool16 allowModification=kTrue)
 
 CPMUnknown (const CPMUnknown &)=delete
 
CPMUnknownoperator= (const CPMUnknown &)=delete
 

Additional Inherited Members

- Public Types inherited from IImportProvider
enum  ImportAbility { kCannotImport, kPartialImport, kFullImport }
 
- Protected Member Functions inherited from CPMUnknown< IImportProvider >
 CPMUnknown (IPMUnknown *boss)
 
- Protected Attributes inherited from CPMUnknown< IImportProvider >
HelperInterface fHelperInterface
 

Detailed Description

Implements IImportProvider, contains the actual import filter (open provider) code. ImportThis creates the document.

The private method HandleDocLevelTags() handles the creation of page items (text boxes and images), and the private method HandleParaLevelTags() manages the application of styles and attributes to text. Also, this import provider is made to tie into the File >> Open dialog by using the kOpenServiceImpl implementation in the kCHMLFiltImportProviderBoss.

Constructor & Destructor Documentation

Binds the C implementation class onto its ImplementationID making the C code callable by the application * CHMLFiltImportProvider::CHMLFiltImportProvider (IPMUnknownboss)

Constructor.

Parameters
bossIN interface ptr from boss object on which this interface is aggregated.

Member Function Documentation

IImportProvider::ImportAbility CHMLFiltImportProvider::CanImportThisStream (IPMStreamstream)
virtual

Indicates whether the import provider can import the given stream. In this method, we also check for the file extension, and on the Macintosh, we check for the file type as well. There are three possible results:

  • IImportProvider::kFullImport: The filter can import this format.
  • IImportProvider::kPartialImport: The filter can import this file, but there may be a better match, only use this filter if no other returns kFullImport
  • IImportProvider::kCannotImport: This filter does not import this format.
Parameters
streamIN The stream to test.
Returns
Whether or not this import provider could import this stream.

Implements IImportProvider.

IImportProvider::ImportAbility CHMLFiltImportProvider::CanImportThisType (IFormatTypeformatType)
virtual

Indicates whether the import provider can import the given file type (Mac only). There are three possible results -

  • IImportProvider::kFullImport: The filter can import this format.
  • IImportProvider::kPartialImport: The filter can import this file, but there may be a better match, only use this filter if no other returns kFullImport
  • IImportProvider::kCannotImport: This filter does not import this format.
Parameters
formatTypeIN The format type to test.
Returns
Whether or not this import provider could import this type.

Implements IImportProvider.

int32 CHMLFiltImportProvider::CountExtensionsForFormat (int32 formatIndex)
virtual

Get the number of extensions that correspond to each file format supported by the import provider. An example extension would be "DOC" or "TXT". On the Mac, file extensions are only used for import provider selection for file of type 'TEXT', ' ', 'BINA', or null. Note the file extensions do not include a preceeding period '.'

Parameters
formatIndexIN
Precondition
formatIndex Must be between 0 and CountFormats().
Returns
The number of extensions supported by this import provider.

Implements IImportProvider.

int32 CHMLFiltImportProvider::CountExternalFlavors (void )
virtual

Gets the number of external flavors supported by import provider. (Flavors are used by clipboard/drag and drop)

Returns
count of external flavors supported

Implements IImportProvider.

int32 CHMLFiltImportProvider::CountFileTypes (void )
virtual

Get the number of filetypes supported by the import provider. (File types are Mac-specific.)

Returns
count of file types supported

Implements IImportProvider.

int32 CHMLFiltImportProvider::CountFormats (void )
virtual

Get the number of file formats supported by the import provider. An example file format name would be "TIFF" or "MS Word 97".

Implements IImportProvider.

PMString CHMLFiltImportProvider::GetExtensionForFormat (int32 formatIndex,
int32 extensionIndex 
)
virtual

Get the Nth extension that corresponds to the provided format (index).

Parameters
formatIndexMust be between 0 and CountFormats().
extensionIndexMust be between 0 and CountExtensionsForFormat().
Returns
The extension for the specified format.

Implements IImportProvider.

ExternalPMFlavor CHMLFiltImportProvider::GetExternalFlavor (int32 n)
virtual

Gets the Nth external flavor supported by import provider. (Flavors are used by clipboard/drag and drop)

Returns
external flavor at specified index

Implements IImportProvider.

SysOSType CHMLFiltImportProvider::GetFileType (int32 n)
virtual

Get the Nth filetype supported by the import provider.

Parameters
nIN the index of interest.
Precondition
n must be greater than 0, less than CountFileTypes().
Returns
The Nth filetype requested

Implements IImportProvider.

PMString CHMLFiltImportProvider::GetFormatName (int32 formatIndex)
virtual

Get the Nth file format supported by the import provider.

Parameters
formatIndexIN The index.
Precondition
formatIndex Must be greater than 0, less than CountFormats().
Returns
The format name at specified index, as a PMString.

Implements IImportProvider.

PMFlavor CHMLFiltImportProvider::GetInternalFlavor (void )
virtual

Gets internal flavor supported by import provider. (Flavors are used by clipboard/drag and drop)

Returns
internal flavor supported

Implements IImportProvider.

void CHMLFiltImportProvider::ImportThis (IDataBasedb,
IPMStreamstream,
UIFlags uiFlags,
UIDRefimportedItem,
UIDRefpDataLinkUIDRef = nil,
PMStringasFormat = nil 
)
virtual

This method is the main entry point of the import provider and does most of the work. This is where the CHML file is imported. It is responsible for creating the document, setting up the new document's command processor and calling the method to import the tagged text. If the import fails, the global error code must be set, giving the reason why the import failed. To cancel an import, set the global error code to kCancel. Please note that the typographer's quotation marks will NOT be modified in this plug-in.

Parameters
dbThe database where the objects are created.
streamThe data to be imported.
uiFlagsFlags to indicate whether the import provider to display or suppress it's user interface
pDataLinkUIDRefOptional. When updating this will contain the original page item UID. Providers should get their import preferences from this page item. If the preferences are not available on this page item, use the default preferences.
asFormatOptional. Return parameter of the format just imported. This string is displayed in the link information dialog. If the string is not filled in, the method GetFormatName(0) is used to get the format name.
importedItemReturns a UIDRef of the newly created imported item. This may be a page item or a text story UID.

xxxpSpreadOverlapMgr->ReInitialize();

Implements IImportProvider.