LCOV - code coverage report
Current view: top level - include/oox/export - drawingml.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 10 10 100.0 %
Date: 2014-11-03 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             : #ifndef OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY
      33             : // Our rotation is counter-clockwise and is in 100ths of a degree.
      34             : // drawingML rotation is clockwise and is in 60000ths of a degree.
      35             : #define OOX_DRAWINGML_EXPORT_ROTATE_CLOCKWISIFY(input) ((21600000-input*600)%21600000)
      36             : #endif
      37             : 
      38             : class Graphic;
      39             : 
      40             : namespace com { namespace sun { namespace star {
      41             : namespace beans {
      42             :     class XPropertySet;
      43             :     class XPropertyState;
      44             : }
      45             : namespace drawing {
      46             :     class XShape;
      47             : }
      48             : namespace style {
      49             :     struct LineSpacing;
      50             : }
      51             : namespace text {
      52             :     class XTextContent;
      53             :     class XTextRange;
      54             : }
      55             : namespace io {
      56             :     class XOutputStream;
      57             : }
      58             : }}}
      59             : 
      60             : class OutlinerParaObject;
      61             : 
      62             : namespace oox {
      63             : namespace core {
      64             :     class XmlFilterBase;
      65             : }
      66             : 
      67             : namespace drawingml {
      68             : 
      69             : /// Interface to be implemented by the parent exporter that knows how to handle shape text.
      70             : class OOX_DLLPUBLIC DMLTextExport
      71             : {
      72             : public:
      73             :     virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
      74             :     /// Write the contents of the textbox that is associated to this shape.
      75             :     virtual void WriteTextBox(css::uno::Reference<css::drawing::XShape> xShape) = 0;
      76             : protected:
      77         860 :     DMLTextExport() {}
      78         860 :     virtual ~DMLTextExport() {}
      79             : };
      80             : 
      81        1890 : class OOX_DLLPUBLIC DrawingML {
      82             : public:
      83             :     enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
      84             : 
      85             : private:
      86             :     static int mnImageCounter;
      87             :     static int mnWdpImageCounter;
      88             :     static std::map<OUString, OUString> maWdpCache;
      89             : 
      90             :     /// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
      91             :     DocumentType meDocumentType;
      92             :     /// Parent exporter, used for text callback.
      93             :     DMLTextExport* mpTextExport;
      94             : 
      95             : protected:
      96             :     ::com::sun::star::uno::Any mAny;
      97             :     ::sax_fastparser::FSHelperPtr mpFS;
      98             :     ::oox::core::XmlFilterBase* mpFB;
      99             :     /// If set, this is the parent of the currently handled shape.
     100             :     com::sun::star::uno::Reference<com::sun::star::drawing::XShape> m_xParent;
     101             : 
     102             :     bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, const OUString& aName );
     103             :     bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     104             :                   ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState > rXPropState,
     105             :                   const OUString& aName, ::com::sun::star::beans::PropertyState& eState );
     106             :     const char* GetFieldType( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun, bool& bIsField );
     107             : 
     108             : 
     109             :     /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship
     110             :     OUString WriteImage( const OUString& rURL, bool bRelPathToMedia = false);
     111             :     void WriteStyleProperties( sal_Int32 nTokenId, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aProperties );
     112             : 
     113             :     const char* GetComponentDir();
     114             :     const char* GetRelationCompPrefix();
     115             : 
     116             :     bool EqualGradients( ::com::sun::star::awt::Gradient aGradient1, ::com::sun::star::awt::Gradient aGradient2 );
     117             : 
     118             : public:
     119        1890 :     DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX, DMLTextExport* pTextExport = 0 )
     120        1890 :         : meDocumentType( eDocumentType ), mpTextExport(pTextExport), mpFS( pFS ), mpFB( pFB ) {}
     121         816 :     void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
     122        6188 :     ::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
     123        1636 :     ::oox::core::XmlFilterBase* GetFB() { return mpFB; }
     124       19304 :     DocumentType GetDocumentType() { return meDocumentType; }
     125             :     /// The application-specific text exporter callback, if there is one.
     126        1236 :     DMLTextExport* GetTextExport() { return mpTextExport; }
     127             : 
     128             :     /// If bRelPathToMedia is true add "../" to image folder path while adding the image relationship
     129             :     OUString WriteImage( const Graphic &rGraphic , bool bRelPathToMedia = false);
     130             : 
     131             :     void WriteColor( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT );
     132             :     void WriteColor( const OUString& sColorSchemeName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aTransformations );
     133             :     void WriteColorTransformations( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aTransformations );
     134             :     void WriteGradientStop( sal_uInt16 nStop, sal_uInt32 nColor );
     135             :     void WriteLineArrow( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, bool bLineStart );
     136             :     void WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID );
     137             : 
     138             :     void WriteSolidFill( sal_uInt32 nColor, sal_Int32 nAlpha = MAX_PERCENT );
     139             :     void WriteSolidFill( const OUString& sSchemeName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aTransformations );
     140             :     void WriteSolidFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     141             :     void WriteGradientFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     142             :     void WriteGradientFill( ::com::sun::star::awt::Gradient rGradient );
     143             :     void WriteGrabBagGradientFill( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aGradientStops, ::com::sun::star::awt::Gradient rGradient);
     144             : 
     145             :     void WriteBlipOrNormalFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     146             :             const OUString& rURLPropName );
     147             :     void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     148             :                          const OUString& sBitmapURL, sal_Int32 nXmlNamespace,
     149             :                          bool bWriteMode, bool bRelPathToMedia = false );
     150             :     void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     151             :             const OUString& sURLPropName );
     152             :     void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     153             :                          const OUString& sURLPropName, sal_Int32 nXmlNamespace );
     154             :     void WritePattFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     155             :     void WriteSrcRect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >, const OUString& );
     156             :     void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     157             :     void WriteStretch( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, const OUString& rURL );
     158             :     void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
     159             : 
     160             :     OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     161             :             const OUString& rURL, bool bRelPathToMedia = false , const Graphic *pGraphic=NULL );
     162             :     void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, const OUString& rURL );
     163             : 
     164             :     void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
     165             :                   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, bool bSuppressRotation = false );
     166             :     void WriteTransformation( const Rectangle& rRectangle,
     167             :                   sal_Int32 nXmlNamespace, bool bFlipH = false, bool bFlipV = false, sal_Int32 nRotation = 0 );
     168             : 
     169             :     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);
     170             :     void WriteParagraph( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
     171             :     void WriteParagraphProperties( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextContent > rParagraph );
     172             :     void WriteParagraphNumbering( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
     173             :                                   sal_Int16 nLevel );
     174             :     void WriteRun( ::com::sun::star::uno::Reference< ::com::sun::star::text::XTextRange > rRun );
     175             :     void WriteRunProperties( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rRun, bool bIsField );
     176             : 
     177             :     void WritePresetShape( const char* pShape );
     178             :     void WritePresetShape( const char* pShape, MSO_SPT eShapeType, bool bPredefinedHandlesUsed, sal_Int32 nAdjustmentsWhichNeedsToBeConverted, const ::com::sun::star::beans::PropertyValue& rProp );
     179             :     void WritePolyPolygon( const tools::PolyPolygon& rPolyPolygon );
     180             :     void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
     181             :     void WriteShapeStyle( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     182             :     void WriteShapeEffects( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     183             :     void WriteShapeEffect( const OUString& sName, const css::uno::Sequence< css::beans::PropertyValue >& aEffectProps );
     184             :     void WriteShape3DEffects( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     185             :     void WriteArtisticEffect( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     186             :     OString WriteWdpPicture( const OUString& rFileId, const ::com::sun::star::uno::Sequence< sal_Int8 >& rPictureData );
     187             : 
     188             :     static void ResetCounters();
     189             : 
     190             :     void GetUUID( OStringBuffer& rBuffer );
     191             : 
     192             :     static sal_Unicode SubstituteBullet( sal_Unicode cBulletId, ::com::sun::star::awt::FontDescriptor& rFontDesc );
     193             : 
     194             :     sal_uInt32 ColorWithIntensity( sal_uInt32 nColor, sal_uInt32 nIntensity );
     195             : 
     196             :     static const char* GetAlignment( sal_Int32 nAlignment );
     197             : 
     198             :     sax_fastparser::FSHelperPtr     CreateOutputStream (
     199             :                                         const OUString& sFullStream,
     200             :                                         const OUString& sRelativeStream,
     201             :                                         const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xParentRelation,
     202             :                                         const char* sContentType,
     203             :                                         const char* sRelationshipType,
     204             :                                         OUString* pRelationshipId = NULL );
     205             : 
     206             : };
     207             : 
     208             : }
     209             : }
     210             : 
     211             : #endif
     212             : 
     213             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10