# vPresent is an immersive presentation creation and display application.
# Copyright (C) 2007-2008 by Infiscape Corporation
#
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

import opendocument
import opendocument.core as core
import opendocument.drawing as draw
import opendocument.config as config
import opendocument.form as form
import opendocument.style as style
od = opendocument
AI = opendocument.AttributeInfo
office_base = opendocument.bases.office

class DocumentStyles(office_base.DocumentStyles):
   #childTypes = [FontFaceDecls, Styles, AutomaticStyles, MasterStyles]
   def __init__(self, attrs):
      office_base.DocumentStyles.__init__(self, attrs)

class MetaMixin:
   __metaclass__ = od.MixinMeta
   childTypes = ['meta:generator', 'dc:title', 'dc:description', 'dc:subject',
                 'meta:keyword', 'meta:initial-creator', 'dc:creator', 'meta:printed-by',
                 'meta:creation-date', 'dc:date', 'meta:print-date', 'meta:template',
                 'meta:auto-reload', 'meta:hyperlink-behaviour', 'dc:language',
                 'meta:editing-cycles', 'meta:editing-duration', 'meta:document-statistic',
                 'meta:user-defined', 'PlainText']

class Meta(MetaMixin, office_base.Meta):
   __metaclass__ = od.OpenDocumentMeta
   def __init__(self, attrs):
      office_base.Meta.__init__(self, attrs)

class DocumentMeta(MetaMixin, office_base.DocumentMeta):
   __metaclass__ = od.OpenDocumentMeta
   def __init__(self, attrs):
      office_base.DocumentMeta.__init__(self, attrs)

class Settings(office_base.Settings):
   #[config.ItemSet])
   def __init__(self, attrs):
      office_base.Settings.__init__(self, attrs)

class EventListeners(office_base.EventListeners):
   #[core.EventListener])
   def __init__(self, attrs):
      office_base.EventListeners.__init__(self, attrs)

#class Forms(core.Forms):
class Forms(office_base.Forms):
   __metaclass__ = od.OpenDocumentMeta
   overrides = {'form:automatic-focus': AI(od.getBoolean, od.setBoolean, 'false',
                'Indicates whether the form should receive UI focus automatically.'),
                'form:apply-design-mode': AI(od.getBoolean, od.setBoolean, 'true',
                'Indicates whether the application should present a form in a fill-out mode (False) or in an editable mode (True).')}
   #childTypes = [form.Form,]

   def __init__(self, attrs):
      office_base.Forms.__init__(self, attrs)

class FontFaceDecls(office_base.FontFaceDecls):
   #childTypes = [style.FontFace]
   def __init__(self, attrs):
      office_base.FonFacetDecls.__init__(self, attrs)

class Styles(office_base.Styles):
   __metaclass__ = od.OpenDocumentMeta
   childTypes = ['style:default-style', 'style:style', 'draw:marker']
   def __init__(self, attrs):
      office_base.Styles.__init__(self, attrs)

class AutomaticStyles(office_base.AutomaticStyles):
   #childTypes = [style.Style])
   def __init__(self, attrs):
      office_base.AutomaticStyles.__init__(self, attrs)

class MasterStyles(office_base.MasterStyles):
   #childTypes = [od.bases.draw.LayerSet, style.HandoutMaster, style.MasterPage]
   def __init__(self, attrs):
      office_base.MasterStyles.__init__(self, attrs)
