File indexing completed on 2025-11-30 14:29:58

0001 /* This file is part of the KDE project
0002  * Copyright (c) 2003 thierry lorthiois <lorthioist@wanadoo.fr>
0003  * Copyright (c) 2007 Jan Hambrecht <jaham@gmx.net>
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Library General Public
0007  * License version 2 as published by the Free Software Foundation.
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 WMFEXPORT_H
0021 #define WMFEXPORT_H
0022 
0023 #include <QPen>
0024 #include <KoFilter.h>
0025 #include <QVariantList>
0026 
0027 #include <WmfWriter.h>
0028 
0029 class KarbonDocument;
0030 class KoShape;
0031 class KoShapeStrokeModel;
0032 
0033 class WmfExport : public KoFilter
0034 {
0035     Q_OBJECT
0036 
0037 public:
0038     WmfExport(QObject* parent, const QVariantList&);
0039     ~WmfExport() override;
0040 
0041     KoFilter::ConversionStatus convert(const QByteArray& from, const QByteArray& to) override;
0042 
0043 private:
0044     void paintDocument(KarbonDocument* document);
0045     void paintShape(KoShape* shape);
0046 
0047     QPen getPen(const KoShapeStrokeModel *stroke);
0048 
0049     // coordinate transformation
0050     // scale to wmf size
0051     int coordX(double left);
0052     int coordY(double top);
0053 
0054 private:
0055     Libwmf::WmfWriter *mWmf;
0056     int       mDpi;
0057     double    mScaleX;
0058     double    mScaleY;
0059 };
0060 
0061 #endif