1/* 2 Copyright (C) 2000-2005 SKYRIX Software AG 3 4 This file is part of SOPE. 5 6 SOPE is free software; you can redistribute it and/or modify it under 7 the terms of the GNU Lesser General Public License as published by the 8 Free Software Foundation; either version 2, or (at your option) any 9 later version. 10 11 SOPE is distributed in the hope that it will be useful, but WITHOUT ANY 12 WARRANTY; without even the implied warranty of MERCHANTABILITY or 13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 14 License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with SOPE; see the file COPYING. If not, write to the 18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 19 02111-1307, USA. 20*/ 21 22#include <NGObjWeb/WOxElemBuilder.h> 23 24/* 25 This builder builds drag&drop elements from the WEExtensions library. 26 Note that there are other builders for WEExtensions elements as well !! 27 28 All tags are mapped into the <var:> namespace (XMLNS_OD_BIND). 29 30 Supported tags: 31 <var:js-drag .../> maps to WEDragContainer 32 <var:js-drop .../> maps to WEDropContainer 33 <var:script-drag/> maps to WEDragScript 34 <var:script-drop/> maps to WEDropScript 35*/ 36 37@interface WExDnDElemBuilder : WOxTagClassElemBuilder 38{ 39} 40 41@end 42 43#include <SaxObjC/XMLNamespaces.h> 44#include "common.h" 45 46@implementation WExDnDElemBuilder 47 48- (Class)classForElement:(id<DOMElement>)_element { 49 NSString *tagName; 50 unsigned tl; 51 unichar c1; 52 53 if (![[_element namespaceURI] isEqualToString:XMLNS_OD_BIND]) 54 return Nil; 55 56 tagName = [_element tagName]; 57 if ((tl = [tagName length]) < 7) 58 return Nil; 59 60 c1 = [tagName characterAtIndex:0]; 61 62 switch (c1) { 63 case 'j': /* starting with 'j' */ 64 if (tl == 7) { 65 if ([tagName hasPrefix:@"js-dr"]) { 66 if ([tagName isEqualToString:@"js-drag"]) 67 return NSClassFromString(@"WEDragContainer"); 68 if ([tagName isEqualToString:@"js-drop"]) 69 return NSClassFromString(@"WEDropContainer"); 70 } 71 } 72 break; 73 74 case 's': /* starting with 's' */ 75 if (tl == 11) { 76 if ([tagName hasPrefix:@"script-"]) { 77 if ([tagName isEqualToString:@"script-drag"]) 78 return NSClassFromString(@"WEDragScript"); 79 if ([tagName isEqualToString:@"script-drop"]) 80 return NSClassFromString(@"WEDropScript"); 81 } 82 } 83 break; 84 } 85 return Nil; 86} 87 88@end /* WExDnDElemBuilder */ 89