Release 0.41.92
[vala-gnome.git] / libvaladoc / content / contentfactory.vala
blobfc14fe4793fedeea107c7e57862a6f2addd08f46
1 /* contentfactory.vala
3 * Copyright (C) 2008-2009 Didier Villevalois
4 * Copyright (C) 2008-2012 Florian Brosch
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * Author:
21 * Didier 'Ptitjes Villevalois <ptitjes@free.fr>
25 public class Valadoc.Content.ContentFactory : Object {
27 public ContentFactory (Settings settings, ResourceLocator locator, ModuleLoader modules) {
28 _settings = settings;
29 _locator = locator;
30 _modules = modules;
33 private Settings _settings;
34 private ResourceLocator _locator;
35 private ModuleLoader _modules;
37 private inline ContentElement configure (ContentElement element) {
38 element.configure (_settings, _locator);
39 return element;
42 public Comment create_comment () {
43 return (Comment) configure (new Comment ());
46 public Embedded create_embedded () {
47 return (Embedded) configure (new Embedded ());
50 public Headline create_headline () {
51 return (Headline) configure (new Headline ());
54 public Link create_link () {
55 return (Link) configure (new Link ());
58 public WikiLink create_wiki_link () {
59 return (WikiLink) configure (new WikiLink ());
62 public List create_list () {
63 return (List) configure (new List ());
66 public ListItem create_list_item () {
67 return (ListItem) configure (new ListItem ());
70 public Page create_page () {
71 return (Page) configure (new Page ());
74 public Paragraph create_paragraph () {
75 return (Paragraph) configure (new Paragraph ());
78 public Warning create_warning () {
79 return (Warning) configure (new Warning ());
81 public Note create_note () {
82 return (Note) configure (new Note ());
85 public Run create_run (Run.Style style) {
86 return (Run) configure (new Run (style));
89 public SourceCode create_source_code () {
90 return (SourceCode) configure (new SourceCode ());
93 public Table create_table () {
94 return (Table) configure (new Table ());
97 public TableCell create_table_cell () {
98 return (TableCell) configure (new TableCell ());
101 public TableRow create_table_row () {
102 return (TableRow) configure (new TableRow ());
105 public Taglet? create_taglet (string name) {
106 return _modules.create_taglet (name);
109 public Text create_text (string? text = null) {
110 return (Text) configure (new Text (text));
113 public ContentElement set_style_attributes (StyleAttributes element,
114 VerticalAlign? valign,
115 HorizontalAlign? halign,
116 string? style) {
117 element.vertical_align = valign;
118 element.horizontal_align = halign;
119 element.style = style;
120 return element;