6
6
This file is part of the extensible drawing editor Ipe.
7
Copyright (C) 1993-2007 Otfried Cheong
7
Copyright (C) 1993-2009 Otfried Cheong
9
9
Ipe is free software; you can redistribute it and/or modify it
10
10
under the terms of the GNU General Public License as published by
11
the Free Software Foundation; either version 2 of the License, or
11
the Free Software Foundation; either version 3 of the License, or
12
12
(at your option) any later version.
14
14
As a special exception, you have permission to link Ipe with the
31
31
#include "ipefactory.h"
32
32
#include "ipepath.h"
34
33
#include "ipetext.h"
35
34
#include "ipeimage.h"
35
#include "ipereference.h"
38
37
// --------------------------------------------------------------------
40
/*! \class IpeObjectFactory
41
/*! \class ipe::ObjectFactory
42
43
\brief Factory for Ipe leaf objects.
45
46
//! Create an Ipe object by calling the right constructor.
46
IpeObject *IpeObjectFactory::CreateObject(IpeRepository *rep,
48
const IpeXmlAttributes &attr,
47
Object *ObjectFactory::createObject(String name, const XmlAttributes &attr,
51
50
if (name == "path")
52
return new IpePath(rep, attr, data);
53
else if (name == "mark")
54
return new IpeMark(rep, attr, data);
51
return Path::create(attr, data);
55
52
else if (name == "text")
56
return new IpeText(rep, attr, data);
53
return new Text(attr, data);
57
54
else if (name == "image")
58
return new IpeImage(rep, attr, data);
59
else if (name == "ref")
60
return new IpeReference(rep, attr, data);
55
return new Image(attr, data);
56
else if (name == "use")
57
return new Reference(attr, data);
65
//! Create an IpeImage with a given bitmap.
66
IpeObject *IpeObjectFactory::CreateImage(IpeRepository *rep,
68
const IpeXmlAttributes &attr,
62
//! Create an Image with a given bitmap.
63
Object *ObjectFactory::createImage(String /*name*/, const XmlAttributes &attr,
71
return new IpeImage(rep, attr, bitmap);
66
return new Image(attr, bitmap);
74
69
// --------------------------------------------------------------------