LCOV - code coverage report
Current view: top level - sfx2/source/sidebar - Paint.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 34 0.0 %
Date: 2014-04-14 Functions: 0 8 0.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             : #include "Paint.hxx"
      20             : #include <sfx2/sidebar/Tools.hxx>
      21             : #include <com/sun/star/awt/Gradient.hpp>
      22             : 
      23             : 
      24             : using namespace ::com::sun::star;
      25             : 
      26             : namespace sfx2 { namespace sidebar {
      27             : 
      28           0 : Paint::Paint (void)
      29           0 :     : meType(NoPaint)
      30             : {
      31           0 : }
      32             : 
      33             : 
      34             : 
      35             : 
      36           0 : Paint::Paint (const Color& rColor)
      37             :     : meType(ColorPaint),
      38           0 :       maValue(rColor)
      39             : {
      40           0 : }
      41             : 
      42             : 
      43             : 
      44             : 
      45           0 : Paint::Paint (const Gradient& rGradient)
      46             :     : meType(GradientPaint),
      47           0 :       maValue(rGradient)
      48             : {
      49           0 : }
      50             : 
      51             : 
      52             : 
      53             : 
      54           0 : Paint Paint::Create (const cssu::Any& rValue)
      55             : {
      56           0 :     ColorData aColor (0);
      57           0 :     if (rValue >>= aColor)
      58           0 :         return Paint(Color(aColor));
      59             : 
      60           0 :     awt::Gradient aAwtGradient;
      61           0 :     if (rValue >>= aAwtGradient)
      62           0 :         return Paint(Tools::AwtToVclGradient(aAwtGradient));
      63             : 
      64           0 :     return Paint();
      65             : }
      66             : 
      67             : 
      68             : 
      69             : 
      70           0 : Paint::Type Paint::GetType (void) const
      71             : {
      72           0 :     return meType;
      73             : }
      74             : 
      75             : 
      76             : 
      77             : 
      78           0 : const Color& Paint::GetColor (void) const
      79             : {
      80           0 :     if (meType != ColorPaint)
      81             :     {
      82             :         assert(meType==ColorPaint);
      83           0 :         static Color aErrorColor;
      84           0 :         return aErrorColor;
      85             :     }
      86             :     else
      87           0 :         return ::boost::get<Color>(maValue);
      88             : }
      89             : 
      90             : 
      91             : 
      92             : 
      93           0 : const Gradient& Paint::GetGradient (void) const
      94             : {
      95           0 :     if (meType != GradientPaint)
      96             :     {
      97             :         assert(meType==GradientPaint);
      98           0 :         static Gradient aErrorGradient;
      99           0 :         return aErrorGradient;
     100             :     }
     101             :     else
     102           0 :         return ::boost::get<Gradient>(maValue);
     103             : }
     104             : 
     105             : 
     106             : 
     107             : 
     108           0 : Wallpaper Paint::GetWallpaper (void) const
     109             : {
     110           0 :     switch (meType)
     111             :     {
     112             :         case Paint::NoPaint:
     113             :         default:
     114           0 :             return Wallpaper();
     115             :             break;
     116             : 
     117             :         case Paint::ColorPaint:
     118           0 :             return Wallpaper(GetColor());
     119             :             break;
     120             : 
     121             :         case Paint::GradientPaint:
     122           0 :             return Wallpaper(GetGradient());
     123             :             break;
     124             :     }
     125             : }
     126             : 
     127             : 
     128             : } } // end of namespace sfx2::sidebar
     129             : 
     130             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10