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