File indexing completed on 2024-05-12 16:36:45

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2008 Thorsten Zachmann <zachmann@kde.org>
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KPRPLACEHOLDERSTRATEGY_H
0021 #define KPRPLACEHOLDERSTRATEGY_H
0022 
0023 #include <QMap>
0024 
0025 class QString;
0026 class QRectF;
0027 class QPainter;
0028 #include "KoXmlReaderForward.h"
0029 class KoShape;
0030 class KoShapeLoadingContext;
0031 class KoShapeSavingContext;
0032 class KoShapeUserData;
0033 class KoViewConverter;
0034 class PlaceholderData;
0035 class KoDocumentResourceManager;
0036 class KoShapePaintingContext;
0037 
0038 class KPrPlaceholderStrategy
0039 {
0040 public:
0041     /**
0042      * Factory method to create a KPrPlaceholderStrategy
0043      *
0044      * @param presentationClass The presentation:class attribute of the placeholder
0045      */
0046     static KPrPlaceholderStrategy * create( const QString & presentationClass );
0047 
0048     /**
0049      * Check if the presentation class is supported
0050      *
0051      * @param presentationClass The presentation:class attribute of the placeholder
0052      */
0053     static bool supported( const QString & presentationClass );
0054 
0055     virtual ~KPrPlaceholderStrategy();
0056 
0057     virtual KoShape *createShape(KoDocumentResourceManager *documentResources);
0058 
0059     virtual void paint( QPainter & painter, const KoViewConverter &converter, const QRectF & rect, KoShapePaintingContext &paintcontext);
0060 
0061     virtual void saveOdf( KoShapeSavingContext & context );
0062 
0063     virtual bool loadOdf( const KoXmlElement & element, KoShapeLoadingContext & context );
0064 
0065     virtual void init(KoDocumentResourceManager *documentResources);
0066 
0067     virtual KoShapeUserData * userData() const;
0068 
0069 protected:
0070     /**
0071      * @param presentationClass The presentation:class of the shape used for creating a shape of that type
0072      */
0073     KPrPlaceholderStrategy( const QString & presentationClass );
0074 
0075     /**
0076      * Get the text that is displayed
0077      */
0078     virtual QString text() const;
0079 
0080     const PlaceholderData * m_placeholderData;
0081 };
0082 
0083 #endif /* KPRPLACEHOLDERSTRATEGY_H */