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

Public Member Functions | |
| SnpRunnable (ConstCString name) | |
| virtual | ~SnpRunnable () |
| virtual ConstCString | GetName () const |
| virtual ConstCString | GetDescription () const |
| virtual ConstCString | GetPreconditions () const |
| virtual ConstCString | GetCategories () const |
| virtual bool16 | CanRun (ISnpRunnableContext *runnableContext)=0 |
| virtual ErrorCode | Run (ISnpRunnableContext *runnableContext)=0 |
| virtual ErrorCode | RunUnitTest (ISnpRunnableContext *runnableContext) |
| virtual bool16 | CanLoad () const |
| virtual ErrorCode | SetupContext (ISnpRunnableContext *runnableContext) |
| virtual ISnipRunSuite::eSnpRunContextType | GetContext (void)=0 |
Protected Member Functions | |
| virtual void | SetDescription (ConstCString description) |
| virtual void | SetPreconditions (ConstCString preconditions) |
| virtual void | SetCategories (ConstCString categories) |
The hook used to make a snippet of code callable by the SnippetRunner framework and to describe the snippet in the UI. To register the snippet with the framework a static instance of the snippet must be declared. The constructor registers the snippet via SnipRunManager.
This registration happens each time the plug-in is loaded into memory. It's an approach that is ok for a development tool type plug-in like SnippetRunner but is not one that should be used for functional plug-ins.
| SnpRunnable::SnpRunnable | ( | ConstCString | name | ) |
Constructor adds the snippet to the dictionary maintained by SnipRunManager.
| name | of the snippet. |
| virtual |
Destructor removes the snippet from the dictionary maintained by SnipRunManager.
| inlinevirtual |
Define this method if your snippet should only be available to be chosen to run under a specific product(InDesign, InCopy, etc) or language (Roman, Japanese), your snippet won't be presented in the framework's UI if you return kFalse. For example if you don't want your snippet to be available to the user under InCopy implement this method and check the product.
Added for 1036945.
The code below shows how your CanLoad method can detect which product or language feature set your snippet is running under.
#include "FeatureSets.h" #include "LocaleSetting.h"
bool16 isInCopyProductFS = LocaleSetting::GetLocale().IsProductFS(kInCopyProductFS); bool16 isInDesignProductFS = LocaleSetting::GetLocale().IsProductFS(kInDesignProductFS); bool16 isRomanLanguageFS = LocaleSetting::GetLocale().IsLanguageFS(kRomanLanguageFS); bool16 isJapaneseLanguageFS = LocaleSetting::GetLocale().IsLanguageFS(kJapaneseLanguageFS);
Reimplemented in _SnpRunnerManipulateTextFrame, _SnpRunnerModifyLayoutGrid, _SnpRunnerPerformTextAttrRuby, _SnpRunnerTransformPageItems, _SnpRunnerManipulatePathandGraphics, _SnpRunnerInspectLayoutGrid, _SnpRunnerPerformTextAttrKenten, _SnpRunnerPerformNamedGrid, _SnpRunnerCreateFrameGrid, _SnpRunnerExportBookAsPDF, _SnpRunnerPerformTextAttrTateChuYoko, _SnpRunnerShowPalette, _SnpRunnerManipulateAssignment, _SnpRunnerManipulateInCopyCJKGridAttributes, _SnpRunnerPerformTextAttrWarichu, _SnpRunnerManipulateGraphicAttributes, _SnpRunnerManipulateDisplayPerformance, _SnpRunnerInspectPathInfo, _SnpRunnerManipulateTextOnPath, and _SnpRunnerExportDocAsPDF.
| pure virtual |
Can the snippet run? Snippets must implement this method and use the given ISnpRunnableContext to figure out if they can run.
| runnableContext |
Implemented in _SnpRunnerManipulateTextFrame, _SnpRunnerModifyLayoutGrid, _SnpRunnerInspectTextModel, _SnpRunnerApplyTextStyleAttributes, _SnpRunnerManipulateConditionalText, _SnpRunnerManipulateSpreadsAndPages, _SnpRunnerInspectLayoutModel, _SnpRunnerPerformCompFont, _SnpRunnerPerformTextAttrRuby, _SnpRunnerManipulateTextFootnotes, _SnpRunnerManipulateTextEndnotes, _SnpRunnerManipulateXMLElements, _SnpRunnerManipulateTableAndCellStyle, _SnpRunnerManipulateXMLTags, _SnpRunnerInsertGlyph, _SnpRunnerFindAndReplace, _SnpRunnerSortTable, _SnpRunnerPerformKinsokuTable, _SnpRunnerManipulateTextModel, _SnpRunnerTransformPageItems, _SnpRunnerManipulatePathandGraphics, _SnpRunnerManipulateTextStyle, _SnpRunnerManipulatePrintStyles, _SnpRunnerInspectFontMgr, _SnpRunnerInspectLayoutGrid, _SnpRunnerHyphenation, _SnpRunnerPerformTextAttrKenten, _SnpRunnerPerformNamedGrid, _SnpRunnerManipulateSwatch, _SnpRunnerXMLSampleHelper, _SnpRunnerManipulateTrapStyles, _SnpRunnerProcessDocumentLayerCmds, _SnpRunnerPerformTextAttrLanguage, _SnpRunnerInspectTextStyles, _SnpRunnerCreateFrameGrid, _SnpRunnerManipulateXMLSelection, _SnpRunnerImportExportXML, _SnpRunnerPerformFontGroupIterator, _SnpRunnerExportBookAsPDF, _SnpRunnerInspectSelectionXMLProperties, _SnpRunnerPerformXMPCommands, _SnpRunnerShareAppResources, _SnpRunnerChooseFile, _SnpRunnerPerformTextAttrTateChuYoko, _SnpRunnerShowPalette, _SnpRunnerPrintDocument, _SnpRunnerEstimateTextDepth, _SnpRunnerManipulateInline, _SnpRunnerPerformNoteFunction, _SnpRunnerManipulateAssignment, _SnpRunnerManipulateInCopyCJKGridAttributes, _SnpRunnerPerformTextAttrWarichu, _SnpRunnerCreateFrame, _SnpRunnerManipulateArticles, _SnpRunnerManipulateGraphicAttributes, _SnpRunnerManipulateDisplayPerformance, _SnpRunnerImportExportSnippet, _SnpRunnerInspectXMPMetaData, _SnpRunnerContentDropper, _SnpRunnerInspectPathInfo, _SnpRunnerCreateInddPreview, _SnpRunnerIterTableUseDictHier, _SnpCreateCrossReference, _SnpRunnerAddMediaFile, _SnpRunnerManipulateStructureView, _SnpRunnerInspectTableModel, _SnpRunnerModifyTable, _SnpRunnerCreateCustomAnimation, _SnpRunnerCreateAndManipulateSharedLink, _SnpRunnerIterTableStories, _SnpRunnerManipulateTextOnPath, _SnpRunnerExportDocAsPDF, _SnpRunnerHitTestFrame, _SnpRunnerSelectShape, _SnpRunnerGetTableParcel, _SnpRunnerSetTableFill, _SnpRunnerAccessTableContent, _SnpRunnerPlaceFile, _SnpRunnerCopyPasteTable, _SnpRunnerExportEPub, _SnpCreateQRCode, _SnpRunnerCreateTable, _SnpRunnerTemplate, _SnpRunnerCreateDocument, _SnpHelloCSXS, _SnpHelloBridgeTalk, and _SnpPlugPlug.
| inlinevirtual |
Return the categories this snippet belongs to, formatted as a CSV string e,g, "sdk_snippet, sdk_layout".
| pure virtual |
get the snippet context
Implemented in _SnpRunnerManipulateTextFrame, _SnpRunnerModifyLayoutGrid, _SnpRunnerInspectTextModel, _SnpRunnerApplyTextStyleAttributes, _SnpRunnerManipulateConditionalText, _SnpRunnerManipulateSpreadsAndPages, _SnpRunnerInspectLayoutModel, _SnpRunnerPerformCompFont, _SnpRunnerPerformTextAttrRuby, _SnpRunnerManipulateTextFootnotes, _SnpRunnerManipulateTextEndnotes, _SnpRunnerManipulateXMLElements, _SnpRunnerManipulateTableAndCellStyle, _SnpRunnerManipulateXMLTags, _SnpRunnerInsertGlyph, _SnpRunnerFindAndReplace, _SnpRunnerSortTable, _SnpRunnerPerformKinsokuTable, _SnpRunnerManipulateTextModel, _SnpRunnerTransformPageItems, _SnpRunnerManipulatePathandGraphics, _SnpRunnerManipulateTextStyle, _SnpRunnerManipulatePrintStyles, _SnpRunnerInspectFontMgr, _SnpRunnerInspectLayoutGrid, _SnpRunnerHyphenation, _SnpRunnerPerformTextAttrKenten, _SnpRunnerPerformNamedGrid, _SnpRunnerManipulateSwatch, _SnpRunnerXMLSampleHelper, _SnpRunnerManipulateTrapStyles, _SnpRunnerProcessDocumentLayerCmds, _SnpRunnerPerformTextAttrLanguage, _SnpRunnerInspectTextStyles, _SnpRunnerCreateFrameGrid, _SnpRunnerManipulateXMLSelection, _SnpRunnerExportBookAsPDF, _SnpRunnerImportExportXML, _SnpRunnerPerformFontGroupIterator, _SnpRunnerInspectSelectionXMLProperties, _SnpRunnerPerformXMPCommands, _SnpRunnerShareAppResources, _SnpRunnerChooseFile, _SnpRunnerPerformTextAttrTateChuYoko, _SnpRunnerShowPalette, _SnpRunnerPrintDocument, _SnpRunnerEstimateTextDepth, _SnpRunnerManipulateAssignment, _SnpRunnerManipulateInline, _SnpRunnerPerformNoteFunction, _SnpRunnerManipulateInCopyCJKGridAttributes, _SnpRunnerPerformTextAttrWarichu, _SnpRunnerCreateFrame, _SnpRunnerManipulateArticles, _SnpRunnerManipulateGraphicAttributes, _SnpRunnerManipulateDisplayPerformance, _SnpRunnerImportExportSnippet, _SnpRunnerInspectPathInfo, _SnpRunnerContentDropper, _SnpRunnerInspectXMPMetaData, _SnpRunnerCreateInddPreview, _SnpRunnerIterTableUseDictHier, _SnpCreateCrossReference, _SnpRunnerAddMediaFile, _SnpRunnerManipulateStructureView, _SnpRunnerInspectTableModel, _SnpRunnerModifyTable, _SnpRunnerCreateCustomAnimation, _SnpRunnerCreateAndManipulateSharedLink, _SnpRunnerManipulateTextOnPath, _SnpRunnerIterTableStories, _SnpRunnerExportDocAsPDF, _SnpRunnerHitTestFrame, _SnpRunnerSelectShape, _SnpRunnerGetTableParcel, _SnpRunnerSetTableFill, _SnpRunnerAccessTableContent, _SnpRunnerPlaceFile, _SnpRunnerCopyPasteTable, _SnpRunnerExportEPub, _SnpCreateQRCode, _SnpRunnerCreateTable, _SnpRunnerTemplate, _SnpRunnerCreateDocument, _SnpHelloCSXS, _SnpHelloBridgeTalk, and _SnpPlugPlug.
| inlinevirtual |
Return a description of what the snippet does.
| inlinevirtual |
Return name of snippet.
| inlinevirtual |
Return dscription of the preconditions necessary for successful execution of the snippet.
| pure virtual |
Run the snippet using the context given by ISnpRunnableContext.
| runnableContext | parameters |
Implemented in _SnpRunnerManipulateTextFrame, _SnpRunnerModifyLayoutGrid, _SnpRunnerInspectTextModel, _SnpRunnerApplyTextStyleAttributes, _SnpRunnerManipulateConditionalText, _SnpRunnerManipulateSpreadsAndPages, _SnpRunnerInspectLayoutModel, _SnpRunnerPerformCompFont, _SnpRunnerPerformTextAttrRuby, _SnpRunnerManipulateTextFootnotes, _SnpRunnerManipulateTextEndnotes, _SnpRunnerManipulateXMLElements, _SnpRunnerManipulateTableAndCellStyle, _SnpRunnerManipulateXMLTags, _SnpRunnerInsertGlyph, _SnpRunnerFindAndReplace, _SnpRunnerSortTable, _SnpRunnerPerformKinsokuTable, _SnpRunnerManipulateTextModel, _SnpRunnerTransformPageItems, _SnpRunnerManipulatePathandGraphics, _SnpRunnerManipulateTextStyle, _SnpRunnerManipulatePrintStyles, _SnpRunnerInspectFontMgr, _SnpRunnerInspectLayoutGrid, _SnpRunnerHyphenation, _SnpRunnerPerformTextAttrKenten, _SnpRunnerPerformNamedGrid, _SnpRunnerManipulateSwatch, _SnpRunnerXMLSampleHelper, _SnpRunnerManipulateTrapStyles, _SnpRunnerProcessDocumentLayerCmds, _SnpRunnerPerformTextAttrLanguage, _SnpRunnerInspectTextStyles, _SnpRunnerCreateFrameGrid, _SnpRunnerManipulateXMLSelection, _SnpRunnerImportExportXML, _SnpRunnerPerformFontGroupIterator, _SnpRunnerExportBookAsPDF, _SnpRunnerInspectSelectionXMLProperties, _SnpRunnerPerformXMPCommands, _SnpRunnerShareAppResources, _SnpRunnerChooseFile, _SnpRunnerPerformTextAttrTateChuYoko, _SnpRunnerShowPalette, _SnpRunnerPrintDocument, _SnpRunnerEstimateTextDepth, _SnpRunnerManipulateInline, _SnpRunnerPerformNoteFunction, _SnpRunnerManipulateAssignment, _SnpRunnerManipulateInCopyCJKGridAttributes, _SnpRunnerPerformTextAttrWarichu, _SnpRunnerCreateFrame, _SnpRunnerManipulateArticles, _SnpRunnerManipulateGraphicAttributes, _SnpRunnerManipulateDisplayPerformance, _SnpRunnerImportExportSnippet, _SnpRunnerInspectXMPMetaData, _SnpRunnerContentDropper, _SnpRunnerInspectPathInfo, _SnpRunnerCreateInddPreview, _SnpRunnerIterTableUseDictHier, _SnpCreateCrossReference, _SnpRunnerAddMediaFile, _SnpRunnerManipulateStructureView, _SnpRunnerInspectTableModel, _SnpRunnerModifyTable, _SnpRunnerCreateCustomAnimation, _SnpRunnerCreateAndManipulateSharedLink, _SnpRunnerIterTableStories, _SnpRunnerManipulateTextOnPath, _SnpRunnerExportDocAsPDF, _SnpRunnerHitTestFrame, _SnpRunnerSelectShape, _SnpRunnerGetTableParcel, _SnpRunnerSetTableFill, _SnpRunnerAccessTableContent, _SnpRunnerPlaceFile, _SnpRunnerCopyPasteTable, _SnpRunnerExportEPub, _SnpCreateQRCode, _SnpRunnerCreateTable, _SnpRunnerTemplate, _SnpRunnerCreateDocument, _SnpHelloCSXS, _SnpHelloBridgeTalk, and _SnpPlugPlug.
| virtual |
default behavior for snippet unit test
| runnableContext | parameters, this is the same context as in the Run method |
Reimplemented in _SnpRunnerCreateFrame, and _SnpRunnerCreateDocument.
| inlineprotectedvirtual |
To be called by sub-classes in their constructor to describe the categories the snippet belongs too as a CSV string of the form "sdk_snippet, sdk_layout".
| categories |
| inlineprotectedvirtual |
To be called by sub-classes in their constructor to describe what the snippet does.
| description |
| inlineprotectedvirtual |
To be called by sub-classes in their constructor to describe the preconditions that must be met before SnpRunnable::CanRun will return kTrue.
| preconditions |
| virtual |
default behavior for snippet setup context
Set up the proper InDesign context for the snippert so that it can be run.
| runnableContext |
Set up the proper InDesign context for the snippert so that it can be run.
| runnableContext |
Reimplemented in _SnpRunnerExportBookAsPDF, and _SnpRunnerExportDocAsPDF.