LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/include/oox/export - vmlexport.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 3 66.7 %
Date: 2013-07-09 Functions: 2 4 50.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 _OOX_EXPORT_VMLEXPORT_HXX_
      21             : #define _OOX_EXPORT_VMLEXPORT_HXX_
      22             : 
      23             : #include <oox/dllapi.h>
      24             : #include <oox/export/drawingml.hxx>
      25             : #include <sax/fshelper.hxx>
      26             : #include <filter/msfilter/escherex.hxx>
      27             : #include <editeng/outlobj.hxx>
      28             : 
      29             : 
      30             : namespace oox {
      31             : 
      32             : namespace vml {
      33             : 
      34             : /// Interface to be implemented by the parent exporter that knows how to handle shape text.
      35             : class OOX_DLLPUBLIC VMLTextExport
      36             : {
      37             : public:
      38             :     virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
      39             :     virtual oox::drawingml::DrawingML& GetDrawingML() = 0;
      40             : protected:
      41          48 :     VMLTextExport() {}
      42          48 :     virtual ~VMLTextExport() {}
      43             : };
      44             : 
      45             : class OOX_DLLPUBLIC VMLExport : public EscherEx
      46             : {
      47             :     /// Fast serializer to output the data
      48             :     ::sax_fastparser::FSHelperPtr m_pSerializer;
      49             : 
      50             :     /// Parent exporter, used for text callback.
      51             :     VMLTextExport* m_pTextExport;
      52             : 
      53             :     /// Anchoring.
      54             :     sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel;
      55             : 
      56             :     /// Parent position.
      57             :     const Point* m_pNdTopLeft;
      58             : 
      59             :     /// The object we're exporting.
      60             :     const SdrObject* m_pSdrObject;
      61             : 
      62             :     /// Fill the shape attributes as they come.
      63             :     ::sax_fastparser::FastAttributeList *m_pShapeAttrList;
      64             : 
      65             :     /// Remember the shape type.
      66             :     sal_uInt32 m_nShapeType;
      67             : 
      68             :     /// Remember the shape flags.
      69             :     sal_uInt32 m_nShapeFlags;
      70             : 
      71             :     /// Remember style, the most important shape attribute ;-)
      72             :     OStringBuffer *m_pShapeStyle;
      73             : 
      74             :     /// Remember which shape types we had already written.
      75             :     bool *m_pShapeTypeWritten;
      76             : 
      77             : public:
      78             :                         VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport = 0 );
      79             :     virtual             ~VMLExport();
      80             : 
      81             :     ::sax_fastparser::FSHelperPtr
      82           0 :                         GetFS() { return m_pSerializer; }
      83             : 
      84             :     void SetFS(::sax_fastparser::FSHelperPtr pSerializer);
      85             : 
      86             :     /// Export the sdr object as VML.
      87             :     ///
      88             :     /// Call this when you need to export the object as VML.
      89             :     sal_uInt32 AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1,
      90             :             sal_Int16 eVOri = -1, sal_Int16 eHRel = -1,
      91             :             sal_Int16 eVRel = -1, const Point* pNdTopLeft = 0 );
      92             : 
      93             : protected:
      94             :     /// Add an attribute to the generated <v:shape/> element.
      95             :     ///
      96             :     /// This should be called from within StartShape() to ensure that the
      97             :     /// added attribute is preserved.
      98             :     void                AddShapeAttribute( sal_Int32 nAttribute, const OString& sValue );
      99             : 
     100             :     using EscherEx::StartShape;
     101             :     using EscherEx::EndShape;
     102             : 
     103             :     /// Start the shape for which we just collected the information.
     104             :     ///
     105             :     /// Returns the element's tag number, -1 means we wrote nothing.
     106             :     virtual sal_Int32   StartShape();
     107             : 
     108             :     /// End the shape.
     109             :     ///
     110             :     /// The parameter is just what we got from StartShape().
     111             :     virtual void        EndShape( sal_Int32 nShapeElement );
     112             : 
     113             :     virtual void        Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
     114             : 
     115             : private:
     116             : 
     117             :     virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
     118             :     virtual void CloseContainer();
     119             : 
     120             :     virtual sal_uInt32 EnterGroup( const OUString& rShapeName, const Rectangle* pBoundRect = 0 );
     121             :     virtual void LeaveGroup();
     122             : 
     123             :     virtual void AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 nShapeId = 0 );
     124             : 
     125             : private:
     126             :     /// Create an OString representing the id from a numerical id.
     127             :     static OString ShapeIdString( sal_uInt32 nId );
     128             : 
     129             :     /// Add starting and ending point of a line to the m_pShapeAttrList.
     130             :     void AddLineDimensions( const Rectangle& rRectangle );
     131             : 
     132             :     /// Add position and size to the OStringBuffer.
     133             :     void AddRectangleDimensions( OStringBuffer& rBuffer, const Rectangle& rRectangle );
     134             : };
     135             : 
     136             : } // namespace vml
     137             : 
     138             : } // namespace oox
     139             : 
     140             : #endif
     141             : 
     142             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10