Warning, file /office/calligra/filters/libmsooxml/MsooXmlVmlReaderMethods.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 /*! @file MsooXmlVmlReaderMethods.h
0025     @brief Collects MS VML parser code.
0026 
0027     Included by MsooXmlCommonReader.
0028     MS VML is not a part of the approved OOXML,
0029     it is described in ECMA-376 Part 4: "Transitional Migration Features".
0030     Required for interoperability in any version of MSOOXML.
0031     VML elements are referenced in ECMA-376 Part 1.
0032 
0033     All page numbers of the ECMA-376 documents refer to the 2nd edition.
0034 */
0035 
0036 protected:
0037 
0038     enum FrameStartElement {FrameStart, EllipseStart, RectStart, LineStart, CustomStart, GroupStart};
0039 
0040     // v namespace:
0041     KoFilter::ConversionStatus genericReader(FrameStartElement startType);
0042     KoFilter::ConversionStatus read_oval();
0043     KoFilter::ConversionStatus read_line();
0044     KoFilter::ConversionStatus read_roundrect();
0045     KoFilter::ConversionStatus read_rect();
0046     KoFilter::ConversionStatus read_fill();
0047     KoFilter::ConversionStatus read_VML_background();
0048     KoFilter::ConversionStatus read_shapetype();
0049     KoFilter::ConversionStatus read_formulas();
0050     KoFilter::ConversionStatus read_path();
0051     KoFilter::ConversionStatus read_f();
0052     KoFilter::ConversionStatus read_shape();
0053     KoFilter::ConversionStatus read_imagedata();
0054     KoFilter::ConversionStatus read_textbox();
0055     KoFilter::ConversionStatus read_group();
0056     KoFilter::ConversionStatus read_stroke();
0057     KoFilter::ConversionStatus read_shadow();
0058 
0059     void handlePathValues(const QXmlStreamAttributes& attrs);
0060     void handleStrokeAndFill(const QXmlStreamAttributes& attrs);
0061     void takeDefaultValues();
0062 
0063     QString rgbColor(QString color);
0064 
0065     // w:10 namespace:
0066     KoFilter::ConversionStatus read_wrap();
0067 
0068     void createFrameStart(FrameStartElement startType = FrameStart);
0069 
0070     // utils:
0071     KoFilter::ConversionStatus parseCSS(const QString& style);
0072 
0073     //writer where style:background-image is stored for style:page-layout-properties
0074     KoXmlWriter* m_pDocBkgImageWriter;
0075 
0076 public:
0077 
0078     struct VMLShapeProperties {
0079         QString currentEl;
0080 
0081         QMap<QByteArray, QString> vmlStyle;
0082 
0083         QString strokeColor; // stroke color
0084         QString strokeWidth; // stroke width
0085         QString lineCapStyle;
0086         QString joinStyle;
0087         QString strokeStyleName;
0088         QString fillType;
0089         QString gradientStyle;
0090         QString shapeColor; //!< set in read_shape()
0091         QString shapeSecondaryColor; // used eg. for some gradients
0092 
0093         qreal opacity;
0094 
0095         bool wrapRead;
0096         QString currentShapeId; //!< set in read_shape()
0097         QString imagedataPath; //!< set in read_shape()
0098         QString shapeAltText; //!< set in read_shape()
0099         QString shapeTitle; //!< set in read_shape()
0100 
0101         bool stroked, filled, shadowed;
0102 
0103         QString shadowColor;
0104         QString shadowXOffset, shadowYOffset;
0105         qreal shadowOpacity;
0106 
0107         QString anchorType;
0108 
0109         int formulaIndex;
0110         QString shapeTypeString;
0111         QString extraShapeFormulas;
0112         QString normalFormulas;
0113         QString modifiers;
0114         QString viewBox;
0115         QString shapePath;
0116         int extraFormulaIndex;
0117 
0118         QString internalMarginLeft;
0119         QString internalMarginRight;
0120         QString internalMarginTop;
0121         QString internalMarginBottom;
0122 
0123         QString marginLeft;
0124         QString marginTop;
0125         QString marginRight;
0126         QString marginBottom;
0127 
0128         bool fitTextToShape, fitShapeToText;
0129 
0130         // Parameters for group shape situation
0131         bool insideGroup;
0132         int groupWidth, groupHeight; // Relative group extends
0133         int groupX, groupY; // Relative group origin
0134         qreal groupXOffset, groupYOffset; // Offset caused by the group parent
0135         qreal real_groupWidth, real_groupHeight;
0136     };
0137 
0138     // Elements defined by v:shapeType
0139     QMap<QString, VMLShapeProperties> m_definedShapeTypes;
0140 
0141 protected:
0142 
0143     VMLShapeProperties m_currentVMLProperties;
0144 
0145     // Using stack to make sure correct properties are handled in a case when
0146     // there are group shapes
0147     QStack<VMLShapeProperties> m_VMLShapeStack;
0148 
0149     bool m_outputFrames; // Whether read_shape should output something to shape