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 #include "object_type.h"
20 #include "bogus_imp.h"
21 #include "object_type_factory.h"
23 #include "../misc/coordinate.h"
25 #include <qstringlist.h>
29 const char* ObjectType::fullName() const
34 ObjectType::~ObjectType()
38 ObjectType::ObjectType( const char fulltypename
[] )
39 : mfulltypename( fulltypename
)
41 ObjectTypeFactory::instance()->add( this );
44 bool ObjectType::canMove( const ObjectTypeCalcer
& ) const
49 bool ObjectType::isFreelyTranslatable( const ObjectTypeCalcer
& ) const
54 void ObjectType::move( ObjectTypeCalcer
&, const Coordinate
&, const KigDocument
& ) const
56 // we can't do an assert here, because sometimes ( like in
57 // ObjectABType::move, ObjectType::move is called without checking
58 // the object's canMove().
62 bool ObjectType::inherits( int ) const
67 ArgsParserObjectType::ArgsParserObjectType( const char fulltypename
[],
68 const struct ArgsParser::spec argsspec
[],
70 : ObjectType( fulltypename
), margsparser( argsspec
, n
)
74 const ObjectImpType
* ArgsParserObjectType::impRequirement( const ObjectImp
* o
, const Args
& parents
) const
76 return margsparser
.impRequirement( o
, parents
);
79 const ArgsParser
& ArgsParserObjectType::argsParser() const
84 bool ObjectType::isTransform() const
89 QStringList
ObjectType::specialActions() const
94 void ObjectType::executeAction( int, ObjectHolder
&, ObjectTypeCalcer
&, KigPart
&, KigWidget
&,
100 const Coordinate
ObjectType::moveReferencePoint( const ObjectTypeCalcer
& ) const
103 return Coordinate::invalidCoord();
106 std::vector
<ObjectCalcer
*> ArgsParserObjectType::sortArgs( const std::vector
<ObjectCalcer
*>& args
) const
108 return margsparser
.parse( args
);
111 Args
ArgsParserObjectType::sortArgs( const Args
& args
) const
113 return margsparser
.parse( args
);
116 std::vector
<ObjectCalcer
*> ObjectType::movableParents( const ObjectTypeCalcer
& ) const
118 return std::vector
<ObjectCalcer
*>();
121 bool ArgsParserObjectType::isDefinedOnOrThrough( const ObjectImp
* o
, const Args
& parents
) const
123 return margsparser
.isDefinedOnOrThrough( o
, parents
);