LCOV - code coverage report
Current view: top level - include/drawinglayer/primitive2d - cropprimitive2d.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 6 0.0 %
Date: 2014-04-14 Functions: 0 7 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 INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
      21             : #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
      22             : 
      23             : #include <drawinglayer/drawinglayerdllapi.h>
      24             : #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
      25             : #include <basegfx/matrix/b2dhommatrix.hxx>
      26             : 
      27             : 
      28             : 
      29             : namespace drawinglayer
      30             : {
      31             :     namespace primitive2d
      32             :     {
      33             :         /** CropPrimitive2D class
      34             : 
      35             :             Caution: Due to old constraints (old core definitions) the
      36             :             crop distances describe how the uncropped content is defined
      37             :             relative to the current object size. This means that maTransformation
      38             :             describes the rurrent object size (the part of the object visible
      39             :             with the crop applied). To get the original size and orientation
      40             :             of the uncropped content it is necessary to calc back from the
      41             :             current situation (maTransformation) using the crop values
      42             :             to get to the uncropped original content.
      43             : 
      44             :             Thus a transformation has to be calculated which will be applied
      45             :             to the already exsisting content to get it to the uncropped state
      46             :             ans then this is masked with the current state (mask polygon
      47             :             created from unit polygon and maTransformation).
      48             : 
      49             :             At least in this primitive the units of the crop values are
      50             :             already in the local coordinate system; inthe core these distances
      51             :             are defined relative to the object content size (PrefMapMode
      52             :             and PrefSize of the content)...
      53             : 
      54             :             Of course this is a primitive, so feel free to just ignore all that
      55             :             stuff and use the automatically generated decomposition. Sigh.
      56             :         */
      57           0 :         class DRAWINGLAYER_DLLPUBLIC CropPrimitive2D : public GroupPrimitive2D
      58             :         {
      59             :         private:
      60             :             // the transformation already applied to the child geometry
      61             :             basegfx::B2DHomMatrix           maTransformation;
      62             : 
      63             :             // the crop offsets relative to the range of the unrotated content
      64             :             double                          mfCropLeft;
      65             :             double                          mfCropTop;
      66             :             double                          mfCropRight;
      67             :             double                          mfCropBottom;
      68             : 
      69             :         public:
      70             :             /// constructor
      71             :             CropPrimitive2D(
      72             :                 const Primitive2DSequence& rChildren,
      73             :                 const basegfx::B2DHomMatrix& rTransformation,
      74             :                 double fCropLeft,
      75             :                 double fCropTop,
      76             :                 double fCropRight,
      77             :                 double fCropBottom);
      78             : 
      79             :             /// data read access
      80           0 :             const basegfx::B2DHomMatrix& getTransformation() const { return maTransformation; }
      81           0 :             double getCropLeft() const { return mfCropLeft; }
      82           0 :             double getCropTop() const { return mfCropTop; }
      83           0 :             double getCropRight() const { return mfCropRight; }
      84           0 :             double getCropBottom() const { return mfCropBottom; }
      85             : 
      86             :             /// compare operator
      87             :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const SAL_OVERRIDE;
      88             : 
      89             :             /// local decomposition
      90             :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const SAL_OVERRIDE;
      91             : 
      92             :             /// provide unique ID
      93             :             DeclPrimitive2DIDBlock()
      94             :         };
      95             :     } // end of namespace primitive2d
      96             : } // end of namespace drawinglayer
      97             : 
      98             : 
      99             : 
     100             : #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
     101             : 
     102             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10