LCOV - code coverage report
Current view: top level - solver/unxlngi6.pro/inc/oox/export - vmlexport.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 2 3 66.7 %
Date: 2012-08-25 Functions: 2 4 50.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 2 50.0 %

           Branch data     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                 :            : namespace rtl {
      30                 :            :     class OString;
      31                 :            :     class OStringBuffer;
      32                 :            : }
      33                 :            : 
      34                 :            : namespace oox {
      35                 :            : 
      36                 :            : namespace vml {
      37                 :            : 
      38                 :            : /// Interface to be implemented by the parent exporter that knows how to handle shape text.
      39                 :            : class OOX_DLLPUBLIC VMLTextExport
      40                 :            : {
      41                 :            : public:
      42                 :            :     virtual void WriteOutliner(const OutlinerParaObject& rParaObj) = 0;
      43                 :            :     virtual oox::drawingml::DrawingML& GetDrawingML() = 0;
      44                 :            : protected:
      45                 :         57 :     VMLTextExport() {}
      46         [ -  + ]:         57 :     virtual ~VMLTextExport() {}
      47                 :            : };
      48                 :            : 
      49                 :            : class OOX_DLLPUBLIC VMLExport : public EscherEx
      50                 :            : {
      51                 :            :     /// Fast serializer to output the data
      52                 :            :     ::sax_fastparser::FSHelperPtr m_pSerializer;
      53                 :            : 
      54                 :            :     /// Parent exporter, used for text callback.
      55                 :            :     VMLTextExport* m_pTextExport;
      56                 :            : 
      57                 :            :     /// The object we're exporting.
      58                 :            :     const SdrObject* m_pSdrObject;
      59                 :            : 
      60                 :            :     /// Fill the shape attributes as they come.
      61                 :            :     ::sax_fastparser::FastAttributeList *m_pShapeAttrList;
      62                 :            : 
      63                 :            :     /// Remember the shape type.
      64                 :            :     sal_uInt32 m_nShapeType;
      65                 :            : 
      66                 :            :     /// Remember the shape flags.
      67                 :            :     sal_uInt32 m_nShapeFlags;
      68                 :            : 
      69                 :            :     /// Remember style, the most important shape attribute ;-)
      70                 :            :     rtl::OStringBuffer *m_pShapeStyle;
      71                 :            : 
      72                 :            :     /// Remember which shape types we had already written.
      73                 :            :     bool *m_pShapeTypeWritten;
      74                 :            : 
      75                 :            : public:
      76                 :            :                         VMLExport( ::sax_fastparser::FSHelperPtr pSerializer, VMLTextExport* pTextExport = 0 );
      77                 :            :     virtual             ~VMLExport();
      78                 :            : 
      79                 :            :     ::sax_fastparser::FSHelperPtr
      80                 :          0 :                         GetFS() { return m_pSerializer; }
      81                 :            : 
      82                 :            :     /// Export the sdr object as VML.
      83                 :            :     ///
      84                 :            :     /// Call this when you need to export the object as VML.
      85                 :            :     sal_uInt32 AddSdrObject( const SdrObject& rObj );
      86                 :            : 
      87                 :            : protected:
      88                 :            :     /// Add an attribute to the generated <v:shape/> element.
      89                 :            :     ///
      90                 :            :     /// This should be called from within StartShape() to ensure that the
      91                 :            :     /// added attribute is preserved.
      92                 :            :     void                AddShapeAttribute( sal_Int32 nAttribute, const rtl::OString& sValue );
      93                 :            : 
      94                 :            :     using EscherEx::StartShape;
      95                 :            :     using EscherEx::EndShape;
      96                 :            : 
      97                 :            :     /// Start the shape for which we just collected the information.
      98                 :            :     ///
      99                 :            :     /// Returns the element's tag number, -1 means we wrote nothing.
     100                 :            :     virtual sal_Int32   StartShape();
     101                 :            : 
     102                 :            :     /// End the shape.
     103                 :            :     ///
     104                 :            :     /// The parameter is just what we got from StartShape().
     105                 :            :     virtual void        EndShape( sal_Int32 nShapeElement );
     106                 :            : 
     107                 :            :     virtual void        Commit( EscherPropertyContainer& rProps, const Rectangle& rRect );
     108                 :            : 
     109                 :            : private:
     110                 :            : 
     111                 :            :     virtual void OpenContainer( sal_uInt16 nEscherContainer, int nRecInstance = 0 );
     112                 :            :     virtual void CloseContainer();
     113                 :            : 
     114                 :            :     virtual sal_uInt32 EnterGroup( const String& rShapeName, const Rectangle* pBoundRect = 0 );
     115                 :            :     virtual void LeaveGroup();
     116                 :            : 
     117                 :            :     virtual void AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uInt32 nShapeId = 0 );
     118                 :            : 
     119                 :            : private:
     120                 :            :     /// Create an OString representing the id from a numerical id.
     121                 :            :     static rtl::OString ShapeIdString( sal_uInt32 nId );
     122                 :            : 
     123                 :            :     /// Add starting and ending point of a line to the m_pShapeAttrList.
     124                 :            :     void AddLineDimensions( const Rectangle& rRectangle );
     125                 :            : 
     126                 :            :     /// Add position and size to the OStringBuffer.
     127                 :            :     void AddRectangleDimensions( rtl::OStringBuffer& rBuffer, const Rectangle& rRectangle );
     128                 :            : };
     129                 :            : 
     130                 :            : } // namespace vml
     131                 :            : 
     132                 :            : } // namespace oox
     133                 :            : 
     134                 :            : #endif
     135                 :            : 
     136                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10