tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sd / source / ui / slidesorter / view / SlsFramePainter.hxx
blob9398cb94ecd5fae3580a556caa768b844345dd8d
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 <vcl/bitmapex.hxx>
24 namespace sd::slidesorter::view {
26 class FramePainter
28 public:
29 explicit FramePainter (const BitmapEx& rBitmap);
30 ~FramePainter();
32 /** Paint a border around the given box by using a set of bitmaps for
33 the corners and sides.
35 void PaintFrame (OutputDevice&rDevice, const ::tools::Rectangle& rBox) const;
37 /** Special functionality that takes the color from the center
38 bitmap and replaces that color in all bitmaps by the given new
39 color. Alpha values are not modified.
40 The center bitmap is erased.
42 void AdaptColor (const Color aNewColor);
44 private:
45 /** Bitmap with offset that is used when the bitmap is painted. The bitmap
47 class OffsetBitmap {
48 public:
49 BitmapEx maBitmap;
50 Point maOffset;
52 /** Create one of the eight shadow bitmaps from one that combines
53 them all. This larger bitmap is expected to have dimension NxN
54 with N=1+2*M. Of this larger bitmap there are created four
55 corner bitmaps of size 2*M x 2*M and four side bitmaps of sizes
56 1xM (top and bottom) and Mx1 (left and right). The corner
57 bitmaps have each one quadrant of size MxM that is painted under
58 the interior of the frame.
59 @param rBitmap
60 The larger bitmap of which the eight shadow bitmaps are cut
61 out from.
62 @param nHorizontalPosition
63 Valid values are -1 (left), 0 (center), and +1 (right).
64 @param nVerticalPosition
65 Valid values are -1 (top), 0 (center), and +1 (bottom).
67 OffsetBitmap (
68 const BitmapEx& rBitmap,
69 const sal_Int32 nHorizontalPosition,
70 const sal_Int32 nVerticalPosition);
72 /** Use the given device to paint the bitmap at the location that is
73 the sum of the given anchor and the internal offset.
75 void PaintCorner (OutputDevice& rDevice, const Point& rAnchor) const;
77 /** Use the given device to paint the bitmap stretched between the
78 two given locations. Offsets of the adjacent corner bitmaps and
79 the offset of the side bitmap are used to determine the area
80 that is to be filled with the side bitmap.
82 void PaintSide (
83 OutputDevice& rDevice,
84 const Point& rAnchor1,
85 const Point& rAnchor2,
86 const OffsetBitmap& rCornerBitmap1,
87 const OffsetBitmap& rCornerBitmap2) const;
89 /** Fill the given rectangle with the bitmap.
91 void PaintCenter (
92 OutputDevice& rDevice,
93 const ::tools::Rectangle& rBox) const;
95 OffsetBitmap maTopLeft;
96 OffsetBitmap maTop;
97 OffsetBitmap maTopRight;
98 OffsetBitmap maLeft;
99 OffsetBitmap maRight;
100 OffsetBitmap maBottomLeft;
101 OffsetBitmap maBottom;
102 OffsetBitmap maBottomRight;
103 OffsetBitmap maCenter;
104 bool mbIsValid;
107 } // end of namespace sd::slidesorter::view
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */