LCOV - code coverage report
Current view: top level - sc/source/filter/inc - drawingfragment.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 4 7 57.1 %
Date: 2015-06-13 12:38:46 Functions: 8 14 57.1 %
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_SC_SOURCE_FILTER_INC_DRAWINGFRAGMENT_HXX
      21             : #define INCLUDED_SC_SOURCE_FILTER_INC_DRAWINGFRAGMENT_HXX
      22             : 
      23             : #include <com/sun/star/awt/Rectangle.hpp>
      24             : #include <com/sun/star/awt/Size.hpp>
      25             : #include <oox/drawingml/shapegroupcontext.hxx>
      26             : #include <oox/ole/axcontrol.hxx>
      27             : #include <oox/drawingml/shape.hxx>
      28             : #include <oox/ole/vbaproject.hxx>
      29             : #include <oox/vml/vmldrawing.hxx>
      30             : #include <oox/vml/vmldrawingfragment.hxx>
      31             : #include <oox/vml/vmltextbox.hxx>
      32             : #include "drawingbase.hxx"
      33             : #include "excelhandlers.hxx"
      34             : 
      35             : namespace oox { namespace ole {
      36             :     struct AxFontData;
      37             :     class AxMorphDataModelBase;
      38             : } }
      39             : 
      40             : namespace oox {
      41             : namespace xls {
      42             : 
      43             : // DrawingML
      44             : 
      45           0 : class ShapeMacroAttacher : public ::oox::ole::VbaMacroAttacherBase
      46             : {
      47             : public:
      48             :     explicit            ShapeMacroAttacher( const OUString& rMacroName,
      49             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape );
      50             : 
      51             : private:
      52             :     virtual void        attachMacro( const OUString& rMacroUrl ) SAL_OVERRIDE;
      53             : 
      54             : private:
      55             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
      56             : };
      57             : 
      58         194 : class Shape : public ::oox::drawingml::Shape, public WorksheetHelper
      59             : {
      60             : public:
      61             :     explicit            Shape(
      62             :                             const WorksheetHelper& rHelper,
      63             :                             const AttributeList& rAttribs,
      64             :                             const sal_Char* pcServiceName = 0 );
      65             : 
      66             : protected:
      67             :     virtual void        finalizeXShape(
      68             :                             ::oox::core::XmlFilterBase& rFilter,
      69             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes ) SAL_OVERRIDE;
      70             : 
      71             : private:
      72             :     OUString     maMacroName;
      73             : };
      74             : 
      75             : /** Context handler for creation of shapes embedded in group shapes. */
      76           0 : class GroupShapeContext : public ::oox::drawingml::ShapeGroupContext, public WorksheetHelper
      77             : {
      78             : public:
      79             :     explicit            GroupShapeContext(
      80             :                             ::oox::core::ContextHandler2Helper& rParent,
      81             :                             const WorksheetHelper& rHelper,
      82             :                             const ::oox::drawingml::ShapePtr& rxParentShape,
      83             :                             const ::oox::drawingml::ShapePtr& rxShape );
      84             : 
      85             :     static ::oox::core::ContextHandlerRef
      86             :                         createShapeContext(
      87             :                             ::oox::core::ContextHandler2Helper& rParent,
      88             :                             const WorksheetHelper& rHelper,
      89             :                             sal_Int32 nElement,
      90             :                             const AttributeList& rAttribs,
      91             :                             const ::oox::drawingml::ShapePtr& rxParentShape,
      92             :                             ::oox::drawingml::ShapePtr* pxShape = 0 );
      93             : 
      94             : protected:
      95             :     virtual ::oox::core::ContextHandlerRef
      96             :                         onCreateContext(
      97             :                             sal_Int32 nElement,
      98             :                             const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
      99             : };
     100             : 
     101             : /** Fragment handler for a complete sheet drawing. */
     102         188 : class DrawingFragment : public WorksheetFragmentBase
     103             : {
     104             : public:
     105             :     explicit            DrawingFragment(
     106             :                             const WorksheetHelper& rHelper,
     107             :                             const OUString& rFragmentPath );
     108             : 
     109             : protected:
     110             :     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs ) SAL_OVERRIDE;
     111             :     virtual void        onCharacters( const OUString& rChars ) SAL_OVERRIDE;
     112             :     virtual void        onEndElement() SAL_OVERRIDE;
     113             : 
     114             : private:
     115             :     typedef ::std::unique_ptr< ShapeAnchor > ShapeAnchorRef;
     116             : 
     117             :     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >
     118             :                         mxDrawPage;             /// Drawing page of this sheet.
     119             :     ::oox::drawingml::ShapePtr mxShape;         /// Current top-level shape.
     120             :     ShapeAnchorRef      mxAnchor;               /// Current anchor of top-level shape.
     121             : };
     122             : 
     123             : // VML
     124             : 
     125           0 : class VmlControlMacroAttacher : public ::oox::ole::VbaMacroAttacherBase
     126             : {
     127             : public:
     128             :     explicit            VmlControlMacroAttacher( const OUString& rMacroName,
     129             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer >& rxCtrlFormIC,
     130             :                             sal_Int32 nCtrlIndex, sal_Int32 nCtrlType, sal_Int32 nDropStyle );
     131             : 
     132             : private:
     133             :     virtual void        attachMacro( const OUString& rMacroUrl ) SAL_OVERRIDE;
     134             : 
     135             : private:
     136             :     ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexContainer > mxCtrlFormIC;
     137             :     sal_Int32           mnCtrlIndex;
     138             :     sal_Int32           mnCtrlType;
     139             :     sal_Int32           mnDropStyle;
     140             : };
     141             : 
     142         538 : class VmlDrawing : public ::oox::vml::Drawing, public WorksheetHelper
     143             : {
     144             : public:
     145             :     explicit            VmlDrawing( const WorksheetHelper& rHelper );
     146             : 
     147             :     /** Returns the drawing shape for a cell note at the specified position. */
     148             :     const ::oox::vml::ShapeBase* getNoteShape( const ::com::sun::star::table::CellAddress& rPos ) const;
     149             : 
     150             :     /** Filters cell note shapes. */
     151             :     virtual bool        isShapeSupported( const ::oox::vml::ShapeBase& rShape ) const SAL_OVERRIDE;
     152             : 
     153             :     /** Returns additional base names for automatic shape name creation. */
     154             :     virtual OUString getShapeBaseName( const ::oox::vml::ShapeBase& rShape ) const SAL_OVERRIDE;
     155             : 
     156             :     /** Calculates the shape rectangle from a cell anchor string. */
     157             :     virtual bool        convertClientAnchor(
     158             :                             ::com::sun::star::awt::Rectangle& orShapeRect,
     159             :                             const OUString& rShapeAnchor ) const SAL_OVERRIDE;
     160             : 
     161             :     /** Creates a UNO control shape for legacy drawing controls. */
     162             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
     163             :                         createAndInsertClientXShape(
     164             :                             const ::oox::vml::ShapeBase& rShape,
     165             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
     166             :                             const ::com::sun::star::awt::Rectangle& rShapeRect ) const SAL_OVERRIDE;
     167             : 
     168             :     /** Updates the bounding box covering all shapes of this drawing. */
     169             :     virtual void        notifyXShapeInserted(
     170             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
     171             :                             const ::com::sun::star::awt::Rectangle& rShapeRect,
     172             :                             const ::oox::vml::ShapeBase& rShape, bool bGroupChild ) SAL_OVERRIDE;
     173             : 
     174             : private:
     175             :     /** Converts the passed VML textbox text color to an OLE color. */
     176             :     sal_uInt32          convertControlTextColor( const OUString& rTextColor ) const;
     177             :     /** Converts the passed VML textbox font to an ActiveX form control font. */
     178             :     void                convertControlFontData(
     179             :                             ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor,
     180             :                             const ::oox::vml::TextFontModel& rFontModel ) const;
     181             :     /** Converts the caption, the font settings, and the horizontal alignment
     182             :         from the passed VML textbox to ActiveX form control settings. */
     183             :     void                convertControlText(
     184             :                             ::oox::ole::AxFontData& rAxFontData, sal_uInt32& rnOleTextColor, OUString& rCaption,
     185             :                             const ::oox::vml::TextBox* pTextBox, sal_Int32 nTextHAlign ) const;
     186             :     /** Converts the passed VML shape background formatting to ActiveX control formatting. */
     187             :     void                convertControlBackground(
     188             :                             ::oox::ole::AxMorphDataModelBase& rAxModel,
     189             :                             const ::oox::vml::ShapeBase& rShape ) const;
     190             : 
     191             : private:
     192             :     ::oox::ole::ControlConverter maControlConv;
     193             :     ::oox::vml::TextFontModel maListBoxFont;
     194             : };
     195             : 
     196           8 : class VmlDrawingFragment : public ::oox::vml::DrawingFragment, public WorksheetHelper
     197             : {
     198             : public:
     199             :     explicit            VmlDrawingFragment(
     200             :                             const WorksheetHelper& rHelper,
     201             :                             const OUString& rFragmentPath );
     202             : 
     203             : protected:
     204             :     virtual void        finalizeImport() SAL_OVERRIDE;
     205             : };
     206             : 
     207             : } // namespace xls
     208             : } // namespace oox
     209             : 
     210             : #endif
     211             : 
     212             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11