InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
SDKFileDocumentChooser Class Reference

#include <SDKFileHelper.h>

Inheritance diagram for SDKFileDocumentChooser:
SDKFileHelper

Public Member Functions

 SDKFileDocumentChooser ()
 
virtual ~SDKFileDocumentChooser ()
 
void ShowDialog ()
 
IOpenFileCmdData::OpenFlags GetOpenFlags ()
 
IOpenManagerQueryOpenManager ()
 
- Public Member Functions inherited from SDKFileHelper
 SDKFileHelper (const PMString &path)
 
 SDKFileHelper (const IDFile &file)
 
virtual ~SDKFileHelper ()
 
bool16 IsExisting () const
 
bool16 IsChosen () const
 
PMString GetPath () const
 
IDFile GetIDFile () const
 
IDFile GetAbsoluteFromRelative (const PMString &relativePath) const
 
PMString GetParentFolderAsString () const
 

Additional Inherited Members

- Static Public Member Functions inherited from SDKFileHelper
static bool16 isMacPosixPathEnabled ()
 
- Protected Member Functions inherited from SDKFileHelper
 SDKFileHelper ()
 
void initFromString ()
 
void initFromSysFile ()
 
void traceInitializeDiagnostics (int32 e) const
 
PMString calcDefaultFileName () const
 
void setChosen (bool16 chsen)
 
void setIDFile (const IDFile &file)
 
void setPath (const PMString &path)
 
PMString absoluteFromRelative (const PMString &folder, const PMString &path) const
 
bool16 isAbsolutePath (const PMString &path) const
 
bool16 isUnixPath (const PMString &path) const
 
bool16 isMacPath (const PMString &path) const
 
bool16 isWinPath (const PMString &path) const
 
PMString getMinusLastElement (const PMString &path) const
 
PMString getMinusFirstElement (const PMString &path) const
 
PMString getAsMacPath (const PMString &path) const
 
PMString getAsWinPath (const PMString &path) const
 

Detailed Description

Pops an open document dialog to allow the user to choose a document, note that this class does not actually open the chosen file, it just lets you discover which file was chosen. The files presented include all readable document files, publication, template, book and library files for example.

The dialog used(kOpenDocDialogBoss) is the same one used by the application's File>Open menu. This dialog is managed by the IOpenManager service. Each type of document the application can open has a corresponding open provider (an IImportProvider service with ServiceID=kOpenProviderService). All the kinds of files supported by registered open providers will be available in the dialog.

Once the user has chosen a document file you can use the IOpenManager service, kOpenFileCmdBoss or kOpenFileWithWindowCmdBoss to open it. Note that opening one of these files will not necessarily give you an ordinary document, you might be opening a library or a book for example.

The code below pops a document chooser dialog that shows all readable documents.


SDKFileDocumentChooser fileChooser;

fileChooser.ShowDialog();

if (fileChooser.IsChosen()) {

    IDFile chosenFile = fileChooser.GetIDFile();

    IOpenFileCmdData::OpenFlags openFlags = fileChooser.GetOpenFlags();

}

See Also
IOpenManager
kOpenDocDialogBoss
IOpenFileDialog
IOpenFileCmdData
kOpenFileWithWindowCmdBoss
kOpenFileCmdBoss

Constructor & Destructor Documentation

SDKFileDocumentChooser::SDKFileDocumentChooser ()

Constructor.

SDKFileDocumentChooser::~SDKFileDocumentChooser ()
virtual

Destructor.

Member Function Documentation

IOpenFileCmdData::OpenFlags SDKFileDocumentChooser::GetOpenFlags ()

Return the open flag specified by the user in the open document dialog.

Returns
the open flag specified by the user in the open document dialog.
Precondition
SDKFileDocumentChooser::ShowDialog should be called before calling this method.
IOpenManager * SDKFileDocumentChooser::QueryOpenManager ()

Query the service registry for the IOpenManager service.

Returns
IOpenManager interface on success, nil otherwise.
Postcondition
the caller is responsible for releasing the interface reference.
void SDKFileDocumentChooser::ShowDialog ()

Pops an open document dialog to allow the user to choose a document to be opened.

Postcondition
SDKFileHelper::IsChosen is kTrue if a document was chosen, kFalse otherwise.
SDKFileHelper::GetIDFile contains the chosen document if SDKFileHelper::IsChosen is kTrue.
SDKFileHelper::GetPath contains the path to the chosen document if SDKFileHelper::IsChosen is kTrue.
See Also
IOpenFileDialog
kOpenDocDialogBoss