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

Generated by: LCOV version 1.10