• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

xap_CocoaPlugin.h

Go to the documentation of this file.
00001 /* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */
00002 
00003 /* AbiSource Application Framework
00004  * Copyright (C) 2004-2005 Francis James Franklin
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00019  * 02110-1301 USA.
00020  */
00021 
00022 #ifndef XAP_COCOAPLUGIN_H
00023 #define XAP_COCOAPLUGIN_H
00024 
00025 #define XAP_COCOAPLUGIN_INTERFACE 20050925 
00027 #import <Cocoa/Cocoa.h>
00028 
00029 #import "xap_CocoaCompat.h"
00030 
00031 @class XAP_CocoaPlugin;
00032 
00033 @protocol XAP_CocoaPlugin_Tool;
00034 @protocol XAP_CocoaPlugin_ToolProvider;
00035 
00043 @protocol XAP_CocoaPlugin_ToolInstance
00044 
00051 - (id <NSObject, XAP_CocoaPlugin_Tool>)tool;
00052 
00059 - (NSView *)toolbarButton;
00060 
00067 - (NSMenuItem *)toolbarMenuItem;
00068 
00075 - (NSString *)configWidth;
00076 
00083 - (NSString *)configHeight;
00084 
00091 - (NSString *)configImage;
00092 
00099 - (NSString *)configAltImage;
00100 
00106 - (void)setConfigWidth:(NSString *)width;
00107 
00113 - (void)setConfigHeight:(NSString *)height;
00114 
00121 - (void)setConfigImage:(NSString *)image;
00122 
00129 - (void)setConfigAltImage:(NSString *)altImage;
00130 @end
00131 
00139 @protocol XAP_CocoaPlugin_Tool
00140 
00146 - (NSString *)identifier;
00147 
00153 - (NSString *)description;
00154 
00161 - (void)setProvider:(id <NSObject, XAP_CocoaPlugin_ToolProvider>)provider;
00162 
00168 - (id <NSObject, XAP_CocoaPlugin_ToolProvider>)provider;
00169 
00176 - (id <NSObject, XAP_CocoaPlugin_ToolInstance>)tool;
00177 @end
00178 
00185 @protocol XAP_CocoaPlugin_ToolProvider
00186 
00192 - (NSString *)name;
00193 
00201 - (id <NSObject, XAP_CocoaPlugin_Tool>)toolWithIdentifier:(NSString *)identifier;
00202 
00208 - (NSArray *)toolIdentifiers;
00209 
00217 - (NSString *)toolDescription:(NSString *)identifier;
00218 
00219 @end
00220 
00226 @protocol XAP_CocoaPlugin_SimpleXML
00227 
00236 - (BOOL)startElement:(NSString *)name attributes:(NSDictionary *)attributes;
00237 
00245 - (BOOL)endElement:(NSString *)name;
00246 
00254 - (BOOL)characterData:(NSString *)data;
00255 
00256 @end
00257 
00263 @protocol XAP_CocoaPlugin_MenuItem
00264 
00268 - (void)setLabel:(NSString *)label;
00269 
00273 - (NSString *)label;
00274 
00275 #if 0 // YAGNI
00276 
00280 - (void)setAction:(SEL)aSelector;
00281 
00285 - (SEL)action;
00286 
00291 - (void)setTarget:(id <NSObject>)target;
00292 
00296 - (id <NSObject>)target;
00297 #endif
00298 
00302 - (void)setTag:(NSInteger)anInt;
00303 
00307 - (NSInteger)tag;
00308 
00313 - (void)setState:(int)state;
00314 
00318 - (int)state;
00319 
00324 - (void)setEnabled:(BOOL)enabled;
00325 
00329 - (BOOL)isEnabled;
00330 
00331 @end
00332 
00339 @protocol XAP_CocoaPlugin_FramelessDocument
00340 
00351 - (BOOL)exportDocumentToFile:(NSString *)path exportOptions:(NSDictionary *)options;
00352 
00353 @end
00354 
00368 @protocol XAP_CocoaPlugin_Document
00369 
00376 - (BOOL)documentStillExists;
00377 
00382 - (NSString *)title;
00383 
00389 - (NSString *)selectWord;
00390 
00396 - (NSString *)selectedText;
00397 
00403 - (void)insertText:(NSString *)text;
00404 
00405 /* Mail Merge interface
00406  */
00407 - (NSString *)documentMailMergeSource; // may return nil
00408 - (void)setDocumentMailMergeSource:(NSString *)path;
00409 
00410 - (void)insertDocumentMailMergeField:(NSString *)field_name;
00411 
00412 - (NSArray *)documentMailMergeFields;
00413 - (void)setDocumentMailMergeFields:(NSArray *)field_array;
00414 - (void)unsetDocumentMailMergeFields;
00415 
00416 /* value_dictionary maps (NSString *) keys [field names] to (NSString *) values.
00417  */
00418 - (void)setDocumentMailMergeValues:(NSDictionary *)value_dictionary;
00419 
00420 @end
00421 
00430 @protocol XAP_CocoaPluginDelegate
00431 
00449 - (BOOL)pluginCanRegisterForAbiWord:(XAP_CocoaPlugin *)AbiWord version:(NSString *)version interface:(unsigned long)interface;
00450 
00456 - (BOOL)pluginIsActive;
00457 
00461 - (void)pluginActivate;   /* Add menuitems etc. */
00462 
00466 - (void)pluginDeactivate; /* Remove them...     */
00467 
00475 - (BOOL)pluginCanDeactivate;
00476 
00481 - (void)pluginCurrentDocumentHasChanged;
00482 
00488 - (NSString *)pluginName;
00489 
00495 - (NSString *)pluginAuthor;
00496 
00502 - (NSString *)pluginVersion;
00503 
00509 - (NSString *)pluginDescription;
00510 
00516 - (NSString *)pluginUsage;
00517 
00518 @end
00519 
00525 @interface XAP_CocoaPlugin : NSObject
00526 {
00527     id <NSObject, XAP_CocoaPluginDelegate>  m_delegate; 
00528 }
00529 
00533 - (id)init;
00534 
00538 - (void)dealloc;
00539 
00549 - (BOOL)loadBundleWithPath:(NSString *)path;
00550 
00560 - (void)setDelegate:(id <NSObject, XAP_CocoaPluginDelegate>)delegate;
00561 
00568 - (id <NSObject, XAP_CocoaPluginDelegate>)delegate;
00569 
00580 - (void)appendMenuItem:(NSMenuItem *)menuItem;
00581 
00587 - (void)removeMenuItem:(NSMenuItem *)menuItem;
00588 
00600 - (id <NSObject, XAP_CocoaPlugin_Document>)currentDocument; // may return nil;
00601 
00613 - (NSArray *)documents;                                     // array of id <NSObject, XAP_CocoaPlugin_Document>
00614 
00620 - (NSString *)selectMailMergeSource; // may return nil
00621 
00630 - (NSMutableArray *)importMailMergeSource:(NSString *)path;
00631 
00644 - (id <NSObject, XAP_CocoaPlugin_FramelessDocument>)importDocumentFromFile:(NSString *)path importOptions:(NSDictionary *)options;
00645 
00657 - (id <NSObject, XAP_CocoaPlugin_MenuItem>)contextMenuItemWithLabel:(NSString *)label;
00658 
00665 - (NSArray *)toolProviders;
00666 
00676 - (id <NSObject, XAP_CocoaPlugin_ToolProvider>)toolProvider:(NSString *)name;
00677 
00687 - (NSString *)findResourcePath:(NSString *)relativePath;
00688 
00696 - (NSString *)userResourcePath:(NSString *)relativePath;
00697 
00706 - (NSString *)parseFile:(NSString *)path simpleXML:(id <XAP_CocoaPlugin_SimpleXML>)callback;
00707 
00708 @end
00709 
00710 #endif /* XAP_COCOAPLUGIN_H */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1