LCOV - code coverage report
Current view: top level - sd/source/ui/slidesorter/view - SlsFramePainter.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 1 1 100.0 %
Date: 2015-06-13 12:38:46 Functions: 1 1 100.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_SD_SOURCE_UI_SLIDESORTER_VIEW_SLSFRAMEPAINTER_HXX
      21             : #define INCLUDED_SD_SOURCE_UI_SLIDESORTER_VIEW_SLSFRAMEPAINTER_HXX
      22             : 
      23             : #include <vcl/bitmapex.hxx>
      24             : 
      25             : namespace sd { namespace slidesorter { namespace view {
      26             : 
      27             : class FramePainter
      28             : {
      29             : public:
      30             :     FramePainter (const BitmapEx& rBitmap);
      31             :     ~FramePainter();
      32             : 
      33             :     /** Paint a border around the given box by using a set of bitmaps for
      34             :         the corners and sides.
      35             :     */
      36             :     void PaintFrame (OutputDevice&rDevice, const Rectangle& rBox) const;
      37             : 
      38             :     /** Special functionality that takes the color from the center
      39             :         bitmap and replaces that color in all bitmaps by the given new
      40             :         color.  Alpha values are not modified.
      41             :         @param bClearCenterBitmap
      42             :             When <TRUE/> then the center bitmap is erased.
      43             :     */
      44             :     void AdaptColor (const Color aNewColor, const bool bClearCenterBitmap);
      45             : 
      46             : private:
      47             :     /** Bitmap with offset that is used when the bitmap is painted.  The bitmap
      48             :     */
      49        1728 :     class OffsetBitmap {
      50             :     public:
      51             :         BitmapEx maBitmap;
      52             :         Point maOffset;
      53             : 
      54             :         /** Create one of the eight shadow bitmaps from one that combines
      55             :             them all.  This larger bitmap is expected to have dimension NxN
      56             :             with N=1+2*M.  Of this larger bitmap there are created four
      57             :             corner bitmaps of size 2*M x 2*M and four side bitmaps of sizes
      58             :             1xM (top and bottom) and Mx1 (left and right).  The corner
      59             :             bitmaps have each one quadrant of size MxM that is painted under
      60             :             the interior of the frame.
      61             :             @param rBitmap
      62             :                 The larger bitmap of which the eight shadow bitmaps are cut
      63             :                 out from.
      64             :             @param nHorizontalPosition
      65             :                 Valid values are -1 (left), 0 (center), and +1 (right).
      66             :             @param nVerticalPosition
      67             :                 Valid values are -1 (top), 0 (center), and +1 (bottom).
      68             :         */
      69             :         OffsetBitmap (
      70             :             const BitmapEx& rBitmap,
      71             :             const sal_Int32 nHorizontalPosition,
      72             :             const sal_Int32 nVerticalPosition);
      73             : 
      74             :         /** Use the given device to paint the bitmap at the location that is
      75             :             the sum of the given anchor and the internal offset.
      76             :         */
      77             :         void PaintCorner (OutputDevice& rDevice, const Point& rAnchor) const;
      78             : 
      79             :         /** Use the given device to paint the bitmap stretched between the
      80             :             two given locations.  Offsets of the adjacent corner bitmaps and
      81             :             the offset of the side bitmap are used to determine the area
      82             :             that is to be filled with the side bitmap.
      83             :         */
      84             :         void PaintSide (
      85             :             OutputDevice& rDevice,
      86             :             const Point& rAnchor1,
      87             :             const Point& rAnchor2,
      88             :             const OffsetBitmap& rCornerBitmap1,
      89             :             const OffsetBitmap& rCornerBitmap2) const;
      90             : 
      91             :         /** Fill the given rectangle with the bitmap.
      92             :         */
      93             :         void PaintCenter (
      94             :             OutputDevice& rDevice,
      95             :             const Rectangle& rBox) const;
      96             :     };
      97             :     OffsetBitmap maTopLeft;
      98             :     OffsetBitmap maTop;
      99             :     OffsetBitmap maTopRight;
     100             :     OffsetBitmap maLeft;
     101             :     OffsetBitmap maRight;
     102             :     OffsetBitmap maBottomLeft;
     103             :     OffsetBitmap maBottom;
     104             :     OffsetBitmap maBottomRight;
     105             :     OffsetBitmap maCenter;
     106             :     bool mbIsValid;
     107             : };
     108             : 
     109             : } } } // end of namespace sd::slidesorter::view
     110             : 
     111             : #endif
     112             : 
     113             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11