Warning, file /office/calligra/filters/libmsooxml/ComplexShapeHandler.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * This file is part of Office 2007 Filters for Calligra
0003  *
0004  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
0005  *
0006  * Contact: Suresh Chande suresh.chande@nokia.com
0007  *
0008  * This library is free software; you can redistribute it and/or
0009  * modify it under the terms of the GNU Lesser General Public License
0010  * version 2.1 as published by the Free Software Foundation.
0011  *
0012  * This library is distributed in the hope that it will be useful, but
0013  * WITHOUT ANY WARRANTY; without even the implied warranty of
0014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0015  * Lesser General Public License for more details.
0016  *
0017  * You should have received a copy of the GNU Lesser General Public
0018  * License along with this library; if not, write to the Free Software
0019  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
0020  * 02110-1301 USA
0021  *
0022  */
0023 
0024 #ifndef COMPLEXSHAPEHANDLER_H
0025 #define COMPLEXSHAPEHANDLER_H
0026 
0027 #include "komsooxml_export.h"
0028 
0029 #include <QXmlStreamReader>
0030 #include <QString>
0031 
0032 // This class is meant to be used as a helper class to understand
0033 // drawingML elements avLst, gdLst and pathLst and to help
0034 // create a custom-shape from them
0035 class KOMSOOXML_EXPORT ComplexShapeHandler {
0036 
0037 public:
0038 
0039     // Set of default equations needed in order to support all variables which are possible in drawingML
0040     QString defaultEquations();
0041 
0042     // pathLst needs to sometimes create extra equations on the fly because arcTo is defined in a way
0043     // which is not compatible with odf. The equations created are returned by this function.
0044     QString pathEquationsCreated();
0045 
0046     // Handles avLst items and creates equations out of them
0047     QString handle_avLst(QXmlStreamReader* reader);
0048 
0049     // Handles gdLst items and creates equations out of them
0050     QString handle_gdLst(QXmlStreamReader* reader);
0051 
0052     // Handles rect item and creates coordinates for text-areas out of them
0053     QString handle_rect(QXmlStreamReader* reader);
0054 
0055     // Handles pathLst and creates a value which should be used for enhanced-path attribute
0056     // Note: remember to check pathEquationsCreated() after using this one
0057     QString handle_pathLst(QXmlStreamReader* reader);
0058 
0059 private:
0060 
0061     QString getArgument(QString& function, bool equation = false);
0062 
0063     QString createEquation(QString& function);
0064 
0065     QString handle_gd(QXmlStreamReader* reader);
0066 
0067     QString handle_lnTo(QXmlStreamReader* reader);
0068 
0069     QString handle_close(QXmlStreamReader* reader);
0070 
0071     QString handle_arcTo(QXmlStreamReader* reader);
0072 
0073     QString handle_quadBezTo(QXmlStreamReader* reader);
0074 
0075     QString handle_cubicBezTo(QXmlStreamReader* reader);
0076 
0077     QString handle_pt(QXmlStreamReader* reader);
0078 
0079     QString handle_path(QXmlStreamReader* reader);
0080 
0081     QString handle_moveTo(QXmlStreamReader* reader);
0082 
0083     // Storing the latest position where we are, this is needed in order to implement arcTo
0084     QString oldX, oldY;
0085 
0086     int pathWidth, pathHeight;
0087 
0088     int pathEquationIndex;
0089     QString pathEquations;
0090 };
0091 
0092 #endif