Warning, file /office/calligra/filters/libmsooxml/MsooXmlCommonReaderDrawingMLMethods.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) 2009 Nokia Corporation and/or its subsidiary(-ies). 0005 * Contact: Suresh Chande suresh.chande@nokia.com 0006 * 0007 * Copyright (C) 2011-2012 Matus Uzak (matus.uzak@gmail.com). 0008 * 0009 * This library is free software; you can redistribute it and/or 0010 * modify it under the terms of the GNU Lesser General Public License 0011 * version 2.1 as published by the Free Software Foundation. 0012 * 0013 * This library is distributed in the hope that it will be useful, but 0014 * WITHOUT ANY WARRANTY; without even the implied warranty of 0015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0016 * Lesser General Public License for more details. 0017 * 0018 * You should have received a copy of the GNU Lesser General Public 0019 * License along with this library; if not, write to the Free Software 0020 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 0021 * 02110-1301 USA 0022 * 0023 */ 0024 0025 // This is not a normal header, *don't* add include guards to it. 0026 // This will cause the compiler to get wrong offsets and to corrupt 0027 // the stack. 0028 0029 protected: 0030 0031 #include "MsooXmlDrawingMLShared.h" 0032 0033 //! When dealing with colors there's no way to know what type of 0034 //! attribute we are setting. While MSOOXML doesn't need to know the 0035 //! context in which a color is used, ODF does need to know this. 0036 enum ColorType { 0037 BackgroundColor, 0038 OutlineColor, 0039 TextColor, 0040 GradientColor 0041 }; 0042 0043 enum blipFillCaller { 0044 blipFill_lockedCanvas = 'a', 0045 blipFill_spPr = 'a', 0046 blipFill_pic = 'p', //dml in pptx; for dml in docx use 'pic' 0047 blipFill_rPr = 'p', //dml 0048 blipFill_bgPr = 'a', // pptx 0049 blipFill_grpSpPr = 'a' 0050 }; 0051 0052 enum cNvPrCaller { 0053 cNvPr_nvSpPr, 0054 cNvPr_nvPicPr, 0055 cNvPr_nvCxnSpPr 0056 }; 0057 0058 enum txBodyCaller { 0059 DrawingML_txBody_tc, 0060 DrawingML_txBody_txSp, 0061 DrawingML_txBody_sp 0062 }; 0063 0064 enum spacingType { 0065 spacingMarginTop, 0066 spacingLines, 0067 spacingMarginBottom 0068 }; 0069 0070 struct GroupProp { 0071 qint64 svgXOld; 0072 qint64 svgYOld; 0073 qreal svgWidthOld; 0074 qreal svgHeightOld; 0075 qreal svgXChOld; 0076 qreal svgYChOld; 0077 qreal svgWidthChOld; 0078 qreal svgHeightChOld; 0079 }; 0080 0081 void initDrawingML(); 0082 0083 /** 0084 * @return true in case a custom or supported predefined shape is 0085 * being processed and false in case of a text-box and rectangle. 0086 */ 0087 bool isCustomShape(); 0088 0089 /** 0090 * @return true in case an unsupported shape is being processed. 0091 */ 0092 bool unsupportedPredefinedShape(); 0093 0094 /** 0095 * TODO: 0096 */ 0097 void preReadSp(); 0098 0099 /** 0100 * Write the parent el. in {draw:line, draw:custom-shape, draw:frame} 0101 * to the body writer and create a graphic style for a shape. 0102 */ 0103 void generateFrameSp(); 0104 0105 /** 0106 * Write the draw:enhanced-geometry element to the body writer in case 0107 * of a draw:custom-shape. 0108 */ 0109 void writeEnhancedGeometry(); 0110 0111 // ---------------------------------------- 0112 // MSOOXML_CURRENT_NS "dgm" 0113 // ---------------------------------------- 0114 KoFilter::ConversionStatus read_relIds(); 0115 0116 // ---------------------------------------- 0117 // MSOOXML_CURRENT_NS "c" 0118 // ---------------------------------------- 0119 KoFilter::ConversionStatus read_chart(); 0120 0121 // ---------------------------------------- 0122 // MSOOXML_CURRENT_NS "lc" 0123 // ---------------------------------------- 0124 KoFilter::ConversionStatus read_lockedCanvas(); 0125 0126 // ---------------------------------------- 0127 // MSOOXML_CURRENT_NS == DRAWINGML_PIC_NS 0128 // ---------------------------------------- 0129 // The following elements can have a namespace in {a,pic,p,xdr}. 0130 KoFilter::ConversionStatus read_cNvPicPr(); //done 0131 KoFilter::ConversionStatus read_cNvPr(cNvPrCaller caller); //done 0132 KoFilter::ConversionStatus read_nvPicPr(); //done 0133 KoFilter::ConversionStatus read_pic(); //done 0134 KoFilter::ConversionStatus read_nvSpPr(); //done 0135 KoFilter::ConversionStatus read_grpSp(); //done 0136 KoFilter::ConversionStatus read_grpSpPr(); //done 0137 KoFilter::ConversionStatus read_nvCxnSpPr(); //done 0138 KoFilter::ConversionStatus read_cNvSpPr(); //done 0139 KoFilter::ConversionStatus read_cxnSp(); //done 0140 KoFilter::ConversionStatus read_sp(); //done 0141 KoFilter::ConversionStatus read_spPr(); //done 0142 KoFilter::ConversionStatus read_style(); //done 0143 0144 // ---------------------------------------- 0145 // MSOOXML_CURRENT_NS "a" 0146 // ---------------------------------------- 0147 KoFilter::ConversionStatus read_lnRef(); 0148 KoFilter::ConversionStatus read_masterClrMapping(); 0149 KoFilter::ConversionStatus read_overrideClrMapping(); 0150 KoFilter::ConversionStatus read_DrawingML_p(); 0151 KoFilter::ConversionStatus read_DrawingML_r(); 0152 KoFilter::ConversionStatus read_DrawingML_br(); 0153 KoFilter::ConversionStatus read_endParaRPr(); 0154 KoFilter::ConversionStatus read_DrawingML_rPr(); 0155 KoFilter::ConversionStatus read_DrawingML_pPr(); 0156 KoFilter::ConversionStatus read_hlinkClick(); 0157 KoFilter::ConversionStatus read_custGeom(); 0158 KoFilter::ConversionStatus read_xfrm(); 0159 KoFilter::ConversionStatus read_off(); 0160 KoFilter::ConversionStatus read_chOff(); 0161 KoFilter::ConversionStatus read_ext(); 0162 KoFilter::ConversionStatus read_chExt(); 0163 KoFilter::ConversionStatus read_blip(); 0164 KoFilter::ConversionStatus read_stretch(); 0165 KoFilter::ConversionStatus read_biLevel(); 0166 KoFilter::ConversionStatus read_grayscl(); 0167 KoFilter::ConversionStatus read_lum(); 0168 KoFilter::ConversionStatus read_duotone(); 0169 KoFilter::ConversionStatus read_tile(); 0170 KoFilter::ConversionStatus read_srcRect(); 0171 KoFilter::ConversionStatus read_fillRect(); 0172 KoFilter::ConversionStatus read_graphic(); 0173 KoFilter::ConversionStatus read_graphicData(); 0174 KoFilter::ConversionStatus read_blipFill(blipFillCaller caller); 0175 KoFilter::ConversionStatus read_txSp(); 0176 0177 //! Convert attributes of Text Run Properties to ODF equivalents. 0178 void handleRprAttributes(const QXmlStreamAttributes& attrs); 0179 0180 // ---------------------------------------- 0181 // MSOOXML_CURRENT_NS == DRAWINGML_NS 0182 // ---------------------------------------- 0183 // The following elements can have a namespace in {a,wp}. 0184 KoFilter::ConversionStatus read_lstStyle(); 0185 KoFilter::ConversionStatus read_latin(); 0186 KoFilter::ConversionStatus read_DrawingML_highlight(); 0187 KoFilter::ConversionStatus read_gradFill(); 0188 KoFilter::ConversionStatus read_gradFillRpr(); 0189 KoFilter::ConversionStatus read_lin(); 0190 KoFilter::ConversionStatus read_gsLst(); 0191 KoFilter::ConversionStatus read_gs(); 0192 KoFilter::ConversionStatus read_noFill(); 0193 KoFilter::ConversionStatus read_prstGeom(); 0194 KoFilter::ConversionStatus read_avLst(); 0195 KoFilter::ConversionStatus read_gd(); 0196 KoFilter::ConversionStatus read_effectLst(); 0197 KoFilter::ConversionStatus read_outerShdw(); 0198 KoFilter::ConversionStatus lvlHelper(const QString& level); 0199 KoFilter::ConversionStatus read_lvl1pPr(); 0200 KoFilter::ConversionStatus read_lvl2pPr(); 0201 KoFilter::ConversionStatus read_lvl3pPr(); 0202 KoFilter::ConversionStatus read_lvl4pPr(); 0203 KoFilter::ConversionStatus read_lvl5pPr(); 0204 KoFilter::ConversionStatus read_lvl6pPr(); 0205 KoFilter::ConversionStatus read_lvl7pPr(); 0206 KoFilter::ConversionStatus read_lvl8pPr(); 0207 KoFilter::ConversionStatus read_lvl9pPr(); 0208 KoFilter::ConversionStatus read_buBlip(); 0209 KoFilter::ConversionStatus read_buChar(); 0210 KoFilter::ConversionStatus read_buClr(); 0211 KoFilter::ConversionStatus read_buClrTx(); 0212 KoFilter::ConversionStatus read_buSzPct(); 0213 KoFilter::ConversionStatus read_buSzPts(); 0214 KoFilter::ConversionStatus read_buFont(); 0215 KoFilter::ConversionStatus read_buNone(); 0216 KoFilter::ConversionStatus read_buAutoNum(); 0217 KoFilter::ConversionStatus read_fld(); 0218 KoFilter::ConversionStatus read_spcBef(); 0219 KoFilter::ConversionStatus read_spcAft(); 0220 KoFilter::ConversionStatus read_lnSpc(); 0221 KoFilter::ConversionStatus read_spcPts(); 0222 KoFilter::ConversionStatus read_spcPct(); 0223 KoFilter::ConversionStatus read_defRPr(); 0224 KoFilter::ConversionStatus read_bodyPr(); 0225 KoFilter::ConversionStatus read_normAutofit(); 0226 KoFilter::ConversionStatus read_spAutoFit(); 0227 0228 //! Inherit default body properties 0229 void inheritDefaultBodyProperties(); 0230 0231 void algnToODF(const char *odfEl, const QString& emuValue); 0232 0233 //! Sets the fo:margin-* attribute of graphic-properties for read_anchor(). 0234 void distToODF(const char *odfEl, const QString& emuValue); 0235 0236 // ---------------------------------------- 0237 // MSOOXML_CURRENT_NS == (DRAWINGML_NS || DRAWINGML_TXBODY_NS) 0238 // ---------------------------------------- 0239 0240 KoFilter::ConversionStatus read_DrawingML_txBody(txBodyCaller caller); 0241 0242 // ---------------------------------------- 0243 0244 MSOOXML::Utils::autoFitStatus m_normAutofit; // Whether text should be fitted to fit the shape 0245 0246 bool m_isLockedCanvas; 0247 0248 KoGenStyle m_referredFont; 0249 0250 int m_gradPosition; 0251 QString m_gradAngle; 0252 bool m_xfrm_read; 0253 bool m_insideTable; 0254 qreal m_maxParaFontPt; // Largest font size used in the paragraph 0255 qreal m_minParaFontPt; // minimum font size used in the paragraph 0256 read_p_args m_read_DrawingML_p_args; 0257 0258 bool m_contentAvLstExists; // whether avLst exists 0259 QMap<QString, QString> m_avModifiers; 0260 0261 QString m_customPath; 0262 QString m_customEquations; 0263 QString m_textareas; 0264 0265 QString m_contentType; // read in prstGeom 0266 0267 spacingType m_currentSpacingType; // determines how spcPct and spcPts should behave 0268 0269 QString m_shapeTextPosition; 0270 QString m_shapeTextTopOff; 0271 QString m_shapeTextBottomOff; 0272 QString m_shapeTextLeftOff; 0273 QString m_shapeTextRightOff; 0274 0275 bool m_listStylePropertiesAltered; 0276 QString m_prevListStyleName; 0277 0278 int m_prevListLevel; //! set by drawingML_ppr 0279 int m_currentListLevel; //! set by drawingML_ppr 0280 0281 // Map of level keys and xml:id values of text:list elements to continue 0282 // automatic numbering. 0283 QMap<quint16, QString> m_lvlXmlIdMap; 0284 0285 // true - continue numbered list, false - restart numbering 0286 QMap<quint16, bool> m_continueListNumbering; 0287 0288 //! set by read_drawing() to indicate if we have encountered 0289 //! drawing/anchor, used by read_pic() 0290 bool m_drawing_anchor; 0291 0292 //! set by read_drawing() to indicate if we have encountered 0293 //! drawing/inline, used by read_pic() 0294 bool m_drawing_inline; 0295 0296 // Shape properties 0297 qint64 m_svgX; //!< set by read_off() 0298 qint64 m_svgY; //!< set by read_off() 0299 int m_svgWidth; //! set by read_ext() 0300 int m_svgHeight; //! set by read_ext() 0301 int m_svgChX; //!< set by read_chOff() 0302 int m_svgChY; //!< set by read_chOff() 0303 int m_svgChWidth; //! set by read_chExt() 0304 int m_svgChHeight; //! set by read_chExt() 0305 0306 bool m_inGrpSpPr; //Whether we are in group shape, affects transformations 0307 bool m_flipH; //! set by read_xfrm() 0308 bool m_flipV; //! set by read_xfrm() 0309 0310 int m_rot; //! set by read_xfrm() 0311 0312 QVector<GroupProp> m_svgProp; //! value of the parent 0313 0314 QString m_xlinkHref; //!< set by read_blip() 0315 bool m_ignoreLinkHref; //!< to ignore picture with a style which has picture fill 0316 QString m_cNvPrId; //!< set by read_cNvPr() 0317 QString m_cNvPrName; //!< set by read_cNvPr() 0318 QString m_cNvPrDescr; //!< set by read_cNvPr() 0319 0320 bool m_hyperLink; 0321 QString m_hyperLinkTarget; 0322 0323 QString m_recentDestName; // recent image 0324