2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
6 OGo 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
11 OGo 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.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include <NGObjDOM/ODNodeRendererFactory.h>
24 #include <NGObjDOM/ODRNodeText.h>
25 #include <NGObjDOM/ODRGenericTag.h>
28 @implementation ODNodeRendererFactory
34 - (ODNodeRenderer *)rendererForTextNode:(id)_domNode
35 inContext:(WOContext *)_ctx
38 if (r == nil) r = [[ODRNodeText alloc] init];
42 - (ODNodeRenderer *)rendererForElementNode:(id)_domNode
43 inContext:(WOContext *)_ctx
46 if (r == nil) r = [[ODRGenericTag alloc] init];
50 - (ODNodeRenderer *)rendererForDocumentNode:(id)_domNode
51 inContext:(WOContext *)_ctx
54 if (r == nil) r = [[ODNodeRenderer alloc] init];
57 - (ODNodeRenderer *)rendererForDocumentFragmentNode:(id)_domNode
58 inContext:(WOContext *)_ctx
61 if (r == nil) r = [[ODNodeRenderer alloc] init];
65 - (ODNodeRenderer *)rendererForNode:(id)_domNode
66 inContext:(WOContext *)_ctx
68 ODNodeRenderer *renderer;
70 switch ([_domNode nodeType]) {
72 case DOM_CDATA_SECTION_NODE:
73 renderer = [self rendererForTextNode:_domNode inContext:_ctx];
76 case DOM_ELEMENT_NODE:
77 renderer = [self rendererForElementNode:_domNode inContext:_ctx];
80 case DOM_DOCUMENT_NODE:
81 renderer = [self rendererForDocumentNode:_domNode inContext:_ctx];
84 case DOM_DOCUMENT_FRAGMENT_NODE:
86 [self rendererForDocumentFragmentNode:_domNode inContext:_ctx];
96 @end /* ODNodeRendererFactory */