LCOV - code coverage report
Current view: top level - svx/source/sdr/overlay - overlayrectangle.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 27 3.7 %
Date: 2014-11-03 Functions: 2 5 40.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             : #include <sdr/overlay/overlayrectangle.hxx>
      21             : #include <vcl/outdev.hxx>
      22             : #include <basegfx/matrix/b2dhommatrix.hxx>
      23             : #include <basegfx/polygon/b2dpolygontools.hxx>
      24             : #include <basegfx/polygon/b2dpolygon.hxx>
      25             : #include <basegfx/numeric/ftools.hxx>
      26             : #include <sdr/overlay/overlaytools.hxx>
      27             : #include <svx/sdr/overlay/overlaymanager.hxx>
      28             : #include <vcl/svapp.hxx>
      29             : #include <vcl/settings.hxx>
      30             : 
      31             : 
      32             : 
      33             : namespace sdr
      34             : {
      35             :     namespace overlay
      36             :     {
      37           0 :         drawinglayer::primitive2d::Primitive2DSequence OverlayRectangle::createOverlayObjectPrimitive2DSequence()
      38             :         {
      39           0 :             const basegfx::B2DRange aHatchRange(getBasePosition(), maSecondPosition);
      40           0 :             basegfx::BColor aColor(getBaseColor().getBColor());
      41             :             static double fChange(0.1); // just small optical change, do not make it annoying
      42             : 
      43           0 :             if(mbOverlayState)
      44             :             {
      45           0 :                 aColor += basegfx::B3DTuple(fChange, fChange, fChange);
      46           0 :                 aColor.clamp();
      47             :             }
      48             :             else
      49             :             {
      50           0 :                 aColor -= basegfx::B3DTuple(fChange, fChange, fChange);
      51           0 :                 aColor.clamp();
      52             :             }
      53             : 
      54             :             const drawinglayer::primitive2d::Primitive2DReference aReference(
      55             :                 new drawinglayer::primitive2d::OverlayRectanglePrimitive(
      56             :                     aHatchRange,
      57             :                     aColor,
      58             :                     getTransparence(),
      59             :                     getDiscreteGrow(),
      60             :                     getDiscreteShrink(),
      61           0 :                     getRotation()));
      62             : 
      63           0 :             return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
      64             :         }
      65             : 
      66           0 :         OverlayRectangle::OverlayRectangle(
      67             :             const basegfx::B2DPoint& rBasePosition,
      68             :             const basegfx::B2DPoint& rSecondPosition,
      69             :             const Color& rHatchColor,
      70             :             double fTransparence,
      71             :             double fDiscreteGrow,
      72             :             double fDiscreteShrink,
      73             :             double fRotation,
      74             :             sal_uInt32 nBlinkTime,
      75             :             bool bAnimate)
      76             :         :   OverlayObjectWithBasePosition(rBasePosition, rHatchColor),
      77             :             maSecondPosition(rSecondPosition),
      78             :             mfTransparence(fTransparence),
      79             :             mfDiscreteGrow(fDiscreteGrow),
      80             :             mfDiscreteShrink(fDiscreteShrink),
      81             :             mfRotation(fRotation),
      82             :             mnBlinkTime(nBlinkTime),
      83           0 :             mbOverlayState(false)
      84             :         {
      85           0 :             if(Application::GetSettings().GetStyleSettings().GetHighContrastMode())
      86             :             {
      87             :                 // no animation in high contrast mode
      88           0 :                 bAnimate = false;
      89             :             }
      90             : 
      91             :             // set AllowsAnimation flag to mark this object as animation capable
      92           0 :             mbAllowsAnimation = bAnimate;
      93             : 
      94             :             // #i53216# check blink time value range
      95           0 :             mnBlinkTime = impCheckBlinkTimeValueRange(mnBlinkTime);
      96           0 :         }
      97             : 
      98           0 :         void OverlayRectangle::Trigger(sal_uInt32 nTime)
      99             :         {
     100           0 :             if(getOverlayManager())
     101             :             {
     102             :                 // #i53216# produce event after nTime + x
     103           0 :                 SetTime(nTime + mnBlinkTime);
     104             : 
     105             :                 // switch state
     106           0 :                 if(mbOverlayState)
     107             :                 {
     108           0 :                     mbOverlayState = false;
     109             :                 }
     110             :                 else
     111             :                 {
     112           0 :                     mbOverlayState = true;
     113             :                 }
     114             : 
     115             :                 // re-insert me as event
     116           0 :                 getOverlayManager()->InsertEvent(this);
     117             : 
     118             :                 // register change (after change)
     119           0 :                 objectChange();
     120             :             }
     121           0 :         }
     122             :     } // end of namespace overlay
     123         651 : } // end of namespace sdr
     124             : 
     125             : 
     126             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10