![]() | InDesign SDK 20.5 |
#include <SDKFileHelper.h>

Public Member Functions | |
| SDKFileDocumentChooser () | |
| virtual | ~SDKFileDocumentChooser () |
| void | ShowDialog () |
| IOpenFileCmdData::OpenFlags | GetOpenFlags () |
| IOpenManager * | QueryOpenManager () |
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 |
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(); }
| SDKFileDocumentChooser::SDKFileDocumentChooser | ( | ) |
Constructor.
| virtual |
Destructor.
| IOpenFileCmdData::OpenFlags SDKFileDocumentChooser::GetOpenFlags | ( | ) |
Return the open flag specified by the user in the open document dialog.
| IOpenManager * SDKFileDocumentChooser::QueryOpenManager | ( | ) |
Query the service registry for the IOpenManager service.
| void SDKFileDocumentChooser::ShowDialog | ( | ) |
Pops an open document dialog to allow the user to choose a document to be opened.