1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
21 #define INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
23 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
25 #include <basegfx/matrix/b2dhommatrix.hxx>
29 namespace drawinglayer
33 /** CropPrimitive2D class
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.
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).
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)...
54 Of course this is a primitive, so feel free to just ignore all that
55 stuff and use the automatically generated decomposition. Sigh.
57 class DRAWINGLAYER_DLLPUBLIC CropPrimitive2D
: public GroupPrimitive2D
60 // the transformation already applied to the child geometry
61 basegfx::B2DHomMatrix maTransformation
;
63 // the crop offsets relative to the range of the unrotated content
72 const Primitive2DSequence
& rChildren
,
73 const basegfx::B2DHomMatrix
& rTransformation
,
80 const basegfx::B2DHomMatrix
& getTransformation() const { return maTransformation
; }
81 double getCropLeft() const { return mfCropLeft
; }
82 double getCropTop() const { return mfCropTop
; }
83 double getCropRight() const { return mfCropRight
; }
84 double getCropBottom() const { return mfCropBottom
; }
87 virtual bool operator==(const BasePrimitive2D
& rPrimitive
) const SAL_OVERRIDE
;
89 /// local decomposition
90 virtual Primitive2DSequence
get2DDecomposition(const geometry::ViewInformation2D
& rViewInformation
) const SAL_OVERRIDE
;
93 DeclPrimitive2DIDBlock()
95 } // end of namespace primitive2d
96 } // end of namespace drawinglayer
100 #endif //INCLUDED_DRAWINGLAYER_PRIMITIVE2D_CROPPRIMITIVE2D_HXX
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */