LCOV - code coverage report
Current view: top level - sc/source/ui/view - overlayobject.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 31 3.2 %
Date: 2014-11-03 Functions: 2 8 25.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 "overlayobject.hxx"
      21             : #include <vcl/outdev.hxx>
      22             : #include <vcl/lineinfo.hxx>
      23             : #include <tools/fract.hxx>
      24             : #include <basegfx/range/b2drange.hxx>
      25             : #include <basegfx/polygon/b2dpolygon.hxx>
      26             : #include <basegfx/polygon/b2dpolygontools.hxx>
      27             : #include <svx/sdr/overlay/overlaymanager.hxx>
      28             : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      29             : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      30             : 
      31             : using ::sdr::overlay::OverlayObject;
      32             : using ::sdr::overlay::OverlayManager;
      33             : using ::drawinglayer::primitive2d::Primitive2DSequence;
      34             : 
      35             : #define DASH_UPDATE_INTERVAL 180    // in msec
      36             : 
      37           0 : ScOverlayDashedBorder::ScOverlayDashedBorder(const ::basegfx::B2DRange& rRange, const Color& rColor) :
      38             :     OverlayObject(rColor),
      39           0 :     mbToggle(true)
      40             : {
      41           0 :     mbAllowsAnimation = true;
      42           0 :     maRange = rRange;
      43           0 : }
      44             : 
      45           0 : ScOverlayDashedBorder::~ScOverlayDashedBorder()
      46             : {
      47           0 : }
      48             : 
      49           0 : void ScOverlayDashedBorder::Trigger(sal_uInt32 nTime)
      50             : {
      51           0 :     OverlayManager* pMgr = getOverlayManager();
      52           0 :     if (pMgr)
      53             :     {
      54           0 :         SetTime(nTime + DASH_UPDATE_INTERVAL);
      55           0 :         mbToggle = !mbToggle;
      56           0 :         pMgr->InsertEvent(this);
      57           0 :         objectChange();
      58             :     }
      59           0 : }
      60             : 
      61           0 : void ScOverlayDashedBorder::stripeDefinitionHasChanged()
      62             : {
      63           0 :     objectChange();
      64           0 : }
      65             : 
      66           0 : Primitive2DSequence ScOverlayDashedBorder::createOverlayObjectPrimitive2DSequence()
      67             : {
      68             :     using ::basegfx::B2DPolygon;
      69             :     using ::basegfx::B2DPolyPolygon;
      70             : 
      71           0 :     OverlayManager* pMgr = getOverlayManager();
      72           0 :     if (!pMgr)
      73           0 :         return Primitive2DSequence();
      74             : 
      75           0 :     basegfx::BColor aColorA = pMgr->getStripeColorA().getBColor();
      76           0 :     basegfx::BColor aColorB = pMgr->getStripeColorB().getBColor();
      77           0 :     if (!mbToggle)
      78           0 :         ::std::swap(aColorA, aColorB);
      79             : 
      80           0 :     const basegfx::B2DPolygon aPoly = basegfx::tools::createPolygonFromRect(maRange);
      81           0 :     B2DPolyPolygon aPolygon(aPoly);
      82             :     const drawinglayer::primitive2d::Primitive2DReference aReference(
      83             :         new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
      84           0 :             aPolygon, aColorA, aColorB, pMgr->getStripeLengthPixel()));
      85             : 
      86           0 :     return drawinglayer::primitive2d::Primitive2DSequence(&aReference, 1);
      87         228 : }
      88             : 
      89             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10