1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #ifndef _OOX_EXPORT_DRAWINGML_HXX_ 23 #define _OOX_EXPORT_DRAWINGML_HXX_ 24 25 #include <oox/dllapi.h> 26 #include <sax/fshelper.hxx> 27 #include <rtl/strbuf.hxx> 28 #include <com/sun/star/awt/FontDescriptor.hpp> 29 #include <com/sun/star/uno/XReference.hpp> 30 #include <tools/poly.hxx> 31 #include <svx/escherex.hxx> 32 33 class Graphic; 34 class String; 35 36 namespace com { namespace sun { namespace star { 37 namespace beans { 38 class XPropertySet; 39 class XPropertyState; 40 } 41 namespace drawing { 42 class XShape; 43 } 44 namespace text { 45 class XTextContent; 46 class XTextRange; 47 } 48 }}} 49 50 namespace oox { 51 namespace core { 52 class XmlFilterBase; 53 } 54 55 namespace drawingml { 56 57 class OOX_DLLPUBLIC DrawingML { 58 public: 59 enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX }; 60 61 private: 62 ::sax_fastparser::FSHelperPtr mpFS; 63 ::oox::core::XmlFilterBase* mpFB; 64 65 static int mnImageCounter; 66 67 /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC). 68 DocumentType meDocumentType; 69 70 protected: 71 ::com::sun::star::uno::Any mAny; 72 73 bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String aName ); 74 bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, 75 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > rXPropState, 76 String aName, ::com::sun::star::beans::PropertyState& eState ); 77 const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun ); 78 79 rtl::OUString WriteImage( const rtl::OUString& rURL ); 80 81 public: DrawingML(::sax_fastparser::FSHelperPtr pFS,::oox::core::XmlFilterBase * pFB=NULL,DocumentType eDocumentType=DOCUMENT_PPTX)82 DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : mpFS( pFS ), mpFB( pFB ), meDocumentType( eDocumentType ) {} SetFS(::sax_fastparser::FSHelperPtr pFS)83 void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; } GetFS()84 ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; } GetFB()85 ::oox::core::XmlFilterBase* GetFB() { return mpFB; } 86 87 rtl::OUString WriteImage( const Graphic &rGraphic ); 88 89 void WriteColor( sal_uInt32 nColor ); 90 void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor ); 91 void WriteLineArrow( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, sal_Bool bLineStart ); 92 void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID ); 93 94 void WriteSolidFill( sal_uInt32 nColor ); 95 void WriteSolidFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); 96 void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); 97 void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String sURLPropName, sal_Int32 nXmlNamespace ); 98 void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String sURLPropName ); 99 void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); 100 void WriteStretch(); 101 102 ::rtl::OUString WriteBlip( ::rtl::OUString& rURL ); 103 void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet ); 104 105 void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape, 106 sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 ); 107 void WriteTransformation( const Rectangle& rRectangle, 108 sal_Bool bFlipH = false, sal_Bool bFlipV = false, sal_Int32 nRotation = 0 ); 109 110 void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape ); 111 void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph ); 112 void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph ); 113 void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, 114 sal_Int16 nLevel ); 115 void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun ); 116 void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun ); 117 118 void WritePresetShape( const char* pShape ); 119 void WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp ); 120 void WritePolyPolygon( const PolyPolygon& rPolyPolygon ); 121 122 static void ResetCounters(); 123 124 void GetUUID( ::rtl::OStringBuffer& rBuffer ); 125 126 static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc ); 127 128 sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity ); 129 130 static const char* GetAlignment( sal_Int32 nAlignment ); 131 }; 132 133 } 134 } 135 136 #endif 137