LCOV - code coverage report
Current view: top level - svx/source/sdr/overlay - overlayrollingrectangle.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 1 36 2.8 %
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 <sdr/overlay/overlayrollingrectangle.hxx>
      21             : #include <vcl/outdev.hxx>
      22             : #include <basegfx/matrix/b2dhommatrix.hxx>
      23             : #include <sdr/overlay/overlaytools.hxx>
      24             : #include <svx/sdr/overlay/overlaymanager.hxx>
      25             : #include <basegfx/polygon/b2dpolygontools.hxx>
      26             : #include <basegfx/polygon/b2dpolygon.hxx>
      27             : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      28             : 
      29             : 
      30             : 
      31             : namespace sdr
      32             : {
      33             :     namespace overlay
      34             :     {
      35           0 :         drawinglayer::primitive2d::Primitive2DSequence OverlayRollingRectangleStriped::createOverlayObjectPrimitive2DSequence()
      36             :         {
      37           0 :             drawinglayer::primitive2d::Primitive2DSequence aRetval;
      38             : 
      39           0 :             if(getOverlayManager() && (getShowBounds() || getExtendedLines()))
      40             :             {
      41           0 :                 const basegfx::BColor aRGBColorA(getOverlayManager()->getStripeColorA().getBColor());
      42           0 :                 const basegfx::BColor aRGBColorB(getOverlayManager()->getStripeColorB().getBColor());
      43           0 :                 const double fStripeLengthPixel(getOverlayManager()->getStripeLengthPixel());
      44           0 :                 const basegfx::B2DRange aRollingRectangle(getBasePosition(), getSecondPosition());
      45             : 
      46           0 :                 if(getShowBounds())
      47             :                 {
      48             :                     // view-independent part, create directly
      49           0 :                     const basegfx::B2DPolygon aPolygon(basegfx::tools::createPolygonFromRect(aRollingRectangle));
      50             : 
      51           0 :                     aRetval.realloc(2);
      52           0 :                     aRetval[0] = new drawinglayer::primitive2d::PolyPolygonMarkerPrimitive2D(
      53             :                         basegfx::B2DPolyPolygon(aPolygon),
      54             :                         aRGBColorA,
      55             :                         aRGBColorB,
      56           0 :                         fStripeLengthPixel);
      57             : 
      58           0 :                     const SvtOptionsDrawinglayer aSvtOptionsDrawinglayer;
      59           0 :                     const basegfx::BColor aHilightColor(aSvtOptionsDrawinglayer.getHilightColor().getBColor());
      60           0 :                     const double fTransparence(aSvtOptionsDrawinglayer.GetTransparentSelectionPercent() * 0.01);
      61             : 
      62           0 :                     aRetval[1] = new drawinglayer::primitive2d::PolyPolygonSelectionPrimitive2D(
      63             :                         basegfx::B2DPolyPolygon(aPolygon),
      64             :                         aHilightColor,
      65             :                         fTransparence,
      66             :                         3.0,
      67           0 :                         false);
      68             :                 }
      69             : 
      70           0 :                 if(getExtendedLines())
      71             :                 {
      72             :                     // view-dependent part, use helper primitive
      73             :                     const drawinglayer::primitive2d::Primitive2DReference aReference(
      74             :                         new drawinglayer::primitive2d::OverlayRollingRectanglePrimitive(
      75             :                             aRollingRectangle,
      76             :                             aRGBColorA,
      77             :                             aRGBColorB,
      78           0 :                             fStripeLengthPixel));
      79             : 
      80           0 :                     drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(aRetval, aReference);
      81           0 :                 }
      82             :             }
      83             : 
      84           0 :             return aRetval;
      85             :         }
      86             : 
      87           0 :         void OverlayRollingRectangleStriped::stripeDefinitionHasChanged()
      88             :         {
      89             :             // react on OverlayManager's stripe definition change
      90           0 :             objectChange();
      91           0 :         }
      92             : 
      93           0 :         OverlayRollingRectangleStriped::OverlayRollingRectangleStriped(
      94             :             const basegfx::B2DPoint& rBasePos,
      95             :             const basegfx::B2DPoint& rSecondPos,
      96             :             bool bExtendedLines,
      97             :             bool bShowBounds)
      98             :         :   OverlayObjectWithBasePosition(rBasePos, Color(COL_BLACK)),
      99             :             maSecondPosition(rSecondPos),
     100             :             mbExtendedLines(bExtendedLines),
     101           0 :             mbShowBounds(bShowBounds)
     102             :         {
     103           0 :         }
     104             : 
     105           0 :         OverlayRollingRectangleStriped::~OverlayRollingRectangleStriped()
     106             :         {
     107           0 :         }
     108             : 
     109           0 :         void OverlayRollingRectangleStriped::setSecondPosition(const basegfx::B2DPoint& rNew)
     110             :         {
     111           0 :             if(rNew != maSecondPosition)
     112             :             {
     113             :                 // remember new value
     114           0 :                 maSecondPosition = rNew;
     115             : 
     116             :                 // register change (after change)
     117           0 :                 objectChange();
     118             :             }
     119           0 :         }
     120             :     } // end of namespace overlay
     121         651 : } // end of namespace sdr
     122             : 
     123             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10