File indexing completed on 2024-05-12 15:56:47
0001 /* This file is part of the KDE project 0002 0003 SPDX-FileCopyrightText: 2006 Jan Hambrecht <jaham@gmx.net> 0004 SPDX-FileCopyrightText: 2006, 2010 Thomas Zander <zander@kde.org> 0005 SPDX-FileCopyrightText: 2008 C. Boemann <cbo@boemann.dk> 0006 0007 SPDX-License-Identifier: LGPL-2.0-or-later 0008 */ 0009 0010 #ifndef KOshapeControllerBASE_H 0011 #define KOshapeControllerBASE_H 0012 0013 #include "kritaflake_export.h" 0014 0015 #include <QDomDocument> 0016 #include <QList> 0017 0018 class QRectF; 0019 class KoShape; 0020 class KoShapeContainer; 0021 class KoshapeControllerBasePrivate; 0022 class KoDocumentResourceManager; 0023 class KUndo2Command; 0024 0025 /** 0026 * The KoshapeControllerBase is an abstract interface that the application's class 0027 * that owns the shapes should implement. This tends to be the document. 0028 * @see KoShapeDeleteCommand, KoShapeCreateCommand 0029 */ 0030 class KRITAFLAKE_EXPORT KoShapeControllerBase 0031 { 0032 public: 0033 KoShapeControllerBase(); 0034 virtual ~KoShapeControllerBase(); 0035 0036 /** 0037 * When shapes are dropped to the canvas, the document should decide, where to 0038 * which parent to put them. In some cases the document should even create a 0039 * special layer for the new \p shapes. 0040 * 0041 * \return the proposed parent for \p shapes 0042 * \param parentCommand the command, which should be executed before the 0043 * proposed parent will be added to the document (if 0044 * new layer should be created) 0045 */ 0046 virtual KoShapeContainer* createParentForShapes(const QList<KoShape*> shapes, KUndo2Command *parentCommand); 0047 0048 /** 0049 * Return a pointer to the resource manager associated with the 0050 * shape-set (typically a document). The resource manager contains 0051 * document wide resources * such as variable managers, the image 0052 * collection and others. 0053 */ 0054 virtual KoDocumentResourceManager *resourceManager() const; 0055 0056 /** 0057 * The size of the document measured in rasterized pixels. This information is needed for loading 0058 * SVG documents that use 'px' as the default unit. 0059 */ 0060 virtual QRectF documentRectInPixels() const = 0; 0061 0062 /** 0063 * The size of the document measured in 'pt' 0064 */ 0065 QRectF documentRect() const; 0066 0067 /** 0068 * Resolution of the rasterized representation of the document. Used to load SVG documents correctly. 0069 */ 0070 virtual qreal pixelsPerInch() const = 0; 0071 0072 private: 0073 KoshapeControllerBasePrivate * const d; 0074 }; 0075 0076 #endif