LCOV - code coverage report
Current view: top level - sw/source/core/crsr - overlayrangesoutline.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 33 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 6 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 <overlayrangesoutline.hxx>
      20             : #include <svx/sdr/overlay/overlaymanager.hxx>
      21             : #include <basegfx/polygon/b2dpolygon.hxx>
      22             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      23             : #include <basegfx/polygon/b2dpolygontools.hxx>
      24             : #include <basegfx/polygon/b2dpolypolygoncutter.hxx>
      25             : #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
      26             : 
      27             : namespace
      28             : {
      29             :     // combine ranges geometrically to a single, ORed polygon
      30           0 :     basegfx::B2DPolyPolygon impCombineRangesToPolyPolygon(const std::vector< basegfx::B2DRange >& rRanges)
      31             :     {
      32           0 :         const sal_uInt32 nCount(rRanges.size());
      33           0 :         basegfx::B2DPolyPolygon aRetval;
      34             : 
      35           0 :         for(sal_uInt32 a(0); a < nCount; a++)
      36             :         {
      37           0 :             const basegfx::B2DPolygon aDiscretePolygon(basegfx::tools::createPolygonFromRect(rRanges[a]));
      38             : 
      39           0 :             if(0 == a)
      40             :             {
      41           0 :                 aRetval.append(aDiscretePolygon);
      42             :             }
      43             :             else
      44             :             {
      45           0 :                 aRetval = basegfx::tools::solvePolygonOperationOr(aRetval, basegfx::B2DPolyPolygon(aDiscretePolygon));
      46             :             }
      47           0 :         }
      48             : 
      49           0 :         return aRetval;
      50             :     }
      51             : }
      52             : 
      53             : namespace sw
      54             : {
      55             :     namespace overlay
      56             :     {
      57           0 :         drawinglayer::primitive2d::Primitive2DSequence OverlayRangesOutline::createOverlayObjectPrimitive2DSequence()
      58             :         {
      59           0 :             drawinglayer::primitive2d::Primitive2DSequence aRetval;
      60           0 :             const sal_uInt32 nCount(getRanges().size());
      61             : 
      62           0 :             if( nCount )
      63             :             {
      64           0 :                 const basegfx::BColor aRGBColor(getBaseColor().getBColor());
      65           0 :                 const basegfx::B2DPolyPolygon aPolyPolygon(impCombineRangesToPolyPolygon(getRanges()));
      66             :                 const drawinglayer::primitive2d::Primitive2DReference aOutline(
      67             :                     new drawinglayer::primitive2d::PolyPolygonHairlinePrimitive2D(
      68             :                     aPolyPolygon,
      69           0 :                     aRGBColor));
      70             : 
      71           0 :                 aRetval.realloc(1);
      72           0 :                 aRetval[0] = aOutline;
      73             :             }
      74             : 
      75           0 :             return aRetval;
      76             :         }
      77             : 
      78           0 :         OverlayRangesOutline::OverlayRangesOutline(
      79             :             const Color& rColor,
      80             :             const std::vector< basegfx::B2DRange >& rRanges )
      81             :             : sdr::overlay::OverlayObject(rColor)
      82           0 :             , maRanges(rRanges)
      83             :         {
      84             :             // no AA for highlight overlays
      85           0 :             allowAntiAliase(false);
      86           0 :         }
      87             : 
      88           0 :         OverlayRangesOutline::~OverlayRangesOutline()
      89             :         {
      90           0 :             if( getOverlayManager() )
      91             :             {
      92           0 :                 getOverlayManager()->remove(*this);
      93             :             }
      94           0 :         }
      95             : 
      96           0 :         void OverlayRangesOutline::setRanges(const std::vector< basegfx::B2DRange >& rNew)
      97             :         {
      98           0 :             if(rNew != maRanges)
      99             :             {
     100           0 :                 maRanges = rNew;
     101           0 :                 objectChange();
     102             :             }
     103           0 :         }
     104             :     } // end of namespace overlay
     105             : } // end of namespace sdr
     106             : 
     107             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11