28using namespace Libppt;
33 enum { InvalidType, IntType, DoubleType, StringType, BoolType, ColorType } type;
60 std::map<std::string,PropertyValue> properties;
71 d->background =
false;
84void Object::setId(
int id )
89double Object::top()
const
94double Object::left()
const
99double Object::width()
const
104double Object::height()
const
109void Object::setTop(
double top )
114void Object::setLeft(
double left )
119void Object::setWidth(
double width )
124void Object::setHeight(
double height)
129bool Object::isBackground()
const
131 return d->background;
134void Object::setBackground(
bool bg )
139bool Object::hasProperty( std::string name )
141 std::map<std::string,PropertyValue>::const_iterator i;
142 i = d->properties.find( name );
143 if( i == d->properties.end() )
149void Object::setProperty( std::string name, std::string value )
152 pv.type = PropertyValue::StringType;
154 d->properties[ name ] = pv;
157void Object::setProperty( std::string name,
int value )
160 pv.type = PropertyValue::IntType;
162 d->properties[ name ] = pv;
165void Object::setProperty( std::string name,
double value )
168 pv.type = PropertyValue::DoubleType;
170 d->properties[ name ] = pv;
173void Object::setProperty( std::string name,
bool value )
176 pv.type = PropertyValue::BoolType;
178 d->properties[ name ] = pv;
181void Object::setProperty( std::string name, Color value )
184 pv.type = PropertyValue::ColorType;
186 d->properties[ name ] = pv;
189int Object::getIntProperty( std::string name )
192 pv = d->properties[ name ];
193 if( pv.type == PropertyValue::IntType )
199double Object::getDoubleProperty( std::string name )
202 pv = d->properties[ name ];
203 if( pv.type == PropertyValue::DoubleType )
209bool Object::getBoolProperty( std::string name )
212 pv = d->properties[ name ];
213 if( pv.type == PropertyValue::BoolType )
220std::string Object::getStrProperty( std::string name )
223 pv = d->properties[ name ];
224 if( pv.type == PropertyValue::StringType )
230Color Object::getColorProperty(std::string name)
233 pv = d->properties[ name ];
234 if( pv.type == PropertyValue::ColorType )
237 return Color(153,204,255);
241class TextObject::Private
245 std::vector<UString> text;
247 std::vector<bool> bulletFlag;
250TextObject::TextObject(): Object()
255TextObject::~TextObject()
260unsigned TextObject::type()
const
265unsigned TextObject::listSize()
const
267 return d->text.size();
270const char* TextObject::typeAsString()
const
274 case Title :
return "Title";
275 case Body :
return "Body";
276 case Notes :
return "Notes";
277 case NotUsed :
return "NotUsed";
278 case Other :
return "Other";
279 case CenterBody :
return "CenterBody";
280 case CenterTitle :
return "CenterTitle";
281 case HalfBody :
return "HalfBody";
282 case QuarterBody :
return "QuarterBody";
289bool TextObject::bulletFlag(
unsigned index )
const
291 return d->bulletFlag[index];
294void TextObject::setBulletFlag(
bool flag )
296 d->bulletFlag.push_back( flag );
300void TextObject::setType(
unsigned type )
305UString TextObject::text(
unsigned index)
const
307 return d->text[index];
310void TextObject::setText(
const UString& text )
312 d->text.push_back( text );
315void TextObject::convertFrom( Object*
object )
317 setId( object->id() );
318 setLeft( object->left() );
319 setTop( object->top() );
320 setWidth( object->width() );
321 setHeight( object->height() );
323 if( object->isText() )
325 TextObject* textObj =
static_cast<TextObject*
>( object );
326 setType( textObj->type() );
331class GroupObject::Private
334 std::vector<Object*> objects;
337GroupObject::GroupObject()
342GroupObject::~GroupObject()
344 for(
unsigned i=0; i<d->objects.size(); i++ )
345 delete d->objects[i];
349unsigned GroupObject::objectCount()
const
351 return d->objects.size();
354Object* GroupObject::object(
unsigned i )
356 return d->objects[i];
359void GroupObject::addObject( Object*
object )
361 d->objects.push_back(
object );
364void GroupObject::takeObject( Object*
object )
366 std::vector<Object*> result;
367 for(
unsigned i=0; i<d->objects.size(); i++ )
369 Object* obj = d->objects[i];
371 result.push_back( obj );
375 for(
unsigned j=0; j<result.size(); j++ )
376 d->objects.push_back( result[j] );
379class DrawObject::Private
387DrawObject::DrawObject()
393DrawObject::~DrawObject()
398unsigned DrawObject::shape()
const
403void DrawObject::setShape(
unsigned s )
408bool DrawObject::isVerFlip()
const
413void DrawObject::setVerFlip(
bool isVerFlip )
415 d->isVerFlip = isVerFlip;
418bool DrawObject::isHorFlip()
const
423void DrawObject::setHorFlip(
bool isHorFlip )
425 d->isHorFlip = isHorFlip;