/* -*- mode: C++; tab-width: 4; c-basic-offset: 4; -*- */ /* AbiSource Application Framework * Copyright (C) 2004 Francis James Franklin * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #import "AbiSite.h" #import "AbiSite_Controller.h" @implementation AbiSite - (id)init { if (self = [super init]) { m_AbiWord = 0; m_Controller = 0; } return self; } - (void)dealloc { if (m_Controller) { [m_Controller release]; m_Controller = 0; } [super dealloc]; } - (XAP_CocoaPlugin *)AbiWord { return m_AbiWord; } /* Bundle plugins must implement this, which will be called immediately after initialization */ - (BOOL)pluginCanRegisterForAbiWord:(XAP_CocoaPlugin *)AbiWord version:(NSString *)version interface:(unsigned long)interface { m_AbiWord = AbiWord; return YES; } /* All plugins should implement the following methods: */ - (BOOL)pluginIsActive { return (m_Controller != 0); } - (void)pluginActivate /* Add menuitems etc. */ { if (m_Controller) return; if (m_Controller = [[AbiSite_Controller alloc] initWithAbiWord:m_AbiWord]) { [m_Controller window]; } } - (void)pluginDeactivate /* Remove them... */ { if (!m_Controller) return; [m_Controller close]; [m_Controller release]; m_Controller = 0; } /* Plugin should attempt to save all files, and return NO *only* if the user has answered * "Cancel" to an alert about an unsaved document. */ - (BOOL)pluginCanDeactivate { if (!m_Controller) return YES; return [m_Controller pluginCanDeactivate]; } /* AbiWord will call this if the focus changes to a different document, or different window * or panel, or if the current document is closed. */ - (void)pluginCurrentDocumentHasChanged { // (don't care?) } - (NSString *)pluginName { return @"AbiSite: Site Manager"; } - (NSString *)pluginAuthor { return @"Francis James Franklin"; } - (NSString *)pluginVersion { return @"0.1 / 2005/01/22"; } - (NSString *)pluginDescription { return @"Simple web-site creation and management tool for AbiWord."; } - (NSString *)pluginUsage { return @"Create a new site, or open an existing site, using the Tools->Site Manager menu."; } @end