This class provides the main interface between the plug-in and AbiWord. More...
#import <xap_CocoaPlugin.h>
Public Member Functions | |
(id) | - init |
The plug-in's delegate, by default the bundle's principal class. | |
(void) | - dealloc |
(For internal use only. | |
(BOOL) | - loadBundleWithPath: |
(For internal use only. | |
(void) | - setDelegate: |
If the plug-in bundle's principal class does not implement the XAP_CocoaPluginDelegate protocol, then, when the pluginCanRegisterForAbiWord:version:interface: method is called, it should set a new delegate object which does implement the protocol. | |
(id< NSObject, XAP_CocoaPluginDelegate >) | - delegate |
The plug-in's delegate. | |
(void) | - appendMenuItem: |
Add a menu item to the end of the Tools menu. | |
(void) | - removeMenuItem: |
Remove a menu item from the end of the Tools menu. | |
(id< NSObject, XAP_CocoaPlugin_Document >) | - currentDocument |
Get a reference to the current document window, if any. | |
(NSArray *) | - documents |
Get an array of references to the current document windows, if any. | |
(NSString *) | - selectMailMergeSource |
Pops up a File Open dialog for the user to select a source file for mail merge. | |
(NSMutableArray *) | - importMailMergeSource: |
Loads a mail merge source file and builds an array of arrays containing the fields. | |
(id< NSObject, XAP_CocoaPlugin_FramelessDocument >) | - importDocumentFromFile:importOptions: |
Open the specified document without creating a document window. | |
(id< NSObject, XAP_CocoaPlugin_MenuItem >) | - contextMenuItemWithLabel: |
Add a menu item to the context menu. | |
(NSArray *) | - toolProviders |
Get a list of all the tool providers. | |
(id< NSObject, XAP_CocoaPlugin_ToolProvider >) | - toolProvider: |
Find a tool provider by name. | |
(NSString *) | - findResourcePath: |
Find a file in one of AbiWord's resource locations. | |
(NSString *) | - userResourcePath: |
Generate a path in the user's AbiSuite resource location. | |
(NSString *) | - parseFile:simpleXML: |
Parse an XML file using a simple XML call-back interface. | |
Protected Attributes | |
id< NSObject, XAP_CocoaPluginDelegate > | m_delegate |
This class provides the main interface between the plug-in and AbiWord.
- (void) appendMenuItem: | (NSMenuItem *) | menuItem |
Add a menu item to the end of the Tools menu.
This is an NSMenuItem object that the plug-in makes itself (or loads from a nib file) and so can have submenus etc. This procedure for adding menu items to AbiWord's main menu does not use AbiWord's cross-platform method for adding menu items (which may not currently work anyway - I'm not sure).
menuItem | The menu item to add to the Tools menu. |
References XAP_CocoaAppController::appendPluginMenuItem:.
- (id< NSObject, XAP_CocoaPlugin_MenuItem >) contextMenuItemWithLabel: | (NSString *) | label |
Add a menu item to the context menu.
You should retain the returned context menu item object, since the menu item is removed from the context menu when the object is deleted.
label | The label of the menu item in the context menu. |
References AP_CocoaPlugin_ContextMenuItem::itemWithLabel:.
- (id< NSObject, XAP_CocoaPlugin_Document >) currentDocument |
Get a reference to the current document window, if any.
Please bear in mind that documents can be closed, so be careful when keeping references to documents lying around for future use.
Note: These are really references to document windows, and sometimes the actual documents can change even though the document window is the same.
References AP_CocoaPlugin_Document::currentDocument.
- (void) dealloc |
(For internal use only.
)
- (id< NSObject, XAP_CocoaPluginDelegate >) delegate |
The plug-in's delegate.
References m_delegate.
Referenced by XAP_CocoaAppController::deactivateAllPlugins, XAP_CocoaAppController::deactivatePlugin:overridePlugin:, XAP_CocoaPluginReference::initWithPlugin:, and XAP_CocoaAppController::notifyFrameViewChange.
- (NSArray *) documents |
Get an array of references to the current document windows, if any.
Please bear in mind that documents can be closed, so be careful when keeping references to documents lying around for future use.
Note: These are really references to document windows, and sometimes the actual documents can change even though the document window is the same.
References AP_CocoaPlugin_Document::documents.
- (NSString *) findResourcePath: | (NSString *) | relativePath |
Find a file in one of AbiWord's resource locations.
This looks in the user's AbiSuite folder first, then the system AbiSuite folder, and finally the AbiWord bundle's Resources folder. Must be a regular file.
relativePath | A filename or relative path, e.g., "MyPlugin/config.xml". |
References XAP_CocoaApp::findAbiSuiteLibFile(), and XAP_App::getApp().
- (id< NSObject, XAP_CocoaPlugin_FramelessDocument >) importDocumentFromFile: | (NSString *) | path | ||
importOptions: | (NSDictionary *) | options | ||
Open the specified document without creating a document window.
This can be useful for automated document processing (printing, conversion, etc.).
path | The input file path. | |
options | A dictionary mapping of NSString keys to NSString values; these options are passed to the importer. May be nil. |
References AP_CocoaPlugin_FramelessDocument::documentFromFile:importOptions:.
- (NSMutableArray *) importMailMergeSource: | (NSString *) | path |
Loads a mail merge source file and builds an array of arrays containing the fields.
path | The file name of the mail merge source file. |
References AP_CocoaPlugin_Document::importMailMergeSource:.
- (id) init |
The plug-in's delegate, by default the bundle's principal class.
(For internal use only.)
References m_delegate.
Referenced by loadBundleWithPath:.
- (BOOL) loadBundleWithPath: | (NSString *) | path |
(For internal use only.
)
.Abi plug-ins are bundles; loadBundle attempts to load the bundle specified to initWithPath, returns NO if the bundle is already loaded (to avoid duplication) or if it can't be loaded. The plug-in's principal class is initialized with init and is set as the delegate, and must conform therefore to the XAP_CocoaPluginDelegate protocol (or set a new delegate when pluginCanRegisterForAbiWord:version:interface: is called).
References BOOL(), init, instance, and setDelegate:.
- (NSString *) parseFile: | (NSString *) | path | ||
simpleXML: | (id <XAP_CocoaPlugin_SimpleXML>) | callback | ||
Parse an XML file using a simple XML call-back interface.
path | The path to the XML file. | |
callback | An object which implements the XAP_CocoaPlugin_SimpleXML protocol. |
References abicollab::service::error(), and s_SimpleXML_Listener::parse().
- (void) removeMenuItem: | (NSMenuItem *) | menuItem |
Remove a menu item from the end of the Tools menu.
menuItem | The menu item to remove from the Tools menu. |
References XAP_CocoaAppController::removePluginMenuItem:.
- (NSString *) selectMailMergeSource |
Pops up a File Open dialog for the user to select a source file for mail merge.
References AP_CocoaPlugin_Document::selectMailMergeSource.
- (void) setDelegate: | (id <NSObject, XAP_CocoaPluginDelegate>) | delegate |
If the plug-in bundle's principal class does not implement the XAP_CocoaPluginDelegate protocol, then, when the pluginCanRegisterForAbiWord:version:interface: method is called, it should set a new delegate object which does implement the protocol.
delegate | The new delegate (must not be nil). The delegate is not retained. |
References m_delegate.
Referenced by loadBundleWithPath:.
- (id< NSObject, XAP_CocoaPlugin_ToolProvider >) toolProvider: | (NSString *) | name |
Find a tool provider by name.
(TODO: If plug-ins are registering tool providers, we need to implement a notification system to update toolbar systems.)
name | The name of the tool provider to find. |
References XAP_CocoaAppController::toolProvider:.
- (NSArray *) toolProviders |
Get a list of all the tool providers.
Each tool provider is of type id <NSObject, XAP_CocoaPlugin_ToolProvider>.
References XAP_CocoaAppController::toolProviders.
- (NSString *) userResourcePath: | (NSString *) | relativePath |
Generate a path in the user's AbiSuite resource location.
relativePath | A filename or relative path, e.g., "MyPlugin/config.xml". |
References XAP_App::getApp().
- (id<NSObject, XAP_CocoaPluginDelegate>) m_delegate [protected] |
Referenced by delegate, init, and setDelegate:.