1 // Copyright (C) 2002 Dominique Devriese <devriese@kde.org>
3 // This program is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU General Public License
5 // as published by the Free Software Foundation; either version 2
6 // of the License, or (at your option) any later version.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with this program; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
18 #ifndef KIG_OBJECTS_OBJECT_FACTORY_H
19 #define KIG_OBJECTS_OBJECT_FACTORY_H
27 static const ObjectFactory
* instance();
29 // this returns a fixed point. Note that the returned object is
30 // not added to the document..
31 ObjectHolder
* fixedPoint( const Coordinate
& c
) const;
32 ObjectTypeCalcer
* fixedPointCalcer( const Coordinate
& c
) const;
34 // this returns a CursorPointType; this is used during special
35 // constructions (e.g. regular polygons) where the constructor
36 // wants to use the cursor position without actually generating
37 // an object depending on a new point there.
38 ObjectTypeCalcer
* cursorPointCalcer( const Coordinate
& c
) const;
40 // this returns a relative point (to an object). Note that the returned object
41 // is not added to the document..
42 ObjectTypeCalcer
* relativePointCalcer( ObjectCalcer
* o
, const Coordinate
& loc
) const;
44 // this returns a constrained point. Note that the returned object
45 // is not added to the document..
46 ObjectHolder
* constrainedPoint( ObjectCalcer
* curve
, double param
) const;
47 ObjectTypeCalcer
* constrainedPointCalcer( ObjectCalcer
* curve
, double param
) const;
48 // @overload, changes nothing to the semantics, only calcs the param
50 ObjectTypeCalcer
* constrainedPointCalcer(
51 ObjectCalcer
* curve
, const Coordinate
& c
, const KigDocument
& ) const;
52 ObjectHolder
* constrainedPoint(
53 ObjectCalcer
* curve
, const Coordinate
& c
, const KigDocument
& ) const;
55 // this returns a "sensible point".
56 // By a "sensible point", I mean a point that would be about what
57 // the user expects when he asks for a point at point c. This is a
58 // constrained point if c is on a curve, and otherwise a fixed
59 // point. I might add the possibility for an intersection point
60 // sometime.. Note that the returned object is not added to
62 ObjectTypeCalcer
* sensiblePointCalcer(
63 const Coordinate
& c
, const KigDocument
& d
, const KigWidget
& w
) const;
64 ObjectHolder
* sensiblePoint(
65 const Coordinate
& c
, const KigDocument
& d
, const KigWidget
& w
) const;
67 // set point to what sensiblePoint would have returned..
68 void redefinePoint( ObjectTypeCalcer
* point
, const Coordinate
& c
,
69 KigDocument
& d
, const KigWidget
& w
) const;
71 // return a locus, defined by the two points ( one constrained, and
72 // one following ) a and b. a should be the constrained point, and
73 // thus, it has to be of type ObjectTypeCalcer where a->type() is of
74 // type ConstrainedPointType. The semantics of LocusType are a bit
75 // weird ( but I believe correct :) ), so this function takes care
76 // of the complication there..
77 ObjectTypeCalcer
* locusCalcer( ObjectCalcer
* a
, ObjectCalcer
* b
) const;
78 ObjectHolder
* locus( ObjectCalcer
* a
, ObjectCalcer
* b
) const;
80 // returns a label with text s at point c.. It ( and its parents )
81 // is calced already...
83 const QString
& s
, const Coordinate
& loc
,
84 bool needframe
, const std::vector
<ObjectCalcer
*>& parents
,
85 const KigDocument
& doc
) const;
86 ObjectTypeCalcer
* labelCalcer(
87 const QString
& s
, const Coordinate
& loc
,
88 bool needframe
, const std::vector
<ObjectCalcer
*>& parents
,
89 const KigDocument
& doc
) const;
91 // this one does the same as the above, only that the new label is
92 // attached to locationparent if it is non-null..
93 ObjectTypeCalcer
* attachedLabelCalcer(
94 const QString
& s
, ObjectCalcer
* locationparent
,
95 const Coordinate
& loc
, bool needframe
,
96 const std::vector
<ObjectCalcer
*>& parents
,
97 const KigDocument
& doc
) const;
98 ObjectHolder
* attachedLabel(
99 const QString
& s
, ObjectCalcer
* locationparent
,
100 const Coordinate
& loc
, bool needframe
,
101 const std::vector
<ObjectCalcer
*>& parents
,
102 const KigDocument
& doc
) const;
104 // returns a property object for the property p of object o. NOTE
105 // that o should have already been calc'd, or this will fail and
106 // return 0.. The returned object also needs to be calced after
108 ObjectPropertyCalcer
* propertyObjectCalcer( ObjectCalcer
* o
, const char* p
) const;
109 ObjectHolder
* propertyObject( ObjectCalcer
* o
, const char* p
) const;