LCOV - code coverage report
Current view: top level - libreoffice/oox/inc/oox/drawingml/chart - converterbase.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 5 0.0 %
Date: 2012-12-27 Functions: 0 66 0.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_DRAWINGML_CHART_CONVERTERBASE_HXX
      21             : #define OOX_DRAWINGML_CHART_CONVERTERBASE_HXX
      22             : 
      23             : #include "oox/drawingml/chart/chartcontextbase.hxx"
      24             : #include "oox/drawingml/chart/objectformatter.hxx"
      25             : 
      26             : namespace com { namespace sun { namespace star {
      27             :     namespace awt { struct Rectangle; }
      28             :     namespace awt { struct Size; }
      29             :     namespace chart2 { class XChartDocument; }
      30             :     namespace chart2 { class XTitle; }
      31             :     namespace drawing { class XShape; }
      32             : } } }
      33             : 
      34             : namespace oox { namespace core {
      35             :     class XmlFilterBase;
      36             : } }
      37             : 
      38             : namespace oox {
      39             : namespace drawingml {
      40             : namespace chart {
      41             : 
      42             : class ChartConverter;
      43             : struct ChartSpaceModel;
      44             : struct ConverterData;
      45             : 
      46             : // ============================================================================
      47             : 
      48             : const sal_Int32 API_PRIM_AXESSET = 0;
      49             : const sal_Int32 API_SECN_AXESSET = 1;
      50             : 
      51             : const sal_Int32 API_X_AXIS = 0;
      52             : const sal_Int32 API_Y_AXIS = 1;
      53             : const sal_Int32 API_Z_AXIS = 2;
      54             : 
      55             : // ============================================================================
      56             : 
      57           0 : class ConverterRoot
      58             : {
      59             : public:
      60             :     explicit            ConverterRoot(
      61             :                             ::oox::core::XmlFilterBase& rFilter,
      62             :                             ChartConverter& rChartConverter,
      63             :                             const ChartSpaceModel& rChartModel,
      64             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& rxChartDoc,
      65             :                             const ::com::sun::star::awt::Size& rChartSize );
      66             :     virtual             ~ConverterRoot();
      67             : 
      68             :     /** Creates an instance for the passed service name, using the process service factory. */
      69             :     ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
      70             :                         createInstance( const ::rtl::OUString& rServiceName ) const;
      71             : 
      72             : protected:
      73             :     /** Returns the filter object of the imported/exported document. */
      74             :     ::oox::core::XmlFilterBase& getFilter() const;
      75             :     /** Returns the chart converter. */
      76             :     ChartConverter*     getChartConverter() const;
      77             :     /** Returns the API chart document model. */
      78             :     ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
      79             :                         getChartDocument() const;
      80             :     /** Returns the position and size of the chart shape in 1/100 mm. */
      81             :     const ::com::sun::star::awt::Size& getChartSize() const;
      82             :     /** Returns the object formatter. */
      83             :     ObjectFormatter&    getFormatter() const;
      84             : 
      85             :     /** Registers a title object and its layout data, needed for conversion of
      86             :         the title position using the old Chart1 API. */
      87             :     void                registerTitleLayout(
      88             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle >& rxTitle,
      89             :                             const ModelRef< LayoutModel >& rxLayout, ObjectType eObjType,
      90             :                             sal_Int32 nMainIdx = -1, sal_Int32 nSubIdx = -1 );
      91             :     /** Converts the positions of the main title and all axis titles. */
      92             :     void                convertTitlePositions();
      93             : 
      94             : private:
      95             :     ::boost::shared_ptr< ConverterData > mxData;
      96             : };
      97             : 
      98             : // ============================================================================
      99             : 
     100             : /** Base class of all converter classes. Holds a reference to a model structure
     101             :     of the specified type.
     102             :  */
     103             : template< typename ModelType >
     104             : class ConverterBase : public ConverterRoot
     105             : {
     106             : public:
     107           0 :     inline const ModelType& getModel() const { return mrModel; }
     108             : 
     109             : protected:
     110           0 :     inline explicit     ConverterBase( const ConverterRoot& rParent, ModelType& rModel ) :
     111           0 :                             ConverterRoot( rParent ), mrModel( rModel ) {}
     112           0 :     virtual             ~ConverterBase() {}
     113             : 
     114             : protected:
     115             :     ModelType&          mrModel;
     116             : };
     117             : 
     118             : // ============================================================================
     119             : 
     120             : /** A layout converter calculates positions and sizes for various chart objects.
     121             :  */
     122             : class LayoutConverter : public ConverterBase< LayoutModel >
     123             : {
     124             : public:
     125             :     explicit            LayoutConverter( const ConverterRoot& rParent, LayoutModel& rModel );
     126             :     virtual             ~LayoutConverter();
     127             : 
     128             :     /** Tries to calculate the absolute position and size from the contained
     129             :         OOXML layout model. Returns true, if returned rectangle is valid. */
     130             :     bool                calcAbsRectangle( ::com::sun::star::awt::Rectangle& orRect ) const;
     131             : 
     132             :     /** Tries to set the position and size from the contained OOXML layout model.
     133             :         Returns true, if a manual position and size could be calculated. */
     134             :     bool                convertFromModel( PropertySet& rPropSet );
     135             : 
     136             :     /** Tries to set the position from the contained OOXML layout model.
     137             :         Returns true, if a manual position could be calculated. */
     138             :     bool                convertFromModel(
     139             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape,
     140             :                             double fRotationAngle );
     141             : };
     142             : 
     143             : // ============================================================================
     144             : 
     145             : } // namespace chart
     146             : } // namespace drawingml
     147             : } // namespace oox
     148             : 
     149             : #endif
     150             : 
     151             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10