LCOV - code coverage report
Current view: top level - include/oox/export - drawingml.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 10 10 100.0 %
Date: 2015-06-13 12:38:46 Functions: 9 10 90.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #ifndef INCLUDED_OOX_EXPORT_DRAWINGML_HXX
      21             : #define INCLUDED_OOX_EXPORT_DRAWINGML_HXX
      22             : 
      23             : #include <oox/dllapi.h>
      24             : #include <sax/fshelper.hxx>
      25             : #include <rtl/strbuf.hxx>
      26             : #include <com/sun/star/awt/FontDescriptor.hpp>
      27             : #include <com/sun/star/awt/Gradient.hpp>
      28             : #include <com/sun/star/uno/XReference.hpp>
      29             : #include <tools/poly.hxx>
      30             : #include <filter/msfilter/escherex.hxx>
      31             : #include "oox/drawingml/drawingmltypes.hxx"
      32             : #include <oox/token/tokens.hxx>
      33             : #ifndef OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY
      34             : // Our rotation is counter-clockwise and is in 100ths of a degree.
      35             : // drawingML rotation is clockwise and is in 60000ths of a degree.
      36             : #define OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000)
      37             : #endif
      38             : 
      39             : class Graphic;
      40             : 
      41             : namespace com { namespace sun { namespace star {
      42             : namespace beans {
      43             :     class XPropertySet;
      44             :     class XPropertyState;
      45             : }
      46             : namespace drawing {
      47             :     class XShape;
      48             : }
      49             : namespace style {
      50             :     struct LineSpacing;
      51             : }
      52             : namespace text {
      53             :     class XTextContent;
      54             :     class XTextRange;
      55             : }
      56             : namespace io {
      57             :     class XOutputStream;
      58             : }
      59             : }}}
      60             : 
      61             : class OutlinerParaObject;
      62             : 
      63             : namespace oox {
      64             : namespace core {
      65             :     class XmlFilterBase;
      66             : }
      67             : 
      68             : namespace drawingml {
      69             : 
      70             : /// Interface to be implemented by the parent exporter that knows how to handle shape text.
      71             : class OOX_DLLPUBLIC DMLTextExport
      72             : {
      73             : public:
      74             :     virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
      75             :     /// Write the contents of the textbox that is associated to this shape.
      76             :     virtual void WriteTextBox(css::uno::Reference<css::drawing::XShape> xShape) = 0;
      77             : protected:
      78         482 :     DMLTextExport() {}
      79         482 :     virtual ~DMLTextExport() {}
      80             : };
      81             : 
      82        1286 : class OOX_DLLPUBLIC DrawingML {
      83             : public:
      84             :     enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
      85             : 
      86             : private:
      87             :     static int mnImageCounter;
      88             :     static int mnWdpImageCounter;
      89             :     static std::map<OUString, OUString> maWdpCache;
      90             : 
      91             :     /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
      92             :     DocumentType meDocumentType;
      93             :     /// Parent exporter, used for text callback.
      94             :     DMLTextExport* mpTextExport;
      95             : 
      96             : protected:
      97             :     ::com::sun::star::uno::Any mAny;
      98             :     ::sax_fastparser::FSHelperPtr mpFS;
      99             :     ::oox::core::XmlFilterBase* mpFB;
     100             :     /// If set, this is the parent of the currently handled shape.
     101             :     com::sun::star::uno::Reference<com::sun::star::drawing::XShape> m_xParent;
     102             : 
     103             :     bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, const OUString& aName );
     104             :     bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     105             :                   ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > rXPropState,
     106             :                   const OUString& aName, ::com::sun::star::beans::PropertyState& eState );
     107             :     const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, bool& bIsField );
     108             : 
     109             : 
     110             :     /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship
     111             :     OUString WriteImage( const OUString& rURL, bool bRelPathToMedia = false);
     112             :     void WriteStyleProperties( sal_Int32 nTokenId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProperties );
     113             : 
     114             :     const char* GetComponentDir();
     115             :     const char* GetRelationCompPrefix();
     116             : 
     117             :     static bool EqualGradients( ::com::sun::star::awt::Gradient aGradient1, ::com::sun::star::awt::Gradient aGradient2 );
     118             : 
     119             : public:
     120        1286 :     DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = 0 )
     121        1286 :         : meDocumentType( eDocumentType ), mpTextExport(pTextExport), mpFS( pFS ), mpFB( pFB ) {}
     122         470 :     void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
     123        5215 :     ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
     124        1617 :     ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
     125       16759 :     DocumentType GetDocumentType() { return meDocumentType; }
     126             :     /// The application-specific text exporter callback, if there is one.
     127         692 :     DMLTextExport* GetTextExport() { return mpTextExport; }
     128             : 
     129             :     /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship
     130             :     OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = false);
     131             : 
     132             :     void WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT );
     133             :     void WriteColor( const OUString& sColorSchemeName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aTransformations );
     134             :     void WriteColorTransformations( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aTransformations );
     135             :     void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor );
     136             :     void WriteLineArrow( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, bool bLineStart );
     137             :     void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID );
     138             : 
     139             :     void WriteSolidFill( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT );
     140             :     void WriteSolidFill( const OUString& sSchemeName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aTransformations );
     141             :     void WriteSolidFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     142             :     void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     143             :     void WriteGradientFill( ::com::sun::star::awt::Gradient rGradient );
     144             :     void WriteGrabBagGradientFill( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aGradientStops, ::com::sun::star::awt::Gradient rGradient);
     145             : 
     146             :     void WriteBlipOrNormalFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     147             :             const OUString& rURLPropName );
     148             :     void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     149             :                          const OUString& sBitmapURL, sal_Int32 nXmlNamespace,
     150             :                          bool bWriteMode, bool bRelPathToMedia = false );
     151             :     void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     152             :             const OUString& sURLPropName );
     153             :     void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     154             :                          const OUString& sURLPropName, sal_Int32 nXmlNamespace );
     155             :     void WritePattFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     156             :     void WriteSrcRect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, const OUString& );
     157             :     void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     158             :     void WriteStretch( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, const OUString& rURL );
     159             :     void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
     160             : 
     161             :     OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     162             :             const OUString& rURL, bool bRelPathToMedia = false , const Graphic *pGraphic=NULL );
     163             :     void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, const OUString& rURL );
     164             : 
     165             :     void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
     166             :                   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, bool bSuppressRotation = false );
     167             :     void WriteTransformation( const Rectangle& rRectangle,
     168             :                   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, sal_Int32 nRotation = 0 );
     169             : 
     170             :     void WriteText( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > rXIface, const OUString& presetWarp, bool bBodyPr = true, bool bText = true, sal_Int32 nXmlNamespace = 0);
     171             :     void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
     172             :     void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
     173             :     void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     174             :                                   sal_Int16 nLevel );
     175             :     void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
     176             :     void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rRun, bool bIsField, sal_Int32 nElement = XML_rPr );
     177             : 
     178             :     void WritePresetShape( const char* pShape );
     179             :     void WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
     180             :     void WriteCustomGeometry( css::uno::Reference<css::drawing::XShape> rXShape );
     181             :     void WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon );
     182             :     void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
     183             :     void WriteShapeStyle( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     184             :     void WriteShapeEffects( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     185             :     void WriteShapeEffect( const OUString& sName, const css::uno::Sequence< css::beans::PropertyValue >& aEffectProps );
     186             :     void WriteShape3DEffects( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     187             :     void WriteArtisticEffect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     188             :     OString WriteWdpPicture( const OUString& rFileId, const ::com::sun::star::uno::Sequence< sal_Int8 >& rPictureData );
     189             :     sal_Int32 getBulletMarginIndentation (::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,sal_Int16 nLevel, const OUString& propName);
     190             : 
     191             :     static void ResetCounters();
     192             : 
     193             :     static void GetUUID( OStringBuffer& rBuffer );
     194             : 
     195             :     static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc );
     196             : 
     197             :     static sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
     198             : 
     199             :     static const char* GetAlignment( sal_Int32 nAlignment );
     200             : 
     201             :     sax_fastparser::FSHelperPtr     CreateOutputStream (
     202             :                                         const OUString& sFullStream,
     203             :                                         const OUString& sRelativeStream,
     204             :                                         const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation,
     205             :                                         const char* sContentType,
     206             :                                         const char* sRelationshipType,
     207             :                                         OUString* pRelationshipId = NULL );
     208             : 
     209             : };
     210             : 
     211             : }
     212             : }
     213             : 
     214             : #endif
     215             : 
     216             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11