LCOV - code coverage report
Current view: top level - include/drawinglayer/primitive2d - controlprimitive2d.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 3 3 100.0 %
Date: 2014-11-03 Functions: 4 4 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_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : 
      25             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      26             : #include <basegfx/matrix/b2dhommatrix.hxx>
      27             : #include <com/sun/star/awt/XControlModel.hpp>
      28             : #include <com/sun/star/awt/XControl.hpp>
      29             : 
      30             : 
      31             : 
      32             : namespace drawinglayer
      33             : {
      34             :     namespace primitive2d
      35             :     {
      36             :         /** ControlPrimitive2D class
      37             : 
      38             :             Base class for ControlPrimitive handling. It decoposes to a
      39             :             graphical representation (Bitmap data) of the control. This
      40             :             representation is limited to a quadratic pixel maximum defined
      41             :             in the applicatin settings.
      42             :          */
      43        6596 :         class DRAWINGLAYER_DLLPUBLIC ControlPrimitive2D : public BufferedDecompositionPrimitive2D
      44             :         {
      45             :         private:
      46             :             /// object's base data
      47             :             basegfx::B2DHomMatrix                                                   maTransform;
      48             :             com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >    mxControlModel;
      49             : 
      50             :             /// the created an cached awt::XControl
      51             :             com::sun::star::uno::Reference< com::sun::star::awt::XControl >         mxXControl;
      52             : 
      53             :             /// the last used scaling, used from getDecomposition for buffering
      54             :             basegfx::B2DVector                                                      maLastViewScaling;
      55             : 
      56             :             /** used from getXControl() to create a local awt::XControl which is remembered in mxXControl
      57             :                 and from thereon always used and returned by getXControl()
      58             :              */
      59             :             void createXControl();
      60             : 
      61             :             /// single local decompositions, used from create2DDecomposition()
      62             :             Primitive2DReference createBitmapDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
      63             :             Primitive2DReference createPlaceholderDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
      64             : 
      65             :         protected:
      66             :             /// local decomposition
      67             :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      68             : 
      69             :         public:
      70             :             /// constructor
      71             :             ControlPrimitive2D(
      72             :                 const basegfx::B2DHomMatrix& rTransform,
      73             :                 const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel);
      74             : 
      75             :             /** constructor with an additional XControl as parameter to allow to hand it over at incarnation time
      76             :                 if it exists. This will avoid to create a 2nd one on demand in createXControl()
      77             :                 and thus double the XControls.
      78             :              */
      79             :             ControlPrimitive2D(
      80             :                 const basegfx::B2DHomMatrix& rTransform,
      81             :                 const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& rxControlModel,
      82             :                 const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& rxXControl);
      83             : 
      84             :             /// data read access
      85        5528 :             const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
      86        6291 :             const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel >& getControlModel() const { return mxControlModel; }
      87             : 
      88             :             /** mxControl access. This will on demand create the awt::XControl using createXControl()
      89             :                 if it does not exist. It may already have been created or even handed over at
      90             :                 incarnation
      91             :              */
      92             :             const com::sun::star::uno::Reference< com::sun::star::awt::XControl >& getXControl() const;
      93             : 
      94             :             /// compare operator
      95             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
      96             : 
      97             :             /// get range
      98             :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      99             : 
     100             :             /// provide unique ID
     101             :             DeclPrimitive2DIDBlock()
     102             : 
     103             :             /// Overload standard getDecomposition call to be view-dependent here
     104             :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
     105             :         };
     106             :     } // end of namespace primitive2d
     107             : } // end of namespace drawinglayer
     108             : 
     109             : 
     110             : 
     111             : #endif // INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CONTROLPRIMITIVE2D_HXX
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10