File indexing completed on 2025-01-12 10:34:24
0001 /* This file is part of the KDE project 0002 SPDX-FileCopyrightText: 2010 Nokia 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef MSO_WRITER_H 0008 #define MSO_WRITER_H 0009 0010 #include <QRectF> 0011 0012 class KoGenStyles; 0013 class KoGenStyle; 0014 class KoXmlWriter; 0015 0016 /** 0017 * Helper class that for writing xml. 0018 * 0019 * Besides containing KoXmlWriter, this class keeps track of the coordinate 0020 * system. It has convenience functions for writing lengths in physical 0021 * dimensions (currently only mm). 0022 */ 0023 class Writer 0024 { 0025 public: 0026 qreal xOffset; 0027 qreal yOffset; 0028 qreal scaleX; 0029 qreal scaleY; 0030 0031 /** 0032 * Rotation of the group shape. 0033 */ 0034 qreal g_rotation; 0035 0036 /** 0037 * Flip the group shape horizontally. 0038 */ 0039 bool g_flipH; 0040 0041 /** 0042 * Flip the group shape vertically. 0043 */ 0044 bool g_flipV; 0045 0046 /** 0047 * Xml writer that writes into content.xml. 0048 */ 0049 KoXmlWriter& xml; 0050 /** 0051 * Styles for the document that is being created. 0052 **/ 0053 KoGenStyles& styles; 0054 /** 0055 * Tells if the current output is for styles.xml or content.xml 0056 **/ 0057 bool stylesxml; 0058 0059 /** 0060 * Construct a new Writer. 0061 * 0062 * @param xmlWriter The xml writer that writes content.xml 0063 * @param kostyles The styles for the writer. 0064 * @param stylexml Defines whether the style is an XML style. 0065 */ 0066 Writer(KoXmlWriter& xmlWriter, KoGenStyles& kostyles, 0067 bool stylexml = false); 0068 /** 0069 * Create a new writer with a new coordinate system. 0070 * 0071 * In different contexts in drawings in PPT files, different coordinate 0072 * systems are used. These are defined by specifying a rectangle in the 0073 * old coordinate system and the equivalent in the new coordinate system. 0074 */ 0075 Writer transform(const QRectF& oldCoords, const QRectF &newCoords) const; 0076 /** 0077 * Convert local length to global length. 0078 * 0079 * A length without unit in the local coordinate system is converted to a 0080 * global length without a unit. 0081 * 0082 * @param length a local length. 0083 * @return the global length. 0084 */ 0085 qreal vLength(qreal length) const; 0086 /** 0087 * @see vLength 0088 */ 0089 qreal hLength(qreal length) const; 0090 /** 0091 * @see vLength 0092 */ 0093 qreal vOffset(qreal offset) const; 0094 /** 0095 * @see vLength 0096 */ 0097 qreal hOffset(qreal offset) const; 0098 }; 0099 0100 #endif //MSO_WRITER_H