F:/KPlato/koffice/libs/kotext/KoTextShapeFactory.cpp

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE project
00002  * Copyright (C) 2006 Thomas Zander <zander@kde.org>
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Library General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Library General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Library General Public License
00015  * along with this library; see the file COPYING.LIB.  If not, write to
00016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017  * Boston, MA 02110-1301, USA.
00018  */
00019 #include <KoTextShapeFactory.h>
00020 
00021 #include <klocale.h>
00022 
00023 #include <KoProperties.h>
00024 #include <KoShapeGeometry.h>
00025 #include <KoShape.h>
00026 
00027 #include "KoTextShapeData.h"
00028 #include "KoTextShape.h"
00029 #include "KoTextToolFactory.h"
00030 
00031 KoTextShapeFactory::KoTextShapeFactory(QObject *parent)
00032     : KoShapeFactory(parent, KoTextShape_SHAPEID, i18n("Text"))
00033 {
00034     setToolTip(i18n("A Shape That Shows Text"));
00035 
00036     KoShapeTemplate t;
00037     t.name = "Simple text";
00038     t.toolTip = "Text Shape With Some Text";
00039     KoProperties *props = new KoProperties();
00040     t.properties = props;
00041     props->setProperty("text", "<b>Koffie</b>, koffie... Querelanten\ndrinken geen KOffice maar groene thee.");
00042     addTemplate(t);
00043 
00044 }
00045 
00046 KoShape *KoTextShapeFactory::createDefaultShape() {
00047     KoTextShape *text = new KoTextShape();
00048     return text;
00049 }
00050 
00051 KoShape *KoTextShapeFactory::createShape(const KoProperties * params) const {
00052     KoTextShape *shape = new KoTextShape();
00053     QTextDocument *doc = new QTextDocument();
00054     doc->setDefaultFont(QFont("Sans", 10, QFont::Normal, false));
00055     doc->setHtml( params->getProperty("text").toString() );
00056     KoTextShapeData *data = static_cast<KoTextShapeData*> (shape->userData());
00057     data->setDocument(doc);
00058     return shape;
00059 }
00060 
00061 QList<KoShapeConfigWidgetBase*> KoTextShapeFactory::createShapeOptionPanels() {
00062     QList<KoShapeConfigWidgetBase*> answer;
00063     answer.append(new KoShapeGeometry());
00064     return answer;
00065 }
00066 
00067 #include "KoTextShapeFactory.moc"

Généré le Wed Nov 22 23:41:10 2006 pour KPlato par  doxygen 1.5.1-p1