# 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 re

import opendocument
import opendocument.core as core
import opendocument.svg as svg
import opendocument.text as text
od = opendocument
AI = opendocument.AttributeInfo
draw_base = opendocument.bases.draw

class Drawing(opendocument.Document):
   def __init__(self, undoStack, parent = None):
      opendocument.Document.__init__(self, undoStack, parent)

class Page(draw_base.Page):
   __metaclass__ = od.MixinMeta
   overrides = {'draw:name': AI(default="page")}
   #childTypes = [draw_base.Frame, draw_base.Image, draw_base.Object, core.Forms]

class ContentMixin:
   __metaclass__ = od.MixinMeta
   default_length = ('0', 'in')
   overrides = {'svg:x': AI(default=default_length),
                'svg:y': AI(default=default_length),
                'svg:width': AI(default=default_length),
                'svg:height': AI(default=default_length),
                'draw:layer': AI(),
                'draw:style-name': AI()}

class TextBox(draw_base.TextBox):
   __metaclass__ = od.OpenDocumentMeta
   default = (None, None)
   overrides = {'fo:min-height': AI(od.getUnitsOrPercentage, od.setUnitsOrPercentage, default),
                'fo:max-height': AI(od.getUnitsOrPercentage, od.setUnitsOrPercentage, default),
                'fo:min-width': AI(od.getUnitsOrPercentage, od.setUnitsOrPercentage, default),
                'fo:max-width': AI(od.getUnitsOrPercentage, od.setUnitsOrPercentage, default)}
   #childTypes = [text.List, text.Paragraph])

   def __init__(self, attrs):
      draw_base.TextBox.__init__(self, attrs)
