LCOV - code coverage report
Current view: top level - include/oox/helper - modelobjecthelper.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 1 100.0 %
Date: 2014-11-03 Functions: 1 1 100.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 INCLUDED_OOX_HELPER_MODELOBJECTHELPER_HXX
      21             : #define INCLUDED_OOX_HELPER_MODELOBJECTHELPER_HXX
      22             : 
      23             : #include <com/sun/star/uno/Reference.hxx>
      24             : #include <oox/dllapi.h>
      25             : 
      26             : namespace com { namespace sun { namespace star {
      27             :     namespace awt { struct Gradient; }
      28             :     namespace container { class XNameContainer; }
      29             :     namespace drawing { struct LineDash; }
      30             :     namespace drawing { struct PolyPolygonBezierCoords; }
      31             :     namespace lang { class XMultiServiceFactory; }
      32             : } } }
      33             : 
      34             : namespace oox {
      35             : 
      36             : 
      37             : 
      38             : /** This helper manages named objects in a container, which is created on demand.
      39             :  */
      40             : class OOX_DLLPUBLIC ObjectContainer
      41             : {
      42             : public:
      43             :     explicit            ObjectContainer(
      44             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory,
      45             :                             const OUString& rServiceName );
      46             :                         ~ObjectContainer();
      47             : 
      48             :     /** Returns true, if the object with the passed name exists in the container. */
      49             :     bool                hasObject( const OUString& rObjName ) const;
      50             : 
      51             :     ::com::sun::star::uno::Any getObject( const OUString& rObjName ) const;
      52             : 
      53             :     /** Inserts the passed object into the container, returns its final name. */
      54             :     OUString     insertObject(
      55             :                             const OUString& rObjName,
      56             :                             const ::com::sun::star::uno::Any& rObj,
      57             :                             bool bInsertByUnusedName );
      58             : 
      59             : private:
      60             :     void                createContainer() const;
      61             : 
      62             : private:
      63             :     mutable ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
      64             :                         mxModelFactory;         ///< Factory to create the container.
      65             :     mutable ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
      66             :                         mxContainer;            ///< Container for the objects.
      67             :     OUString     maServiceName;          ///< Service name to create the container.
      68             :     sal_Int32           mnIndex;                ///< Index to create unique identifiers.
      69             : };
      70             : 
      71             : 
      72             : 
      73             : /** Contains tables for named drawing objects for a document model.
      74             : 
      75             :     Contains tables for named line markers, line dashes, fill gradients, and
      76             :     fill bitmap URLs. The class is needed to handle different document models
      77             :     in the same filter (e.g. embedded charts) which carry their own drawing
      78             :     object tables.
      79             :  */
      80        1830 : class OOX_DLLPUBLIC ModelObjectHelper
      81             : {
      82             : public:
      83             :     explicit            ModelObjectHelper(
      84             :                             const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxModelFactory );
      85             : 
      86             :     /** Returns true, if the model contains a line marker with the passed name. */
      87             :     bool                hasLineMarker( const OUString& rMarkerName ) const;
      88             : 
      89             :     /** Inserts a new named line marker, overwrites an existing line marker
      90             :         with the same name. Returns true, if the marker could be inserted. */
      91             :     bool                insertLineMarker(
      92             :                             const OUString& rMarkerName,
      93             :                             const ::com::sun::star::drawing::PolyPolygonBezierCoords& rMarker );
      94             : 
      95             :     /** Inserts a new named line dash, returns the line dash name, based on an
      96             :         internal constant name with a new unused index appended. */
      97             :     OUString     insertLineDash( const ::com::sun::star::drawing::LineDash& rDash );
      98             : 
      99             :     /** Inserts a new named fill gradient, returns the gradient name, based on
     100             :         an internal constant name with a new unused index appended. */
     101             :     OUString     insertFillGradient( const ::com::sun::star::awt::Gradient& rGradient );
     102             : 
     103             :     OUString     insertTransGrandient( const ::com::sun::star::awt::Gradient& rGradient );
     104             : 
     105             :     /** Inserts a new named fill bitmap URL, returns the bitmap name, based on
     106             :         an internal constant name with a new unused index appended. */
     107             :     OUString     insertFillBitmapUrl( const OUString& rGraphicUrl );
     108             : 
     109             :     OUString     getFillBitmapUrl( const OUString& rGraphicName );
     110             : 
     111             : private:
     112             :     ObjectContainer     maMarkerContainer;      ///< Contains all named line markers (line end polygons).
     113             :     ObjectContainer     maDashContainer;        ///< Contains all named line dsahes.
     114             :     ObjectContainer     maGradientContainer;    ///< Contains all named fill gradients.
     115             :     ObjectContainer     maTransGradContainer;   ///< Contains all named transparency Gradients.
     116             :     ObjectContainer     maBitmapUrlContainer;   ///< Contains all named fill bitmap URLs.
     117             :     const OUString maDashNameBase;       ///< Base name for all named line dashes.
     118             :     const OUString maGradientNameBase;   ///< Base name for all named fill gradients.
     119             :     const OUString maTransGradNameBase;   ///< Base name for all named fill gradients.
     120             :     const OUString maBitmapUrlNameBase;  ///< Base name for all named fill bitmap URLs.
     121             : };
     122             : 
     123             : 
     124             : 
     125             : } // namespace oox
     126             : 
     127             : #endif
     128             : 
     129             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10