tdf#154546 skip dispatch when presenter controller is not set
[LibreOffice.git] / include / drawinglayer / primitive2d / gridprimitive2d.hxx
bloba6d4d03c588e7c6a30f03bc81f45e5fb950bc2ec
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 #pragma once
22 #include <drawinglayer/drawinglayerdllapi.h>
24 #include <drawinglayer/primitive2d/BufferedDecompositionPrimitive2D.hxx>
25 #include <basegfx/matrix/b2dhommatrix.hxx>
26 #include <basegfx/color/bcolor.hxx>
27 #include <vcl/bitmapex.hxx>
30 // GridPrimitive2D class
32 namespace drawinglayer::primitive2d
34 /** GridPrimitive2D class
36 This primitive is specialized to Grid visualisation. The graphic definition
37 (Transform) contains the whole grid area, but will of course be combined
38 with the visible area (Viewport) when decomposed. Also a resolution-dependent
39 point reduction is used to not create too much grid visualisation data. This
40 makes this primitive highly view-dependent and it dynamically buffers
41 the last decomposition dependent from the Viewport used.
43 class DRAWINGLAYER_DLLPUBLIC GridPrimitive2D final : public BufferedDecompositionPrimitive2D
45 private:
46 /// The geometry definition for the grid area
47 basegfx::B2DHomMatrix maTransform;
49 /// grid layout definitions
50 double mfWidth;
51 double mfHeight;
52 double mfSmallestViewDistance;
53 double mfSmallestSubdivisionViewDistance;
54 sal_uInt32 mnSubdivisionsX;
55 sal_uInt32 mnSubdivisionsY;
57 /// Grid color for single-pixel grid points
58 basegfx::BColor maBColor;
60 /// The Bitmap (with transparence) for grid cross points
61 BitmapEx maCrossMarker;
63 /** the last used object to view transformtion and the last Viewport,
64 used from getDecomposition for decide buffering
66 basegfx::B2DHomMatrix maLastObjectToViewTransformation;
67 basegfx::B2DRange maLastViewport;
69 /// create local decomposition
70 virtual void create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& rViewInformation) const override;
72 public:
73 /// constructor
74 GridPrimitive2D(
75 basegfx::B2DHomMatrix aTransform,
76 double fWidth,
77 double fHeight,
78 double fSmallestViewDistance,
79 double fSmallestSubdivisionViewDistance,
80 sal_uInt32 nSubdivisionsX,
81 sal_uInt32 nSubdivisionsY,
82 const basegfx::BColor& rBColor,
83 const BitmapEx& rCrossMarker);
85 /// data read access
86 const basegfx::B2DHomMatrix& getTransform() const { return maTransform; }
87 double getWidth() const { return mfWidth; }
88 double getHeight() const { return mfHeight; }
89 double getSmallestViewDistance() const { return mfSmallestViewDistance; }
90 double getSmallestSubdivisionViewDistance() const { return mfSmallestSubdivisionViewDistance; }
91 sal_uInt32 getSubdivisionsX() const { return mnSubdivisionsX; }
92 sal_uInt32 getSubdivisionsY() const { return mnSubdivisionsY; }
93 const basegfx::BColor& getBColor() const { return maBColor; }
94 const BitmapEx& getCrossMarker() const { return maCrossMarker; }
96 /// compare operator
97 virtual bool operator==(const BasePrimitive2D& rPrimitive) const override;
99 /// get 2d range
100 virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const override;
102 /// provide unique ID
103 virtual sal_uInt32 getPrimitive2DID() const override;
105 /// Override standard getDecomposition to be view-dependent here
106 virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override;
108 } // end of namespace drawinglayer::primitive2d
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */