calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / drawinglayer / source / primitive2d / sdrdecompositiontools2d.cxx
blob65770945ebbf50565e9a88087e5f20bd271778b7
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 #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
21 #include <basegfx/polygon/b2dpolygon.hxx>
22 #include <basegfx/polygon/b2dpolygontools.hxx>
23 #include <basegfx/matrix/b2dhommatrix.hxx>
24 #include <drawinglayer/primitive2d/PolyPolygonColorPrimitive2D.hxx>
25 #include <drawinglayer/primitive2d/PolyPolygonHairlinePrimitive2D.hxx>
26 #include <drawinglayer/primitive2d/hiddengeometryprimitive2d.hxx>
29 namespace drawinglayer::primitive2d
31 Primitive2DReference createHiddenGeometryPrimitives2D(
32 const basegfx::B2DHomMatrix& rMatrix)
34 const basegfx::B2DPolygon& aUnitOutline(basegfx::utils::createUnitPolygon());
36 return createHiddenGeometryPrimitives2D(
37 false/*bFilled*/,
38 basegfx::B2DPolyPolygon(aUnitOutline),
39 rMatrix);
42 Primitive2DReference createHiddenGeometryPrimitives2D(
43 const basegfx::B2DPolyPolygon& rPolyPolygon)
45 return createHiddenGeometryPrimitives2D(
46 false/*bFilled*/,
47 rPolyPolygon,
48 basegfx::B2DHomMatrix());
51 Primitive2DReference createHiddenGeometryPrimitives2D(
52 bool bFilled,
53 const basegfx::B2DRange& rRange)
55 return createHiddenGeometryPrimitives2D(
56 bFilled,
57 rRange,
58 basegfx::B2DHomMatrix());
61 Primitive2DReference createHiddenGeometryPrimitives2D(
62 bool bFilled,
63 const basegfx::B2DRange& rRange,
64 const basegfx::B2DHomMatrix& rMatrix)
66 const basegfx::B2DPolyPolygon aOutline(basegfx::utils::createPolygonFromRect(rRange));
68 return createHiddenGeometryPrimitives2D(
69 bFilled,
70 aOutline,
71 rMatrix);
74 Primitive2DReference createHiddenGeometryPrimitives2D(
75 bool bFilled,
76 const basegfx::B2DPolyPolygon& rPolyPolygon,
77 const basegfx::B2DHomMatrix& rMatrix)
79 // create fill or line primitive
80 Primitive2DReference xReference;
81 basegfx::B2DPolyPolygon aScaledOutline(rPolyPolygon);
82 aScaledOutline.transform(rMatrix);
84 if(bFilled)
86 xReference = new PolyPolygonColorPrimitive2D(
87 std::move(aScaledOutline),
88 basegfx::BColor(0.0, 0.0, 0.0));
90 else
92 const basegfx::BColor aGrayTone(0xc0 / 255.0, 0xc0 / 255.0, 0xc0 / 255.0);
94 xReference = new PolyPolygonHairlinePrimitive2D(
95 std::move(aScaledOutline),
96 aGrayTone);
99 // create HiddenGeometryPrimitive2D
100 return Primitive2DReference(
101 new HiddenGeometryPrimitive2D(Primitive2DContainer { xReference }));
104 } // end of namespace
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */